[PATCH 15/21] param: pass param to dev_remove_param
Sascha Hauer
s.hauer at pengutronix.de
Sun Apr 7 10:00:49 EDT 2013
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
include/param.h | 4 ++--
lib/parameter.c | 17 ++++++-----------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/include/param.h b/include/param.h
index 3061cfd..2dc2c83 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 fe35f54..7fe3aee 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -442,19 +442,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);
}
/**
--
1.8.2.rc2
More information about the barebox
mailing list