summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-04-06 10:49:11 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-04-11 11:48:35 +0200
commitc57fa97ee7e50a8bddf3ad51e94071bdbb6f8a3a (patch)
treeb8466c4b76b3b70fd17634f620d0baa80343dfef
parent0a4c7871715eb3cffae98af7cacd24f088d5bdeb (diff)
downloadbarebox-c57fa97ee7e50a8bddf3ad51e94071bdbb6f8a3a.tar.gz
barebox-c57fa97ee7e50a8bddf3ad51e94071bdbb6f8a3a.tar.xz
param: pass param to dev_remove_param
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/param.h4
-rw-r--r--lib/parameter.c17
2 files changed, 8 insertions, 13 deletions
diff --git a/include/param.h b/include/param.h
index 3c881d7804..4af2d09c4c 100644
--- a/include/param.h
+++ b/include/param.h
@@ -50,7 +50,7 @@ struct param_d *dev_add_param_ip(struct device_d *dev, const char *name,
int dev_add_param_fixed(struct device_d *dev, char *name, char *value);
-void dev_remove_param(struct device_d *dev, char *name);
+void dev_remove_param(struct param_d *p);
void dev_remove_parameters(struct device_d *dev);
@@ -116,7 +116,7 @@ static inline int dev_add_param_fixed(struct device_d *dev, char *name, char *va
return 0;
}
-static inline void dev_remove_param(struct device_d *dev, char *name) {}
+static inline void dev_remove_param(struct param_d *p) {}
static inline void dev_remove_parameters(struct device_d *dev) {}
diff --git a/lib/parameter.c b/lib/parameter.c
index 97105db7ae..e47e8b9148 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -444,19 +444,14 @@ struct param_d *dev_add_param_ip(struct device_d *dev, const char *name,
/**
* dev_remove_param - remove a parameter from a device and free its
* memory
- * @param dev The device
- * @param name The name of the parameter
+ * @param p The parameter
*/
-void dev_remove_param(struct device_d *dev, char *name)
+void dev_remove_param(struct param_d *p)
{
- struct param_d *p = get_param_by_name(dev, name);
-
- if (p) {
- p->set(dev, p, NULL);
- list_del(&p->list);
- free(p->name);
- free(p);
- }
+ p->set(p->dev, p, NULL);
+ list_del(&p->list);
+ free(p->name);
+ free(p);
}
/**