From f4e73bfcd9cca0b64cc8096175852936fb1d111f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Dec 2011 15:09:52 -0800 Subject: 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 Cc: Magnus Damm Cc: Paul Gortmaker Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- drivers/sh/intc/core.c | 29 +++++++++++++++-------------- drivers/sh/intc/internals.h | 6 +++--- drivers/sh/intc/userimask.c | 16 ++++++++-------- 3 files changed, 26 insertions(+), 25 deletions(-) (limited to 'drivers/sh') diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index 8b7a141ff35e..e85512dd9c72 100644 --- a/drivers/sh/intc/core.c +++ b/drivers/sh/intc/core.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -434,46 +434,47 @@ struct syscore_ops intc_syscore_ops = { .resume = intc_resume, }; -struct sysdev_class intc_sysdev_class = { +struct bus_type intc_subsys = { .name = "intc", + .dev_name = "intc", }; 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; - 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); } -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; int error; register_syscore_ops(&intc_syscore_ops); - error = sysdev_class_register(&intc_sysdev_class); + error = subsys_system_register(&intc_subsys, NULL); if (!error) { list_for_each_entry(d, &intc_list, list) { - d->sysdev.id = d->index; - d->sysdev.cls = &intc_sysdev_class; - error = sysdev_register(&d->sysdev); + d->dev.id = d->index; + d->dev.bus = &intc_subsys; + error = device_register(&d->dev); if (error == 0) - error = sysdev_create_file(&d->sysdev, - &attr_name); + error = device_create_file(&d->dev, + &dev_attr_name); if (error) break; } } if (error) - pr_err("sysdev registration error\n"); + pr_err("device registration error\n"); return error; } -device_initcall(register_intc_sysdevs); +device_initcall(register_intc_devs); diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h index 5b934851efa8..1c2722e5af3f 100644 --- a/drivers/sh/intc/internals.h +++ b/drivers/sh/intc/internals.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ @@ -51,7 +51,7 @@ struct intc_subgroup_entry { struct intc_desc_int { struct list_head list; - struct sys_device sysdev; + struct device dev; struct radix_tree_root tree; raw_spinlock_t lock; unsigned int index; @@ -157,7 +157,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle); extern struct list_head intc_list; extern raw_spinlock_t intc_big_lock; 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_prio_level(unsigned int irq); diff --git a/drivers/sh/intc/userimask.c b/drivers/sh/intc/userimask.c index 56bf9336b92b..e649ceaaa410 100644 --- a/drivers/sh/intc/userimask.c +++ b/drivers/sh/intc/userimask.c @@ -10,7 +10,7 @@ #define pr_fmt(fmt) "intc: " fmt #include -#include +#include #include #include #include @@ -20,15 +20,15 @@ static void __iomem *uimask; static ssize_t -show_intc_userimask(struct sysdev_class *cls, - struct sysdev_class_attribute *attr, char *buf) +show_intc_userimask(struct device *dev, + struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf); } static ssize_t -store_intc_userimask(struct sysdev_class *cls, - struct sysdev_class_attribute *attr, +store_intc_userimask(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { unsigned long level; @@ -55,8 +55,8 @@ store_intc_userimask(struct sysdev_class *cls, return count; } -static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR, - show_intc_userimask, store_intc_userimask); +static DEVICE_ATTR(userimask, S_IRUSR | S_IWUSR, + show_intc_userimask, store_intc_userimask); static int __init userimask_sysdev_init(void) @@ -64,7 +64,7 @@ static int __init userimask_sysdev_init(void) if (unlikely(!uimask)) 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); -- cgit v1.2.3 From 0f966d74cf77a9140a025464a287e1d2fee8a1fc Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 23 Dec 2011 01:23:30 +0100 Subject: PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume Since the SH7372's INTCS in included into syscore suspend/resume, which causes the chip to be accessed when PM domains have been turned off during system suspend, the A4R domain containing the INTCS has to stay on during system sleep, which is suboptimal from the power consumption point of view. For this reason, add a new INTC flag, skip_syscore_suspend, to mark the INTCS for intc_suspend() and intc_resume(), so that they don't touch it. This allows the A4R domain to be turned off during system suspend and the INTCS state is resrored during system resume by the A4R's "power on" code. Suggested-by: Magnus Damm Signed-off-by: Rafael J. Wysocki Acked-by: Magnus Damm --- arch/arm/mach-shmobile/intc-sh7372.c | 1 + drivers/sh/intc/core.c | 8 ++++++++ drivers/sh/intc/internals.h | 1 + include/linux/sh_intc.h | 1 + 4 files changed, 11 insertions(+) (limited to 'drivers/sh') diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c index d087b31b5d12..89afcaba99a1 100644 --- a/arch/arm/mach-shmobile/intc-sh7372.c +++ b/arch/arm/mach-shmobile/intc-sh7372.c @@ -535,6 +535,7 @@ static struct resource intcs_resources[] __initdata = { static struct intc_desc intcs_desc __initdata = { .name = "sh7372-intcs", .force_enable = ENABLED_INTCS, + .skip_syscore_suspend = true, .resource = intcs_resources, .num_resources = ARRAY_SIZE(intcs_resources), .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers, diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index 8b7a141ff35e..be5a025eeca3 100644 --- a/drivers/sh/intc/core.c +++ b/drivers/sh/intc/core.c @@ -354,6 +354,8 @@ int __init register_intc_controller(struct intc_desc *desc) if (desc->force_enable) intc_enable_disable_enum(desc, d, desc->force_enable, 1); + d->skip_suspend = desc->skip_syscore_suspend; + nr_intc_controllers++; return 0; @@ -386,6 +388,9 @@ static int intc_suspend(void) list_for_each_entry(d, &intc_list, list) { int irq; + if (d->skip_suspend) + continue; + /* enable wakeup irqs belonging to this intc controller */ for_each_active_irq(irq) { struct irq_data *data; @@ -409,6 +414,9 @@ static void intc_resume(void) list_for_each_entry(d, &intc_list, list) { int irq; + if (d->skip_suspend) + continue; + for_each_active_irq(irq) { struct irq_data *data; struct irq_chip *chip; diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h index 5b934851efa8..b3fe1cf25a28 100644 --- a/drivers/sh/intc/internals.h +++ b/drivers/sh/intc/internals.h @@ -67,6 +67,7 @@ struct intc_desc_int { struct intc_window *window; unsigned int nr_windows; struct irq_chip chip; + bool skip_suspend; }; diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h index 5812fefbcedf..b160645f5599 100644 --- a/include/linux/sh_intc.h +++ b/include/linux/sh_intc.h @@ -95,6 +95,7 @@ struct intc_desc { unsigned int num_resources; intc_enum force_enable; intc_enum force_disable; + bool skip_syscore_suspend; struct intc_hw_desc hw; }; -- cgit v1.2.3