diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-12-21 18:09:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-21 18:09:54 -0500 |
commit | 269a3eb1bf10a078ede74747a61603693a3f7853 (patch) | |
tree | e724fc76d207dbb4ee37d691a2299b8290cd673c /arch/mips/txx9 | |
parent | 0e38eaf34e0d9955aeaaed9648b2cfaba3076fee (diff) |
mips: txx9_sram - 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 <ralf@linux-mips.org>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/mips/txx9')
-rw-r--r-- | arch/mips/txx9/generic/setup.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index ec38e00b2559..ae77a7916c03 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/serial_core.h> | 22 | #include <linux/serial_core.h> |
23 | #include <linux/mtd/physmap.h> | 23 | #include <linux/mtd/physmap.h> |
24 | #include <linux/leds.h> | 24 | #include <linux/leds.h> |
25 | #include <linux/sysdev.h> | 25 | #include <linux/device.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
28 | #include <asm/bootinfo.h> | 28 | #include <asm/bootinfo.h> |
@@ -897,10 +897,13 @@ void __init txx9_aclc_init(unsigned long baseaddr, int irq, | |||
897 | #endif | 897 | #endif |
898 | } | 898 | } |
899 | 899 | ||
900 | static struct sysdev_class txx9_sramc_sysdev_class; | 900 | static struct bus_type txx9_sramc_subsys = { |
901 | .name = "txx9_sram", | ||
902 | .dev_name = "txx9_sram", | ||
903 | }; | ||
901 | 904 | ||
902 | struct txx9_sramc_sysdev { | 905 | struct txx9_sramc_dev { |
903 | struct sys_device dev; | 906 | struct device dev; |
904 | struct bin_attribute bindata_attr; | 907 | struct bin_attribute bindata_attr; |
905 | void __iomem *base; | 908 | void __iomem *base; |
906 | }; | 909 | }; |
@@ -909,7 +912,7 @@ static ssize_t txx9_sram_read(struct file *filp, struct kobject *kobj, | |||
909 | struct bin_attribute *bin_attr, | 912 | struct bin_attribute *bin_attr, |
910 | char *buf, loff_t pos, size_t size) | 913 | char *buf, loff_t pos, size_t size) |
911 | { | 914 | { |
912 | struct txx9_sramc_sysdev *dev = bin_attr->private; | 915 | struct txx9_sramc_dev *dev = bin_attr->private; |
913 | size_t ramsize = bin_attr->size; | 916 | size_t ramsize = bin_attr->size; |
914 | 917 | ||
915 | if (pos >= ramsize) | 918 | if (pos >= ramsize) |
@@ -924,7 +927,7 @@ static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj, | |||
924 | struct bin_attribute *bin_attr, | 927 | struct bin_attribute *bin_attr, |
925 | char *buf, loff_t pos, size_t size) | 928 | char *buf, loff_t pos, size_t size) |
926 | { | 929 | { |
927 | struct txx9_sramc_sysdev *dev = bin_attr->private; | 930 | struct txx9_sramc_dev *dev = bin_attr->private; |
928 | size_t ramsize = bin_attr->size; | 931 | size_t ramsize = bin_attr->size; |
929 | 932 | ||
930 | if (pos >= ramsize) | 933 | if (pos >= ramsize) |
@@ -937,18 +940,13 @@ static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj, | |||
937 | 940 | ||
938 | void __init txx9_sramc_init(struct resource *r) | 941 | void __init txx9_sramc_init(struct resource *r) |
939 | { | 942 | { |
940 | struct txx9_sramc_sysdev *dev; | 943 | struct txx9_sramc_dev *dev; |
941 | size_t size; | 944 | size_t size; |
942 | int err; | 945 | int err; |
943 | 946 | ||
944 | if (!txx9_sramc_sysdev_class.name) { | 947 | err = subsys_system_register(&txx9_sramc_subsys, NULL); |
945 | txx9_sramc_sysdev_class.name = "txx9_sram"; | 948 | if (err) |
946 | err = sysdev_class_register(&txx9_sramc_sysdev_class); | 949 | return; |
947 | if (err) { | ||
948 | txx9_sramc_sysdev_class.name = NULL; | ||
949 | return; | ||
950 | } | ||
951 | } | ||
952 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 950 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
953 | if (!dev) | 951 | if (!dev) |
954 | return; | 952 | return; |
@@ -956,7 +954,7 @@ void __init txx9_sramc_init(struct resource *r) | |||
956 | dev->base = ioremap(r->start, size); | 954 | dev->base = ioremap(r->start, size); |
957 | if (!dev->base) | 955 | if (!dev->base) |
958 | goto exit; | 956 | goto exit; |
959 | dev->dev.cls = &txx9_sramc_sysdev_class; | 957 | dev->dev.bus = &txx9_sramc_subsys; |
960 | sysfs_bin_attr_init(&dev->bindata_attr); | 958 | sysfs_bin_attr_init(&dev->bindata_attr); |
961 | dev->bindata_attr.attr.name = "bindata"; | 959 | dev->bindata_attr.attr.name = "bindata"; |
962 | dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR; | 960 | dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR; |
@@ -964,12 +962,12 @@ void __init txx9_sramc_init(struct resource *r) | |||
964 | dev->bindata_attr.write = txx9_sram_write; | 962 | dev->bindata_attr.write = txx9_sram_write; |
965 | dev->bindata_attr.size = size; | 963 | dev->bindata_attr.size = size; |
966 | dev->bindata_attr.private = dev; | 964 | dev->bindata_attr.private = dev; |
967 | err = sysdev_register(&dev->dev); | 965 | err = device_register(&dev->dev); |
968 | if (err) | 966 | if (err) |
969 | goto exit; | 967 | goto exit; |
970 | err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); | 968 | err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); |
971 | if (err) { | 969 | if (err) { |
972 | sysdev_unregister(&dev->dev); | 970 | device_unregister(&dev->dev); |
973 | goto exit; | 971 | goto exit; |
974 | } | 972 | } |
975 | return; | 973 | return; |