Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+22 −22
Original line number Diff line number Diff line
@@ -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>
@@ -37,8 +37,8 @@ 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;
@@ -46,8 +46,8 @@ static ssize_t ascii_store(struct sys_device *dev,
	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;
@@ -55,19 +55,19 @@ static ssize_t raw_store(struct sys_device *dev,
	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))
@@ -76,10 +76,11 @@ 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 = {
static struct bus_type tx_7segled_subsys = {
	.name		= "7segled",
	.dev_name	= "7segled",
};

static int __init tx_7segled_init_sysfs(void)
@@ -87,26 +88,25 @@ 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;