diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-04-22 16:03:21 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-04-24 13:16:10 -0400 |
commit | bb072c3cf21d1c9a5a2eeb5a00679ee7bf39675b (patch) | |
tree | 8b9b425422e11c5cb5012adf68e9e2a3e957358f /arch/arm/mach-s3c2410 | |
parent | 2eaa03b5bebd1e80014f780d7bf27c3e66daefd6 (diff) |
ARM / Samsung: Use struct syscore_ops for "core" power management
Replace sysdev classes and struct sys_device objects used for "core"
power management by Samsung platforms with struct syscore_ops objects
that are simpler.
This generally reduces the code size and the kernel memory footprint.
It also is necessary for removing sysdevs entirely from the kernel in
the future.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s3c2410')
-rw-r--r-- | arch/arm/mach-s3c2410/irq.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/mach-bast.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/pm.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/s3c2410.c | 5 |
4 files changed, 18 insertions, 47 deletions
diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c index 5e2f35332056..2854129f8cc7 100644 --- a/arch/arm/mach-s3c2410/irq.c +++ b/arch/arm/mach-s3c2410/irq.c | |||
@@ -23,38 +23,12 @@ | |||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/ioport.h> | 25 | #include <linux/ioport.h> |
26 | #include <linux/sysdev.h> | 26 | #include <linux/syscore_ops.h> |
27 | 27 | ||
28 | #include <plat/cpu.h> | 28 | #include <plat/cpu.h> |
29 | #include <plat/pm.h> | 29 | #include <plat/pm.h> |
30 | 30 | ||
31 | static int s3c2410_irq_add(struct sys_device *sysdev) | 31 | struct syscore_ops s3c24xx_irq_syscore_ops = { |
32 | { | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static struct sysdev_driver s3c2410_irq_driver = { | ||
37 | .add = s3c2410_irq_add, | ||
38 | .suspend = s3c24xx_irq_suspend, | 32 | .suspend = s3c24xx_irq_suspend, |
39 | .resume = s3c24xx_irq_resume, | 33 | .resume = s3c24xx_irq_resume, |
40 | }; | 34 | }; |
41 | |||
42 | static int __init s3c2410_irq_init(void) | ||
43 | { | ||
44 | return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_irq_driver); | ||
45 | } | ||
46 | |||
47 | arch_initcall(s3c2410_irq_init); | ||
48 | |||
49 | static struct sysdev_driver s3c2410a_irq_driver = { | ||
50 | .add = s3c2410_irq_add, | ||
51 | .suspend = s3c24xx_irq_suspend, | ||
52 | .resume = s3c24xx_irq_resume, | ||
53 | }; | ||
54 | |||
55 | static int __init s3c2410a_irq_init(void) | ||
56 | { | ||
57 | return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_irq_driver); | ||
58 | } | ||
59 | |||
60 | arch_initcall(s3c2410a_irq_init); | ||
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index 2970ea9f7c2b..1e2d536adda9 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/sysdev.h> | 20 | #include <linux/syscore_ops.h> |
21 | #include <linux/serial_core.h> | 21 | #include <linux/serial_core.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/dm9000.h> | 23 | #include <linux/dm9000.h> |
@@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = { | |||
214 | /* NAND Flash on BAST board */ | 214 | /* NAND Flash on BAST board */ |
215 | 215 | ||
216 | #ifdef CONFIG_PM | 216 | #ifdef CONFIG_PM |
217 | static int bast_pm_suspend(struct sys_device *sd, pm_message_t state) | 217 | static int bast_pm_suspend(void) |
218 | { | 218 | { |
219 | /* ensure that an nRESET is not generated on resume. */ | 219 | /* ensure that an nRESET is not generated on resume. */ |
220 | gpio_direction_output(S3C2410_GPA(21), 1); | 220 | gpio_direction_output(S3C2410_GPA(21), 1); |
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | 223 | ||
224 | static int bast_pm_resume(struct sys_device *sd) | 224 | static void bast_pm_resume(void) |
225 | { | 225 | { |
226 | s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); | 226 | s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); |
227 | return 0; | ||
228 | } | 227 | } |
229 | 228 | ||
230 | #else | 229 | #else |
@@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_device *sd) | |||
232 | #define bast_pm_resume NULL | 231 | #define bast_pm_resume NULL |
233 | #endif | 232 | #endif |
234 | 233 | ||
235 | static struct sysdev_class bast_pm_sysclass = { | 234 | static struct syscore_ops bast_pm_syscore_ops = { |
236 | .name = "mach-bast", | ||
237 | .suspend = bast_pm_suspend, | 235 | .suspend = bast_pm_suspend, |
238 | .resume = bast_pm_resume, | 236 | .resume = bast_pm_resume, |
239 | }; | 237 | }; |
240 | 238 | ||
241 | static struct sys_device bast_pm_sysdev = { | ||
242 | .cls = &bast_pm_sysclass, | ||
243 | }; | ||
244 | |||
245 | static int smartmedia_map[] = { 0 }; | 239 | static int smartmedia_map[] = { 0 }; |
246 | static int chip0_map[] = { 1 }; | 240 | static int chip0_map[] = { 1 }; |
247 | static int chip1_map[] = { 2 }; | 241 | static int chip1_map[] = { 2 }; |
@@ -642,8 +636,7 @@ static void __init bast_map_io(void) | |||
642 | 636 | ||
643 | static void __init bast_init(void) | 637 | static void __init bast_init(void) |
644 | { | 638 | { |
645 | sysdev_class_register(&bast_pm_sysclass); | 639 | register_syscore_ops(&bast_pm_syscore_ops); |
646 | sysdev_register(&bast_pm_sysdev); | ||
647 | 640 | ||
648 | s3c_i2c0_set_platdata(&bast_i2c_info); | 641 | s3c_i2c0_set_platdata(&bast_i2c_info); |
649 | s3c_nand_set_platdata(&bast_nand_info); | 642 | s3c_nand_set_platdata(&bast_nand_info); |
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c index 725636fc4dc3..4728f9aa7df1 100644 --- a/arch/arm/mach-s3c2410/pm.c +++ b/arch/arm/mach-s3c2410/pm.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/sysdev.h> | 27 | #include <linux/sysdev.h> |
28 | #include <linux/syscore_ops.h> | ||
28 | #include <linux/gpio.h> | 29 | #include <linux/gpio.h> |
29 | #include <linux/io.h> | 30 | #include <linux/io.h> |
30 | 31 | ||
@@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void) | |||
92 | } | 93 | } |
93 | } | 94 | } |
94 | 95 | ||
95 | static int s3c2410_pm_resume(struct sys_device *dev) | 96 | static void s3c2410_pm_resume(void) |
96 | { | 97 | { |
97 | unsigned long tmp; | 98 | unsigned long tmp; |
98 | 99 | ||
@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_device *dev) | |||
104 | 105 | ||
105 | if ( machine_is_aml_m5900() ) | 106 | if ( machine_is_aml_m5900() ) |
106 | s3c2410_gpio_setpin(S3C2410_GPF(2), 0); | 107 | s3c2410_gpio_setpin(S3C2410_GPF(2), 0); |
107 | |||
108 | return 0; | ||
109 | } | 108 | } |
110 | 109 | ||
110 | struct syscore_ops s3c2410_pm_syscore_ops = { | ||
111 | .resume = s3c2410_pm_resume, | ||
112 | }; | ||
113 | |||
111 | static int s3c2410_pm_add(struct sys_device *dev) | 114 | static int s3c2410_pm_add(struct sys_device *dev) |
112 | { | 115 | { |
113 | pm_cpu_prep = s3c2410_pm_prepare; | 116 | pm_cpu_prep = s3c2410_pm_prepare; |
@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_device *dev) | |||
119 | #if defined(CONFIG_CPU_S3C2410) | 122 | #if defined(CONFIG_CPU_S3C2410) |
120 | static struct sysdev_driver s3c2410_pm_driver = { | 123 | static struct sysdev_driver s3c2410_pm_driver = { |
121 | .add = s3c2410_pm_add, | 124 | .add = s3c2410_pm_add, |
122 | .resume = s3c2410_pm_resume, | ||
123 | }; | 125 | }; |
124 | 126 | ||
125 | /* register ourselves */ | 127 | /* register ourselves */ |
@@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit); | |||
133 | 135 | ||
134 | static struct sysdev_driver s3c2410a_pm_driver = { | 136 | static struct sysdev_driver s3c2410a_pm_driver = { |
135 | .add = s3c2410_pm_add, | 137 | .add = s3c2410_pm_add, |
136 | .resume = s3c2410_pm_resume, | ||
137 | }; | 138 | }; |
138 | 139 | ||
139 | static int __init s3c2410a_pm_drvinit(void) | 140 | static int __init s3c2410a_pm_drvinit(void) |
@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit); | |||
147 | #if defined(CONFIG_CPU_S3C2440) | 148 | #if defined(CONFIG_CPU_S3C2440) |
148 | static struct sysdev_driver s3c2440_pm_driver = { | 149 | static struct sysdev_driver s3c2440_pm_driver = { |
149 | .add = s3c2410_pm_add, | 150 | .add = s3c2410_pm_add, |
150 | .resume = s3c2410_pm_resume, | ||
151 | }; | 151 | }; |
152 | 152 | ||
153 | static int __init s3c2440_pm_drvinit(void) | 153 | static int __init s3c2440_pm_drvinit(void) |
@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit); | |||
161 | #if defined(CONFIG_CPU_S3C2442) | 161 | #if defined(CONFIG_CPU_S3C2442) |
162 | static struct sysdev_driver s3c2442_pm_driver = { | 162 | static struct sysdev_driver s3c2442_pm_driver = { |
163 | .add = s3c2410_pm_add, | 163 | .add = s3c2410_pm_add, |
164 | .resume = s3c2410_pm_resume, | ||
165 | }; | 164 | }; |
166 | 165 | ||
167 | static int __init s3c2442_pm_drvinit(void) | 166 | static int __init s3c2442_pm_drvinit(void) |
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c index adc90a3c5890..f1d3bd8f6f17 100644 --- a/arch/arm/mach-s3c2410/s3c2410.c +++ b/arch/arm/mach-s3c2410/s3c2410.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/sysdev.h> | 21 | #include <linux/sysdev.h> |
22 | #include <linux/syscore_ops.h> | ||
22 | #include <linux/serial_core.h> | 23 | #include <linux/serial_core.h> |
23 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
24 | #include <linux/io.h> | 25 | #include <linux/io.h> |
@@ -40,6 +41,7 @@ | |||
40 | #include <plat/devs.h> | 41 | #include <plat/devs.h> |
41 | #include <plat/clock.h> | 42 | #include <plat/clock.h> |
42 | #include <plat/pll.h> | 43 | #include <plat/pll.h> |
44 | #include <plat/pm.h> | ||
43 | 45 | ||
44 | #include <plat/gpio-core.h> | 46 | #include <plat/gpio-core.h> |
45 | #include <plat/gpio-cfg.h> | 47 | #include <plat/gpio-cfg.h> |
@@ -168,6 +170,9 @@ int __init s3c2410_init(void) | |||
168 | { | 170 | { |
169 | printk("S3C2410: Initialising architecture\n"); | 171 | printk("S3C2410: Initialising architecture\n"); |
170 | 172 | ||
173 | register_syscore_ops(&s3c2410_pm_syscore_ops); | ||
174 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | ||
175 | |||
171 | return sysdev_register(&s3c2410_sysdev); | 176 | return sysdev_register(&s3c2410_sysdev); |
172 | } | 177 | } |
173 | 178 | ||