From: Kay Sievers Date: Wed, 21 Dec 2011 23:09:53 +0000 (-0800) Subject: mips: 7segled - convert sysdev_class to a regular subsystem X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0e38eaf34e0d9955aeaaed9648b2cfaba3076fee;p=mv-sheeva.git mips: 7segled - convert sysdev_class to a regular subsystem After all sysdev classes are ported to regular driver core entities, the sysdev implementation will be entirely removed from the kernel. Cc: Ralf Baechle Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c index 7f8416f8622..8e93b212252 100644 --- a/arch/mips/txx9/generic/7segled.c +++ b/arch/mips/txx9/generic/7segled.c @@ -9,7 +9,7 @@ * (C) Copyright TOSHIBA CORPORATION 2005-2007 * All Rights Reserved. */ -#include +#include #include #include #include @@ -37,8 +37,8 @@ int txx9_7segled_putc(unsigned int pos, char c) return 0; } -static ssize_t ascii_store(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t ascii_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) { unsigned int ch = dev->id; @@ -46,8 +46,8 @@ static ssize_t ascii_store(struct sys_device *dev, return size; } -static ssize_t raw_store(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t raw_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) { unsigned int ch = dev->id; @@ -55,19 +55,19 @@ static ssize_t raw_store(struct sys_device *dev, return size; } -static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store); -static SYSDEV_ATTR(raw, 0200, NULL, raw_store); +static DEVICE_ATTR(ascii, 0200, NULL, ascii_store); +static DEVICE_ATTR(raw, 0200, NULL, raw_store); -static ssize_t map_seg7_show(struct sysdev_class *class, - struct sysdev_class_attribute *attr, +static ssize_t map_seg7_show(struct device *dev, + struct device_attribute *attr, char *buf) { memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); return sizeof(txx9_seg7map); } -static ssize_t map_seg7_store(struct sysdev_class *class, - struct sysdev_class_attribute *attr, +static ssize_t map_seg7_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) { if (size != sizeof(txx9_seg7map)) @@ -76,10 +76,11 @@ static ssize_t map_seg7_store(struct sysdev_class *class, return size; } -static SYSDEV_CLASS_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store); +static DEVICE_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store); -static struct sysdev_class tx_7segled_sysdev_class = { - .name = "7segled", +static struct bus_type tx_7segled_subsys = { + .name = "7segled", + .dev_name = "7segled", }; static int __init tx_7segled_init_sysfs(void) @@ -87,26 +88,25 @@ static int __init tx_7segled_init_sysfs(void) int error, i; if (!tx_7segled_num) return -ENODEV; - error = sysdev_class_register(&tx_7segled_sysdev_class); + error = subsys_system_register(&tx_7segled_subsys, NULL); if (error) return error; - error = sysdev_class_create_file(&tx_7segled_sysdev_class, - &attr_map_seg7); + error = device_create_file(tx_7segled_subsys.dev_root, &dev_attr_map_seg7); if (error) return error; for (i = 0; i < tx_7segled_num; i++) { - struct sys_device *dev; + struct device *dev; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) { error = -ENODEV; break; } dev->id = i; - dev->cls = &tx_7segled_sysdev_class; - error = sysdev_register(dev); + dev->dev = &tx_7segled_subsys; + error = device_register(dev); if (!error) { - sysdev_create_file(dev, &attr_ascii); - sysdev_create_file(dev, &attr_raw); + device_create_file(dev, &dev_attr_ascii); + device_create_file(dev, &dev_attr_raw); } } return error;