summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-06-03 10:13:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2010-06-17 08:28:25 +0200
commitc3789cd49b43ec1c414ba1b0e9f48e8ccc19f8e1 (patch)
tree8df082be53b5f2538956daf5e3c0295eff58de23 /include
parent57e1fc33bda4f4f215bdaa7ebb2a79cc5aac3799 (diff)
downloadbarebox-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')
-rw-r--r--include/console.h6
-rw-r--r--include/driver.h2
-rw-r--r--include/fb.h2
-rw-r--r--include/net.h6
-rw-r--r--include/param.h15
5 files changed, 15 insertions, 16 deletions
diff --git a/include/console.h b/include/console.h
index 3568c562a8..3bcc5dbbc0 100644
--- a/include/console.h
+++ b/include/console.h
@@ -46,12 +46,6 @@ struct console_device {
unsigned char f_caps;
unsigned char f_active;
-
- struct param_d baudrate_param;
- char baudrate_string[8];
-
- struct param_d active_param;
- char active[4];
};
int console_register(struct console_device *cdev);
diff --git a/include/driver.h b/include/driver.h
index 1dde38e021..6950c02047 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -98,7 +98,7 @@ struct device_d {
/*! The parameters for this device. This is used to carry information
* of board specific data from the board code to the device driver. */
- struct param_d *param;
+ struct list_head parameters;
struct list_head cdevs;
};
diff --git a/include/fb.h b/include/fb.h
index f213c420d4..218500b985 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -80,8 +80,6 @@ struct fb_info {
struct fb_ops *fbops;
struct device_d dev; /* This is this fb device */
- struct param_d param_enable;
- char enable_string[1];
void *screen_base;
diff --git a/include/net.h b/include/net.h
index a2863d0829..15106a7826 100644
--- a/include/net.h
+++ b/include/net.h
@@ -41,12 +41,6 @@ struct eth_device {
struct eth_device *next;
void *priv;
- struct param_d param_ip;
- struct param_d param_netmask;
- struct param_d param_gateway;
- struct param_d param_serverip;
- struct param_d param_ethaddr;
-
struct device_d dev;
struct list_head list;
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);