arm: leds: 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: Russell King <linux@arm.linux.org.uk> Cc: Paul Gortmaker <paul.gortmaker@windriver.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
b3e8d7b247
commit
8f1e938db9
|
@ -9,7 +9,7 @@
|
||||||
*/
|
*/
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/sysdev.h>
|
#include <linux/device.h>
|
||||||
#include <linux/syscore_ops.h>
|
#include <linux/syscore_ops.h>
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ static const struct leds_evt_name evt_names[] = {
|
||||||
{ "red", led_red_on, led_red_off },
|
{ "red", led_red_on, led_red_off },
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t leds_store(struct sys_device *dev,
|
static ssize_t leds_store(struct device *dev,
|
||||||
struct sysdev_attribute *attr,
|
struct device_attribute *attr,
|
||||||
const char *buf, size_t size)
|
const char *buf, size_t size)
|
||||||
{
|
{
|
||||||
int ret = -EINVAL, len = strcspn(buf, " ");
|
int ret = -EINVAL, len = strcspn(buf, " ");
|
||||||
|
@ -69,15 +69,16 @@ static ssize_t leds_store(struct sys_device *dev,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SYSDEV_ATTR(event, 0200, NULL, leds_store);
|
static DEVICE_ATTR(event, 0200, NULL, leds_store);
|
||||||
|
|
||||||
static struct sysdev_class leds_sysclass = {
|
static struct bus_type leds_subsys = {
|
||||||
.name = "leds",
|
.name = "leds",
|
||||||
|
.dev_name = "leds",
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sys_device leds_device = {
|
static struct device leds_device = {
|
||||||
.id = 0,
|
.id = 0,
|
||||||
.cls = &leds_sysclass,
|
.bus = &leds_subsys,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int leds_suspend(void)
|
static int leds_suspend(void)
|
||||||
|
@ -105,11 +106,11 @@ static struct syscore_ops leds_syscore_ops = {
|
||||||
static int __init leds_init(void)
|
static int __init leds_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
ret = sysdev_class_register(&leds_sysclass);
|
ret = subsys_system_register(&leds_subsys, NULL);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = sysdev_register(&leds_device);
|
ret = device_register(&leds_device);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = sysdev_create_file(&leds_device, &attr_event);
|
ret = device_create_file(&leds_device, &dev_attr_event);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
register_syscore_ops(&leds_syscore_ops);
|
register_syscore_ops(&leds_syscore_ops);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue