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>
This commit is contained in:
parent
86ba41d033
commit
f4e73bfcd9
@ -25,7 +25,7 @@
|
|||||||
#include <linux/stat.h>
|
#include <linux/stat.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/sh_intc.h>
|
#include <linux/sh_intc.h>
|
||||||
#include <linux/sysdev.h>
|
#include <linux/device.h>
|
||||||
#include <linux/syscore_ops.h>
|
#include <linux/syscore_ops.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
@ -434,46 +434,47 @@ struct syscore_ops intc_syscore_ops = {
|
|||||||
.resume = intc_resume,
|
.resume = intc_resume,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sysdev_class intc_sysdev_class = {
|
struct bus_type intc_subsys = {
|
||||||
.name = "intc",
|
.name = "intc",
|
||||||
|
.dev_name = "intc",
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
|
show_intc_name(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct intc_desc_int *d;
|
struct intc_desc_int *d;
|
||||||
|
|
||||||
d = container_of(dev, struct intc_desc_int, sysdev);
|
d = container_of(dev, struct intc_desc_int, dev);
|
||||||
|
|
||||||
return sprintf(buf, "%s\n", d->chip.name);
|
return sprintf(buf, "%s\n", d->chip.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL);
|
static DEVICE_ATTR(name, S_IRUGO, show_intc_name, NULL);
|
||||||
|
|
||||||
static int __init register_intc_sysdevs(void)
|
static int __init register_intc_devs(void)
|
||||||
{
|
{
|
||||||
struct intc_desc_int *d;
|
struct intc_desc_int *d;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
register_syscore_ops(&intc_syscore_ops);
|
register_syscore_ops(&intc_syscore_ops);
|
||||||
|
|
||||||
error = sysdev_class_register(&intc_sysdev_class);
|
error = subsys_system_register(&intc_subsys, NULL);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
list_for_each_entry(d, &intc_list, list) {
|
list_for_each_entry(d, &intc_list, list) {
|
||||||
d->sysdev.id = d->index;
|
d->dev.id = d->index;
|
||||||
d->sysdev.cls = &intc_sysdev_class;
|
d->dev.bus = &intc_subsys;
|
||||||
error = sysdev_register(&d->sysdev);
|
error = device_register(&d->dev);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
error = sysdev_create_file(&d->sysdev,
|
error = device_create_file(&d->dev,
|
||||||
&attr_name);
|
&dev_attr_name);
|
||||||
if (error)
|
if (error)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
pr_err("sysdev registration error\n");
|
pr_err("device registration error\n");
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
device_initcall(register_intc_sysdevs);
|
device_initcall(register_intc_devs);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/radix-tree.h>
|
#include <linux/radix-tree.h>
|
||||||
#include <linux/sysdev.h>
|
#include <linux/device.h>
|
||||||
|
|
||||||
#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
|
#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
|
||||||
((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
|
((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
|
||||||
@ -51,7 +51,7 @@ struct intc_subgroup_entry {
|
|||||||
|
|
||||||
struct intc_desc_int {
|
struct intc_desc_int {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
struct sys_device sysdev;
|
struct device dev;
|
||||||
struct radix_tree_root tree;
|
struct radix_tree_root tree;
|
||||||
raw_spinlock_t lock;
|
raw_spinlock_t lock;
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
@ -157,7 +157,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle);
|
|||||||
extern struct list_head intc_list;
|
extern struct list_head intc_list;
|
||||||
extern raw_spinlock_t intc_big_lock;
|
extern raw_spinlock_t intc_big_lock;
|
||||||
extern unsigned int nr_intc_controllers;
|
extern unsigned int nr_intc_controllers;
|
||||||
extern struct sysdev_class intc_sysdev_class;
|
extern struct bus_type intc_subsys;
|
||||||
|
|
||||||
unsigned int intc_get_dfl_prio_level(void);
|
unsigned int intc_get_dfl_prio_level(void);
|
||||||
unsigned int intc_get_prio_level(unsigned int irq);
|
unsigned int intc_get_prio_level(unsigned int irq);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#define pr_fmt(fmt) "intc: " fmt
|
#define pr_fmt(fmt) "intc: " fmt
|
||||||
|
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/sysdev.h>
|
#include <linux/device.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/stat.h>
|
#include <linux/stat.h>
|
||||||
@ -20,15 +20,15 @@
|
|||||||
static void __iomem *uimask;
|
static void __iomem *uimask;
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
show_intc_userimask(struct sysdev_class *cls,
|
show_intc_userimask(struct device *dev,
|
||||||
struct sysdev_class_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf);
|
return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
store_intc_userimask(struct sysdev_class *cls,
|
store_intc_userimask(struct device *dev,
|
||||||
struct sysdev_class_attribute *attr,
|
struct device_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
unsigned long level;
|
unsigned long level;
|
||||||
@ -55,8 +55,8 @@ store_intc_userimask(struct sysdev_class *cls,
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR,
|
static DEVICE_ATTR(userimask, S_IRUSR | S_IWUSR,
|
||||||
show_intc_userimask, store_intc_userimask);
|
show_intc_userimask, store_intc_userimask);
|
||||||
|
|
||||||
|
|
||||||
static int __init userimask_sysdev_init(void)
|
static int __init userimask_sysdev_init(void)
|
||||||
@ -64,7 +64,7 @@ static int __init userimask_sysdev_init(void)
|
|||||||
if (unlikely(!uimask))
|
if (unlikely(!uimask))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
return sysdev_class_create_file(&intc_sysdev_class, &attr_userimask);
|
return device_create_file(intc_subsys.dev_root, &dev_attr_userimask);
|
||||||
}
|
}
|
||||||
late_initcall(userimask_sysdev_init);
|
late_initcall(userimask_sysdev_init);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user