diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-06-03 10:13:29 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-06-17 08:28:25 +0200 |
commit | c3789cd49b43ec1c414ba1b0e9f48e8ccc19f8e1 (patch) | |
tree | 8df082be53b5f2538956daf5e3c0295eff58de23 /include/param.h | |
parent | 57e1fc33bda4f4f215bdaa7ebb2a79cc5aac3799 (diff) | |
download | barebox-c3789cd49b43ec1c414ba1b0e9f48e8ccc19f8e1.tar.gz barebox-c3789cd49b43ec1c414ba1b0e9f48e8ccc19f8e1.tar.xz |
rework device parameters
Change device parameters so that the memory management is in generic
code. This also removes the need of storing statically initialized
parameters as they are stored in a struct list_head for each device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/param.h')
-rw-r--r-- | include/param.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/param.h b/include/param.h index fe4468ed2c..207ad5016a 100644 --- a/include/param.h +++ b/include/param.h @@ -2,6 +2,7 @@ #define PARAM_H #include <linux/types.h> +#include <linux/list.h> #define PARAM_FLAG_RO (1 << 0) @@ -15,12 +16,24 @@ struct param_d { char *name; struct param_d *next; char *value; + struct list_head list; }; const char *dev_get_param(struct device_d *dev, const char *name); int dev_set_param(struct device_d *dev, const char *name, const char *val); struct param_d *get_param_by_name(struct device_d *dev, const char *name); -int dev_add_param(struct device_d *dev, struct param_d *par); + +int dev_add_param(struct device_d *dev, char *name, + int (*set)(struct device_d *dev, struct param_d *p, const char *val), + char *(*get)(struct device_d *, struct param_d *p), + unsigned long flags); + +int dev_add_param_fixed(struct device_d *dev, char *name, char *value); + +void dev_remove_parameters(struct device_d *dev); + +int dev_param_set_generic(struct device_d *dev, struct param_d *p, + const char *val); /* Convenience functions to handle a parameter as an ip address */ int dev_set_param_ip(struct device_d *dev, char *name, IPaddr_t ip); |