Skip to content

Commit f4e73bf

Browse files
kaysieversgregkh
authored andcommitted
sh: intc - 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: Paul Mundt <lethal@linux-sh.org> Cc: Magnus Damm <magnus.damm@gmail.com> 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>
1 parent 86ba41d commit f4e73bf

3 files changed

Lines changed: 26 additions & 25 deletions

File tree

‎drivers/sh/intc/core.c‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <linux/stat.h>
2626
#include <linux/interrupt.h>
2727
#include <linux/sh_intc.h>
28-
#include <linux/sysdev.h>
28+
#include <linux/device.h>
2929
#include <linux/syscore_ops.h>
3030
#include <linux/list.h>
3131
#include <linux/spinlock.h>
@@ -434,46 +434,47 @@ struct syscore_ops intc_syscore_ops = {
434434
.resume = intc_resume,
435435
};
436436

437-
struct sysdev_class intc_sysdev_class = {
437+
struct bus_type intc_subsys = {
438438
.name = "intc",
439+
.dev_name = "intc",
439440
};
440441

441442
static ssize_t
442-
show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
443+
show_intc_name(struct device *dev, struct device_attribute *attr, char *buf)
443444
{
444445
struct intc_desc_int *d;
445446

446-
d = container_of(dev, struct intc_desc_int, sysdev);
447+
d = container_of(dev, struct intc_desc_int, dev);
447448

448449
return sprintf(buf, "%s\n", d->chip.name);
449450
}
450451

451-
static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL);
452+
static DEVICE_ATTR(name, S_IRUGO, show_intc_name, NULL);
452453

453-
static int __init register_intc_sysdevs(void)
454+
static int __init register_intc_devs(void)
454455
{
455456
struct intc_desc_int *d;
456457
int error;
457458

458459
register_syscore_ops(&intc_syscore_ops);
459460

460-
error = sysdev_class_register(&intc_sysdev_class);
461+
error = subsys_system_register(&intc_subsys, NULL);
461462
if (!error) {
462463
list_for_each_entry(d, &intc_list, list) {
463-
d->sysdev.id = d->index;
464-
d->sysdev.cls = &intc_sysdev_class;
465-
error = sysdev_register(&d->sysdev);
464+
d->dev.id = d->index;
465+
d->dev.bus = &intc_subsys;
466+
error = device_register(&d->dev);
466467
if (error == 0)
467-
error = sysdev_create_file(&d->sysdev,
468-
&attr_name);
468+
error = device_create_file(&d->dev,
469+
&dev_attr_name);
469470
if (error)
470471
break;
471472
}
472473
}
473474

474475
if (error)
475-
pr_err("sysdev registration error\n");
476+
pr_err("device registration error\n");
476477

477478
return error;
478479
}
479-
device_initcall(register_intc_sysdevs);
480+
device_initcall(register_intc_devs);

‎drivers/sh/intc/internals.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <linux/kernel.h>
55
#include <linux/types.h>
66
#include <linux/radix-tree.h>
7-
#include <linux/sysdev.h>
7+
#include <linux/device.h>
88

99
#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
1010
((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
@@ -51,7 +51,7 @@ struct intc_subgroup_entry {
5151

5252
struct intc_desc_int {
5353
struct list_head list;
54-
struct sys_device sysdev;
54+
struct device dev;
5555
struct radix_tree_root tree;
5656
raw_spinlock_t lock;
5757
unsigned int index;
@@ -157,7 +157,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle);
157157
extern struct list_head intc_list;
158158
extern raw_spinlock_t intc_big_lock;
159159
extern unsigned int nr_intc_controllers;
160-
extern struct sysdev_class intc_sysdev_class;
160+
extern struct bus_type intc_subsys;
161161

162162
unsigned int intc_get_dfl_prio_level(void);
163163
unsigned int intc_get_prio_level(unsigned int irq);

‎drivers/sh/intc/userimask.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define pr_fmt(fmt) "intc: " fmt
1111

1212
#include <linux/errno.h>
13-
#include <linux/sysdev.h>
13+
#include <linux/device.h>
1414
#include <linux/init.h>
1515
#include <linux/io.h>
1616
#include <linux/stat.h>
@@ -20,15 +20,15 @@
2020
static void __iomem *uimask;
2121

2222
static ssize_t
23-
show_intc_userimask(struct sysdev_class *cls,
24-
struct sysdev_class_attribute *attr, char *buf)
23+
show_intc_userimask(struct device *dev,
24+
struct device_attribute *attr, char *buf)
2525
{
2626
return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf);
2727
}
2828

2929
static ssize_t
30-
store_intc_userimask(struct sysdev_class *cls,
31-
struct sysdev_class_attribute *attr,
30+
store_intc_userimask(struct device *dev,
31+
struct device_attribute *attr,
3232
const char *buf, size_t count)
3333
{
3434
unsigned long level;
@@ -55,16 +55,16 @@ store_intc_userimask(struct sysdev_class *cls,
5555
return count;
5656
}
5757

58-
static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR,
59-
show_intc_userimask, store_intc_userimask);
58+
static DEVICE_ATTR(userimask, S_IRUSR | S_IWUSR,
59+
show_intc_userimask, store_intc_userimask);
6060

6161

6262
static int __init userimask_sysdev_init(void)
6363
{
6464
if (unlikely(!uimask))
6565
return -ENXIO;
6666

67-
return sysdev_class_create_file(&intc_sysdev_class, &attr_userimask);
67+
return device_create_file(intc_subsys.dev_root, &dev_attr_userimask);
6868
}
6969
late_initcall(userimask_sysdev_init);
7070

0 commit comments

Comments
 (0)