aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-04-26 13:14:35 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-05-11 15:37:14 -0400
commitf25f4f522a9d2e18595da9df0bf1b6f282040e08 (patch)
treea1627fc939d51ec45f1d0a53e1dae0d3a46a3ec4 /arch/avr32
parent67f9cbf9affe39f67cd3f1d2e2a2a43089d9ab3a (diff)
PM / AVR32: Use struct syscore_ops instead of sysdevs for PM
Convert some AVR32 architecture's code to using struct syscore_ops objects for power management instead of sysdev classes and sysdevs. This simplifies the code and reduces the kernel's memory footprint. It also is necessary for removing sysdevs from the kernel entirely in the future. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Diffstat (limited to 'arch/avr32')
-rw-r--r--arch/avr32/mach-at32ap/intc.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/arch/avr32/mach-at32ap/intc.c b/arch/avr32/mach-at32ap/intc.c
index 21ce35f33aa5..3e3646186c9f 100644
--- a/arch/avr32/mach-at32ap/intc.c
+++ b/arch/avr32/mach-at32ap/intc.c
@@ -12,7 +12,7 @@
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/sysdev.h> 15#include <linux/syscore_ops.h>
16 16
17#include <asm/io.h> 17#include <asm/io.h>
18 18
@@ -21,7 +21,6 @@
21struct intc { 21struct intc {
22 void __iomem *regs; 22 void __iomem *regs;
23 struct irq_chip chip; 23 struct irq_chip chip;
24 struct sys_device sysdev;
25#ifdef CONFIG_PM 24#ifdef CONFIG_PM
26 unsigned long suspend_ipr; 25 unsigned long suspend_ipr;
27 unsigned long saved_ipr[64]; 26 unsigned long saved_ipr[64];
@@ -146,9 +145,8 @@ void intc_set_suspend_handler(unsigned long offset)
146 intc0.suspend_ipr = offset; 145 intc0.suspend_ipr = offset;
147} 146}
148 147
149static int intc_suspend(struct sys_device *sdev, pm_message_t state) 148static int intc_suspend(void)
150{ 149{
151 struct intc *intc = container_of(sdev, struct intc, sysdev);
152 int i; 150 int i;
153 151
154 if (unlikely(!irqs_disabled())) { 152 if (unlikely(!irqs_disabled())) {
@@ -156,28 +154,25 @@ static int intc_suspend(struct sys_device *sdev, pm_message_t state)
156 return -EINVAL; 154 return -EINVAL;
157 } 155 }
158 156
159 if (unlikely(!intc->suspend_ipr)) { 157 if (unlikely(!intc0.suspend_ipr)) {
160 pr_err("intc_suspend: suspend_ipr not initialized\n"); 158 pr_err("intc_suspend: suspend_ipr not initialized\n");
161 return -EINVAL; 159 return -EINVAL;
162 } 160 }
163 161
164 for (i = 0; i < 64; i++) { 162 for (i = 0; i < 64; i++) {
165 intc->saved_ipr[i] = intc_readl(intc, INTPR0 + 4 * i); 163 intc0.saved_ipr[i] = intc_readl(&intc0, INTPR0 + 4 * i);
166 intc_writel(intc, INTPR0 + 4 * i, intc->suspend_ipr); 164 intc_writel(&intc0, INTPR0 + 4 * i, intc0.suspend_ipr);
167 } 165 }
168 166
169 return 0; 167 return 0;
170} 168}
171 169
172static int intc_resume(struct sys_device *sdev) 170static int intc_resume(void)
173{ 171{
174 struct intc *intc = container_of(sdev, struct intc, sysdev);
175 int i; 172 int i;
176 173
177 WARN_ON(!irqs_disabled());
178
179 for (i = 0; i < 64; i++) 174 for (i = 0; i < 64; i++)
180 intc_writel(intc, INTPR0 + 4 * i, intc->saved_ipr[i]); 175 intc_writel(&intc0, INTPR0 + 4 * i, intc0.saved_ipr[i]);
181 176
182 return 0; 177 return 0;
183} 178}
@@ -186,27 +181,18 @@ static int intc_resume(struct sys_device *sdev)
186#define intc_resume NULL 181#define intc_resume NULL
187#endif 182#endif
188 183
189static struct sysdev_class intc_class = { 184static struct syscore_ops intc_syscore_ops = {
190 .name = "intc",
191 .suspend = intc_suspend, 185 .suspend = intc_suspend,
192 .resume = intc_resume, 186 .resume = intc_resume,
193}; 187};
194 188
195static int __init intc_init_sysdev(void) 189static int __init intc_init_syscore(void)
196{ 190{
197 int ret; 191 register_syscore_ops(&intc_syscore_ops);
198
199 ret = sysdev_class_register(&intc_class);
200 if (ret)
201 return ret;
202 192
203 intc0.sysdev.id = 0; 193 return 0;
204 intc0.sysdev.cls = &intc_class;
205 ret = sysdev_register(&intc0.sysdev);
206
207 return ret;
208} 194}
209device_initcall(intc_init_sysdev); 195device_initcall(intc_init_syscore);
210 196
211unsigned long intc_get_pending(unsigned int group) 197unsigned long intc_get_pending(unsigned int group)
212{ 198{