diff --git a/include/param.h b/include/param.h index 3c881d780..4af2d09c4 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 97105db7a..e47e8b914 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); } /**