Commit 0e38eaf3 authored by Kay Sievers's avatar Kay Sievers Committed by Greg Kroah-Hartman

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 <ralf@linux-mips.org>
Signed-off-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dc6876a2
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* (C) Copyright TOSHIBA CORPORATION 2005-2007 * (C) Copyright TOSHIBA CORPORATION 2005-2007
* All Rights Reserved. * All Rights Reserved.
*/ */
#include <linux/sysdev.h> #include <linux/device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/map_to_7segment.h> #include <linux/map_to_7segment.h>
#include <asm/txx9/generic.h> #include <asm/txx9/generic.h>
...@@ -37,8 +37,8 @@ int txx9_7segled_putc(unsigned int pos, char c) ...@@ -37,8 +37,8 @@ int txx9_7segled_putc(unsigned int pos, char c)
return 0; return 0;
} }
static ssize_t ascii_store(struct sys_device *dev, static ssize_t ascii_store(struct device *dev,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
unsigned int ch = dev->id; unsigned int ch = dev->id;
...@@ -46,8 +46,8 @@ static ssize_t ascii_store(struct sys_device *dev, ...@@ -46,8 +46,8 @@ static ssize_t ascii_store(struct sys_device *dev,
return size; return size;
} }
static ssize_t raw_store(struct sys_device *dev, static ssize_t raw_store(struct device *dev,
struct sysdev_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
unsigned int ch = dev->id; unsigned int ch = dev->id;
...@@ -55,19 +55,19 @@ static ssize_t raw_store(struct sys_device *dev, ...@@ -55,19 +55,19 @@ static ssize_t raw_store(struct sys_device *dev,
return size; return size;
} }
static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store); static DEVICE_ATTR(ascii, 0200, NULL, ascii_store);
static SYSDEV_ATTR(raw, 0200, NULL, raw_store); static DEVICE_ATTR(raw, 0200, NULL, raw_store);
static ssize_t map_seg7_show(struct sysdev_class *class, static ssize_t map_seg7_show(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map));
return sizeof(txx9_seg7map); return sizeof(txx9_seg7map);
} }
static ssize_t map_seg7_store(struct sysdev_class *class, static ssize_t map_seg7_store(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, size_t size) const char *buf, size_t size)
{ {
if (size != sizeof(txx9_seg7map)) if (size != sizeof(txx9_seg7map))
...@@ -76,10 +76,11 @@ static ssize_t map_seg7_store(struct sysdev_class *class, ...@@ -76,10 +76,11 @@ static ssize_t map_seg7_store(struct sysdev_class *class,
return size; 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 = { static struct bus_type tx_7segled_subsys = {
.name = "7segled", .name = "7segled",
.dev_name = "7segled",
}; };
static int __init tx_7segled_init_sysfs(void) static int __init tx_7segled_init_sysfs(void)
...@@ -87,26 +88,25 @@ static int __init tx_7segled_init_sysfs(void) ...@@ -87,26 +88,25 @@ static int __init tx_7segled_init_sysfs(void)
int error, i; int error, i;
if (!tx_7segled_num) if (!tx_7segled_num)
return -ENODEV; return -ENODEV;
error = sysdev_class_register(&tx_7segled_sysdev_class); error = subsys_system_register(&tx_7segled_subsys, NULL);
if (error) if (error)
return error; return error;
error = sysdev_class_create_file(&tx_7segled_sysdev_class, error = device_create_file(tx_7segled_subsys.dev_root, &dev_attr_map_seg7);
&attr_map_seg7);
if (error) if (error)
return error; return error;
for (i = 0; i < tx_7segled_num; i++) { for (i = 0; i < tx_7segled_num; i++) {
struct sys_device *dev; struct device *dev;
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) { if (!dev) {
error = -ENODEV; error = -ENODEV;
break; break;
} }
dev->id = i; dev->id = i;
dev->cls = &tx_7segled_sysdev_class; dev->dev = &tx_7segled_subsys;
error = sysdev_register(dev); error = device_register(dev);
if (!error) { if (!error) {
sysdev_create_file(dev, &attr_ascii); device_create_file(dev, &dev_attr_ascii);
sysdev_create_file(dev, &attr_raw); device_create_file(dev, &dev_attr_raw);
} }
} }
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment