Skip to content

Commit

Permalink
mips: 7segled - convert sysdev_class to a regular subsystem
Browse files Browse the repository at this point in the history
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: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Dec 21, 2011
1 parent dc6876a commit 0e38eaf
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions arch/mips/txx9/generic/7segled.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* (C) Copyright TOSHIBA CORPORATION 2005-2007
* All Rights Reserved.
*/
#include <linux/sysdev.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/map_to_7segment.h>
#include <asm/txx9/generic.h>
Expand Down Expand Up @@ -37,37 +37,37 @@ 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;
txx9_7segled_putc(ch, buf[0]);
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;
tx_7segled_putc(ch, buf[0]);
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))
Expand All @@ -76,37 +76,37 @@ 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)
{
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;
Expand Down

0 comments on commit 0e38eaf

Please sign in to comment.