diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-02-25 14:24:38 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-02-25 15:16:14 +0100 |
commit | a9236dd6b5ee20fe47905a761d2096163569146d (patch) | |
tree | b6150abf850e98eac9b7a82a85635777603cb6dc /common | |
parent | 3a92711511144763e42a9605479160583409861c (diff) | |
download | barebox-a9236dd6b5ee20fe47905a761d2096163569146d.tar.gz barebox-a9236dd6b5ee20fe47905a761d2096163569146d.tar.xz |
console: use container_of instead of type_data
This reduces the usage of type_data.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/console.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/common/console.c b/common/console.c index abc06271ff..83cc2a5a4d 100644 --- a/common/console.c +++ b/common/console.c @@ -44,12 +44,14 @@ EXPORT_SYMBOL(console_list); #define CONSOLE_INITIALIZED_BUFFER 1 #define CONSOLE_INIT_FULL 2 +#define to_console_dev(d) container_of(d, struct console_device, class_dev) + static int initialized = 0; static int console_std_set(struct device_d *dev, struct param_d *param, const char *val) { - struct console_device *cdev = dev->type_data; + struct console_device *cdev = to_console_dev(dev); char active[4]; unsigned int flag = 0, i = 0; @@ -82,7 +84,7 @@ static int console_std_set(struct device_d *dev, struct param_d *param, static int console_baudrate_set(struct device_d *dev, struct param_d *param, const char *val) { - struct console_device *cdev = dev->type_data; + struct console_device *cdev = to_console_dev(dev); int baudrate; char baudstr[16]; unsigned char c; @@ -141,7 +143,6 @@ int console_register(struct console_device *newcdev) dev->id = -1; strcpy(dev->name, "cs"); - dev->type_data = newcdev; if (newcdev->dev) dev_add_child(newcdev->dev, dev); register_device(dev); |