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 <mjg@redhat.com> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
fe5ff8b84c
commit
15916a123e
|
@ -28,7 +28,6 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/sysdev.h>
|
|
||||||
#include <linux/dmi.h>
|
#include <linux/dmi.h>
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
@ -165,22 +164,22 @@ static int ibm_rtl_write(u8 value)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t rtl_show_version(struct sysdev_class * dev,
|
static ssize_t rtl_show_version(struct device *dev,
|
||||||
struct sysdev_class_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version));
|
return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t rtl_show_state(struct sysdev_class *dev,
|
static ssize_t rtl_show_state(struct device *dev,
|
||||||
struct sysdev_class_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status));
|
return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t rtl_set_state(struct sysdev_class *dev,
|
static ssize_t rtl_set_state(struct device *dev,
|
||||||
struct sysdev_class_attribute *attr,
|
struct device_attribute *attr,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
|
@ -205,27 +204,28 @@ static ssize_t rtl_set_state(struct sysdev_class *dev,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sysdev_class class_rtl = {
|
static struct bus_type rtl_subsys = {
|
||||||
.name = "ibm_rtl",
|
.name = "ibm_rtl",
|
||||||
|
.dev_name = "ibm_rtl",
|
||||||
};
|
};
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(version, S_IRUGO, rtl_show_version, NULL);
|
static DEVICE_ATTR(version, S_IRUGO, rtl_show_version, NULL);
|
||||||
static SYSDEV_CLASS_ATTR(state, 0600, rtl_show_state, rtl_set_state);
|
static DEVICE_ATTR(state, 0600, rtl_show_state, rtl_set_state);
|
||||||
|
|
||||||
static struct sysdev_class_attribute *rtl_attributes[] = {
|
static struct device_attribute *rtl_attributes[] = {
|
||||||
&attr_version,
|
&dev_attr_version,
|
||||||
&attr_state,
|
&dev_attr_state,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int rtl_setup_sysfs(void) {
|
static int rtl_setup_sysfs(void) {
|
||||||
int ret, i;
|
int ret, i;
|
||||||
ret = sysdev_class_register(&class_rtl);
|
|
||||||
|
|
||||||
|
ret = subsys_system_register(&rtl_subsys, NULL);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
for (i = 0; rtl_attributes[i]; i ++)
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -233,8 +233,8 @@ static int rtl_setup_sysfs(void) {
|
||||||
static void rtl_teardown_sysfs(void) {
|
static void rtl_teardown_sysfs(void) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; rtl_attributes[i]; i ++)
|
for (i = 0; rtl_attributes[i]; i ++)
|
||||||
sysdev_class_remove_file(&class_rtl, rtl_attributes[i]);
|
device_remove_file(rtl_subsys.dev_root, rtl_attributes[i]);
|
||||||
sysdev_class_unregister(&class_rtl);
|
bus_unregister(&rtl_subsys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue