From: Kay Sievers Date: Wed, 14 Dec 2011 23:26:15 +0000 (-0800) Subject: ibm_rtl: convert sysdev_class to a regular subsystem X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=15916a123e59b84d2fdfcccac84c99d1777f2a45;p=linux-beck.git ibm_rtl: 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: Matthew Garrett Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c index 811d436cd677..42a7d603c870 100644 --- a/drivers/platform/x86/ibm_rtl.c +++ b/drivers/platform/x86/ibm_rtl.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -165,22 +164,22 @@ static int ibm_rtl_write(u8 value) return ret; } -static ssize_t rtl_show_version(struct sysdev_class * dev, - struct sysdev_class_attribute *attr, +static ssize_t rtl_show_version(struct device *dev, + struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version)); } -static ssize_t rtl_show_state(struct sysdev_class *dev, - struct sysdev_class_attribute *attr, +static ssize_t rtl_show_state(struct device *dev, + struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status)); } -static ssize_t rtl_set_state(struct sysdev_class *dev, - struct sysdev_class_attribute *attr, +static ssize_t rtl_set_state(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -205,27 +204,28 @@ static ssize_t rtl_set_state(struct sysdev_class *dev, return ret; } -static struct sysdev_class class_rtl = { +static struct bus_type rtl_subsys = { .name = "ibm_rtl", + .dev_name = "ibm_rtl", }; -static SYSDEV_CLASS_ATTR(version, S_IRUGO, rtl_show_version, NULL); -static SYSDEV_CLASS_ATTR(state, 0600, rtl_show_state, rtl_set_state); +static DEVICE_ATTR(version, S_IRUGO, rtl_show_version, NULL); +static DEVICE_ATTR(state, 0600, rtl_show_state, rtl_set_state); -static struct sysdev_class_attribute *rtl_attributes[] = { - &attr_version, - &attr_state, +static struct device_attribute *rtl_attributes[] = { + &dev_attr_version, + &dev_attr_state, NULL }; static int rtl_setup_sysfs(void) { int ret, i; - ret = sysdev_class_register(&class_rtl); + ret = subsys_system_register(&rtl_subsys, NULL); if (!ret) { for (i = 0; rtl_attributes[i]; i ++) - sysdev_class_create_file(&class_rtl, rtl_attributes[i]); + device_create_file(rtl_subsys.dev_root, rtl_attributes[i]); } return ret; } @@ -233,8 +233,8 @@ static int rtl_setup_sysfs(void) { static void rtl_teardown_sysfs(void) { int i; for (i = 0; rtl_attributes[i]; i ++) - sysdev_class_remove_file(&class_rtl, rtl_attributes[i]); - sysdev_class_unregister(&class_rtl); + device_remove_file(rtl_subsys.dev_root, rtl_attributes[i]); + bus_unregister(&rtl_subsys); }