ARM: Use syscore_ops for "core" power management
Subsystems (18)
cover ARM: Use syscore_ops for "core" power management
Hi,
There are multiple problems with sysdevs, or struct sys_device objects to be precise, that are so annoying that some people have started to think of removind them entirely from the kernel. To me, personally, the most obvious issue is the way sysdevs are used for defining suspend/resume callbacks to be executed with one CPU on-line and interrupts disabled. Apart from this, sysdevs do not follow general rules related to the representation of things in /sys/devices/, so user space that uses /sys/devices/ to retrieve information on device hierarchy layout and device configuration, such as udev, cannot really handle them correctly.
Some subsystems need to carry out certain operations during suspend after we've disabled non-boot CPUs and interrupts have been switched off on the only on-line one. Currently, the only way to achieve that is to define sysdev suspend/resume callbacks, but this is cumbersome and inefficient. Namely, to do that, one has to define a sysdev class providing the callbacks and a sysdev actually using them, which is excessively complicated. Moreover, the sysdev suspend/resume callbacks take arguments that are not really used by the majority of subsystems defining sysdev suspend/resume callbacks (or even if they are used, they don't really need to be used, so they are simply unnecessary). Of course, if a sysdev is only defined to provide suspend/resume (and maybe shutdown) callbacks, there's no real reason why it should show up in sysfs.
For this reason, I thought it would be a good idea to provide a simpler interface for subsystems to define "very late" suspend callbacks and "very early" resume callbacks (and "very late" shutdown callbacks as well) without the entire bloat related to sysdevs. Such an interface has been merged recently in the form of struct syscore_ops framework that can be used to replace sysdevs in the "core" power management area.
The x86 architecture and subsystems it depends on have already been converted to using the new framework instead of sysdevs for "core" power management and the following series of patches does the analogous thing for the ARM architecture. I have done my best to build the kernel for every affected platform, but unfortunately some of them don't build even without my changes, so some minor issues might have slept through my fingers. Hopefully, though, there won't be too many of them.
[1/7] - Use syscore_ops for "core" PM in some common ARM code. [2/7] - Use syscore_ops for "core" PM on OMAP.
[3/7] - Use syscore_ops for "core" PM on Integrator. [4/7] - Use syscore_ops for "core" PM on SA1100. [5/7] - Use syscore_ops for "core" PM on PXA-based platforms. [6/7] - Use syscore_ops for "core" PM on Samsung platforms. [7/7] - Mark ARM select CONFIG_ARCH_NO_SYSDEV_OPS.
Thanks,
Rafael
PATCH 1/7 ARM: Use struct syscore_ops instead of sysdevs for PM in common code
From: Rafael J. Wysocki <[email protected]>
Convert some ARM architecture's common 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.
--- arch/arm/common/vic.c | 69 ++++++++++++++------------------------- arch/arm/include/asm/mach/time.h | 1 arch/arm/kernel/leds.c | 28 +++++++++------ arch/arm/kernel/time.c | 35 ++++++------------- arch/arm/vfp/vfpmodule.c | 19 ++-------- 5 files changed, 58 insertions(+), 94 deletions(-)
arch/arm/kernel/time.c +12 -23
@@ -21,7 +21,7 @@#include <linux/timex.h> #include <linux/errno.h> #include <linux/profile.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/timer.h> #include <linux/irq.h>
@@ -115,48 +115,37 @@ void timer_tick(void)#endif #if defined(CONFIG_PM ) && !defined(CONFIG_GENERIC_CLOCKEVENTS ) -static int timer_suspend (struct sys_device *dev,pm_message_t state) +static int timer_suspend (void ) { - struct sys_timer *timer = container_of(dev, struct sys_timer, dev); - -if (timer->suspend !=NULL ) - timer->suspend (); +if (system_timer->suspend) + system_timer->suspend ();return 0 ; } -static int timer_resume (struct sys_device *dev) +static void timer_resume (void ) { - struct sys_timer *timer = container_of(dev, struct sys_timer, dev); - -if (timer->resume !=NULL ) - timer->resume (); - -return 0 ; +if (system_timer->resume) + system_timer->resume (); }#else #define timer_suspend NULL#define timer_resume NULL#endif -static struct sysdev_class timer_sysclass = { - .name ="timer" , +static struct syscore_ops timer_syscore_ops = { .suspend = timer_suspend, .resume = timer_resume, }; -static int __init timer_init_sysfs (void ) +static int __init timer_init_syscore_ops (void ) { -int ret =sysdev_class_register (&timer_sysclass); -if (ret ==0 ) { - system_timer->dev.cls = &timer_sysclass; - ret =sysdev_register (&system_timer->dev); - } +register_syscore_ops (&timer_syscore_ops); -return ret; +return 0 ; } -device_initcall (timer_init_sysfs); +device_initcall (timer_init_syscore_ops);void __init time_init (void ) {
arch/arm/include/asm/mach/time.h +0 -1
@@ -34,7 +34,6 @@* timer interrupt which may be pending. */ struct sys_timer { -struct sys_device dev;void (*init)(void );void (*suspend)(void );void (*resume)(void );
arch/arm/kernel/leds.c +16 -12
@@ -10,6 +10,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <asm/leds.h>
@@ -69,36 +70,37 @@ static ssize_t leds_store(struct sys_dev static SYSDEV_ATTR(event, 0200, NULL, leds_store); -static int leds_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_class leds_sysclass = { + .name ="leds" , +}; + +static struct sys_device leds_device = { + .id =0 , + .cls = &leds_sysclass, +}; + +static int leds_suspend (void ) {leds_event (led_stop);return 0 ; } -static int leds_resume (struct sys_device *dev) +static void leds_resume (void ) {leds_event (led_start); -return 0 ; } -static int leds_shutdown (struct sys_device *dev) +static void leds_shutdown (void ) {leds_event (led_halted); -return 0 ; } -static struct sysdev_class leds_sysclass = { - .name ="leds" , +static struct syscore_ops leds_syscore_ops = { .shutdown = leds_shutdown, .suspend = leds_suspend, .resume = leds_resume, }; -static struct sys_device leds_device = { - .id =0 , - .cls = &leds_sysclass, -}; -static int __init leds_init (void ) {int ret;
@@ -107,6 +109,8 @@ static int __init leds_init(void) ret =sysdev_register (&leds_device);if (ret ==0 ) ret =sysdev_create_file (&leds_device, &attr_event); +if (ret ==0 ) +register_syscore_ops (&leds_syscore_ops);return ret; }
arch/arm/common/vic.c +25 -44
128 lines not on this page · raw message
arch/arm/vfp/vfpmodule.c +5 -14
@@ -378,9 +378,9 @@ static void vfp_enable(void *unused) }#ifdef CONFIG_PM -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> -static int vfp_pm_suspend (struct sys_device *dev,pm_message_t state) +static int vfp_pm_suspend (void ) {struct thread_info *ti =current_thread_info ();u32 fpexc =fmrx (FPEXC );
@@ -400,34 +400,25 @@ static int vfp_pm_suspend(struct sys_dev return 0; } -static int vfp_pm_resume (struct sys_device *dev) +static void vfp_pm_resume (void ) {/* ensure we have access to the vfp */ vfp_enable (NULL );/* and disable it to ensure the next usage restores the state */ fmxr (FPEXC ,fmrx (FPEXC ) & ~FPEXC_EN ); - -return 0 ; } -static struct sysdev_class vfp_pm_sysclass = { - .name ="vfp" , +static struct syscore_ops vfp_pm_syscore_ops = { .suspend = vfp_pm_suspend, .resume = vfp_pm_resume, }; -static struct sys_device vfp_pm_sysdev = { - .cls = &vfp_pm_sysclass, -}; -static void vfp_pm_init (void ) { -sysdev_class_register (&vfp_pm_sysclass); -sysdev_register (&vfp_pm_sysdev); +register_syscore_ops (&vfp_pm_syscore_ops); } -#else static inline void vfp_pm_init (void ) { }#endif /* CONFIG_PM */
PATCH 1/7 ARM: Use struct syscore_ops instead of sysdevs for PM in common code
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Convert some ARM architecture's common 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.
--- arch/arm/common/vic.c | 69 ++++++++++++++------------------------- arch/arm/include/asm/mach/time.h | 1 arch/arm/kernel/leds.c | 28 +++++++++------ arch/arm/kernel/time.c | 35 ++++++------------- arch/arm/vfp/vfpmodule.c | 19 ++-------- 5 files changed, 58 insertions(+), 94 deletions(-)
arch/arm/kernel/time.c +12 -23
@@ -21,7 +21,7 @@#include <linux/timex.h> #include <linux/errno.h> #include <linux/profile.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/timer.h> #include <linux/irq.h>
@@ -115,48 +115,37 @@ void timer_tick(void)#endif #if defined(CONFIG_PM ) && !defined(CONFIG_GENERIC_CLOCKEVENTS ) -static int timer_suspend (struct sys_device *dev,pm_message_t state) +static int timer_suspend (void ) { - struct sys_timer *timer = container_of(dev, struct sys_timer, dev); - -if (timer->suspend !=NULL ) - timer->suspend (); +if (system_timer->suspend) + system_timer->suspend ();return 0 ; } -static int timer_resume (struct sys_device *dev) +static void timer_resume (void ) { - struct sys_timer *timer = container_of(dev, struct sys_timer, dev); - -if (timer->resume !=NULL ) - timer->resume (); - -return 0 ; +if (system_timer->resume) + system_timer->resume (); }#else #define timer_suspend NULL#define timer_resume NULL#endif -static struct sysdev_class timer_sysclass = { - .name ="timer" , +static struct syscore_ops timer_syscore_ops = { .suspend = timer_suspend, .resume = timer_resume, }; -static int __init timer_init_sysfs (void ) +static int __init timer_init_syscore_ops (void ) { -int ret =sysdev_class_register (&timer_sysclass); -if (ret ==0 ) { - system_timer->dev.cls = &timer_sysclass; - ret =sysdev_register (&system_timer->dev); - } +register_syscore_ops (&timer_syscore_ops); -return ret; +return 0 ; } -device_initcall (timer_init_sysfs); +device_initcall (timer_init_syscore_ops);void __init time_init (void ) {
arch/arm/include/asm/mach/time.h +0 -1
@@ -34,7 +34,6 @@* timer interrupt which may be pending. */ struct sys_timer { -struct sys_device dev;void (*init)(void );void (*suspend)(void );void (*resume)(void );
arch/arm/kernel/leds.c +16 -12
@@ -10,6 +10,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <asm/leds.h>
@@ -69,36 +70,37 @@ static ssize_t leds_store(struct sys_dev static SYSDEV_ATTR(event, 0200, NULL, leds_store); -static int leds_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_class leds_sysclass = { + .name ="leds" , +}; + +static struct sys_device leds_device = { + .id =0 , + .cls = &leds_sysclass, +}; + +static int leds_suspend (void ) {leds_event (led_stop);return 0 ; } -static int leds_resume (struct sys_device *dev) +static void leds_resume (void ) {leds_event (led_start); -return 0 ; } -static int leds_shutdown (struct sys_device *dev) +static void leds_shutdown (void ) {leds_event (led_halted); -return 0 ; } -static struct sysdev_class leds_sysclass = { - .name ="leds" , +static struct syscore_ops leds_syscore_ops = { .shutdown = leds_shutdown, .suspend = leds_suspend, .resume = leds_resume, }; -static struct sys_device leds_device = { - .id =0 , - .cls = &leds_sysclass, -}; -static int __init leds_init (void ) {int ret;
@@ -107,6 +109,8 @@ static int __init leds_init(void) ret =sysdev_register (&leds_device);if (ret ==0 ) ret =sysdev_create_file (&leds_device, &attr_event); +if (ret ==0 ) +register_syscore_ops (&leds_syscore_ops);return ret; }
arch/arm/common/vic.c +25 -44
128 lines not on this page · raw message
arch/arm/vfp/vfpmodule.c +5 -14
@@ -378,9 +378,9 @@ static void vfp_enable(void *unused) }#ifdef CONFIG_PM -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> -static int vfp_pm_suspend (struct sys_device *dev,pm_message_t state) +static int vfp_pm_suspend (void ) {struct thread_info *ti =current_thread_info ();u32 fpexc =fmrx (FPEXC );
@@ -400,34 +400,25 @@ static int vfp_pm_suspend(struct sys_dev return 0; } -static int vfp_pm_resume (struct sys_device *dev) +static void vfp_pm_resume (void ) {/* ensure we have access to the vfp */ vfp_enable (NULL );/* and disable it to ensure the next usage restores the state */ fmxr (FPEXC ,fmrx (FPEXC ) & ~FPEXC_EN ); - -return 0 ; } -static struct sysdev_class vfp_pm_sysclass = { - .name ="vfp" , +static struct syscore_ops vfp_pm_syscore_ops = { .suspend = vfp_pm_suspend, .resume = vfp_pm_resume, }; -static struct sys_device vfp_pm_sysdev = { - .cls = &vfp_pm_sysclass, -}; -static void vfp_pm_init (void ) { -sysdev_class_register (&vfp_pm_sysclass); -sysdev_register (&vfp_pm_sysdev); +register_syscore_ops (&vfp_pm_syscore_ops); } -#else static inline void vfp_pm_init (void ) { }#endif /* CONFIG_PM */
PATCH 2/7 ARM / OMAP: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management in the OMAP's GPIO code with a struct syscore_ops object which is simpler.
--- arch/arm/plat-omap/gpio.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-)
arch/arm/plat-omap/gpio.c +9 -26
@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h>
@@ -1379,9 +1379,7 @@ static const struct dev_pm_ops omap_mpui .resume_noirq = omap_mpuio_resume_noirq, }; -/* use platform_driver for this, now that there's no longer any -* point to sys_device (other than not disturbing old code). -*/ +/* use platform_driver for this. */ static struct platform_driver omap_mpuio_driver = { .driver = { .name ="mpuio" ,
@@ -1754,7 +1752,7 @@ static int __devinit omap_gpio_probe(str }#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -static int omap_gpio_suspend (struct sys_device *dev,pm_message_t mesg) +static int omap_gpio_suspend (void ) {int i;
@@ -1804,12 +1802,12 @@ static int omap_gpio_suspend(struct sys_return 0 ; } -static int omap_gpio_resume (struct sys_device *dev) +static void omap_gpio_resume (void ) {int i;if (!cpu_class_is_omap2 () && !cpu_is_omap16xx ()) -return 0 ; +return ;for (i =0 ; i < gpio_bank_count; i++) {struct gpio_bank *bank = &gpio_bank[i];
@@ -1845,21 +1843,13 @@ static int omap_gpio_resume(struct sys_d__raw_writel (bank->saved_wakeup, wake_set); spin_unlock_irqrestore(&bank->lock, flags); } - -return 0 ; } -static struct sysdev_class omap_gpio_sysclass = { - .name ="gpio" , +static struct syscore_ops omap_gpio_syscore_ops = { .suspend = omap_gpio_suspend, .resume = omap_gpio_resume, }; -static struct sys_device omap_gpio_device = { - .id =0 , - .cls = &omap_gpio_sysclass, -}; -#endif #ifdef CONFIG_ARCH_OMAP2PLUS
@@ -2117,21 +2107,14 @@ postcore_initcall(omap_gpio_drv_reg);static int __init omap_gpio_sysinit (void ) { -int ret =0 ; -mpuio_init ();#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) { -if (ret ==0 ) { - ret =sysdev_class_register (&omap_gpio_sysclass); -if (ret ==0 ) - ret =sysdev_register (&omap_gpio_device); - } - } +if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) +register_syscore_ops (&omap_gpio_syscore_ops);#endif -return ret; +return 0 ; }arch_initcall (omap_gpio_sysinit);
Re: [PATCH 2/7] ARM / OMAP: Use struct syscore_ops for "core" power management
Quoted 7 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct
sys_deviceused for power management in the OMAP's GPIO code with a structsyscore_opsobject which is simpler.Signed-off-by Rafael J. Wysocki <[email protected]>
Looks fine to me. We're in the process of converting this driver to runtime PM. When that happens the syscore ops will be removed as well, but I'm fine with this patch until we finish the runtime PM conversion.
Kevin
Quoted 100 lines
--- arch/arm/plat-omap/gpio.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-)Index:
linux-2.6/arch/arm/plat-omap/gpio.c
===================================================================arch/arm/plat-omap/gpio.c +9
-26@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h> @@ -1379,9 +1379,7 @@ static const struct dev_pm_ops omap_mpui .resume_noirq = omap_mpuio_resume_noirq, }; -/* use platform_driver for this, now that there's no longer any -* point to sys_device (other than not disturbing old code). -*/ +/* use platform_driver for this. */ static struct platform_driver omap_mpuio_driver = { .driver = { .name ="mpuio" ,@@ -1754,7 +1752,7 @@ static int __devinit omap_gpio_probe(str }#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -static int omap_gpio_suspend (struct sys_device *dev,pm_message_t mesg) +static int omap_gpio_suspend (void ) {int i;@@ -1804,12 +1802,12 @@ static int omap_gpio_suspend(struct sys_return 0 ; } -static int omap_gpio_resume (struct sys_device *dev) +static void omap_gpio_resume (void ) {int i;if (!cpu_class_is_omap2 () && !cpu_is_omap16xx ()) -return 0 ; +return ;for (i =0 ; i < gpio_bank_count; i++) {struct gpio_bank *bank = &gpio_bank[i];@@ -1845,21 +1843,13 @@ static int omap_gpio_resume(struct sys_d__raw_writel (bank->saved_wakeup, wake_set); spin_unlock_irqrestore(&bank->lock, flags); } - -return 0 ; } -static struct sysdev_class omap_gpio_sysclass = { - .name ="gpio" , +static struct syscore_ops omap_gpio_syscore_ops = { .suspend = omap_gpio_suspend, .resume = omap_gpio_resume, }; -static struct sys_device omap_gpio_device = { - .id =0 , - .cls = &omap_gpio_sysclass, -}; -#endif #ifdef CONFIG_ARCH_OMAP2PLUS @@ -2117,21 +2107,14 @@ postcore_initcall(omap_gpio_drv_reg);static int __init omap_gpio_sysinit (void ) { -int ret =0 ; -mpuio_init ();#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) { -if (ret ==0 ) { - ret =sysdev_class_register (&omap_gpio_sysclass); -if (ret ==0 ) - ret =sysdev_register (&omap_gpio_device); - } - } +if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) +register_syscore_ops (&omap_gpio_syscore_ops);#endif -return ret; +return 0 ; }arch_initcall (omap_gpio_sysinit);
Re: [PATCH 2/7] ARM / OMAP: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiQuoted 7 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct
sys_deviceused for power management in the OMAP's GPIO code with a structsyscore_opsobject which is simpler.Signed-off-by Rafael J. Wysocki <[email protected]>
Looks fine to me. We're in the process of converting this driver to runtime PM. When that happens the syscore ops will be removed as well, but I'm fine with this patch until we finish the runtime PM conversion.
Kevin
Quoted 100 lines
--- arch/arm/plat-omap/gpio.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-)Index:
linux-2.6/arch/arm/plat-omap/gpio.c
===================================================================arch/arm/plat-omap/gpio.c +9
-26@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h> @@ -1379,9 +1379,7 @@ static const struct dev_pm_ops omap_mpui .resume_noirq = omap_mpuio_resume_noirq, }; -/* use platform_driver for this, now that there's no longer any -* point to sys_device (other than not disturbing old code). -*/ +/* use platform_driver for this. */ static struct platform_driver omap_mpuio_driver = { .driver = { .name ="mpuio" ,@@ -1754,7 +1752,7 @@ static int __devinit omap_gpio_probe(str }#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -static int omap_gpio_suspend (struct sys_device *dev,pm_message_t mesg) +static int omap_gpio_suspend (void ) {int i;@@ -1804,12 +1802,12 @@ static int omap_gpio_suspend(struct sys_return 0 ; } -static int omap_gpio_resume (struct sys_device *dev) +static void omap_gpio_resume (void ) {int i;if (!cpu_class_is_omap2 () && !cpu_is_omap16xx ()) -return 0 ; +return ;for (i =0 ; i < gpio_bank_count; i++) {struct gpio_bank *bank = &gpio_bank[i];@@ -1845,21 +1843,13 @@ static int omap_gpio_resume(struct sys_d__raw_writel (bank->saved_wakeup, wake_set); spin_unlock_irqrestore(&bank->lock, flags); } - -return 0 ; } -static struct sysdev_class omap_gpio_sysclass = { - .name ="gpio" , +static struct syscore_ops omap_gpio_syscore_ops = { .suspend = omap_gpio_suspend, .resume = omap_gpio_resume, }; -static struct sys_device omap_gpio_device = { - .id =0 , - .cls = &omap_gpio_sysclass, -}; -#endif #ifdef CONFIG_ARCH_OMAP2PLUS @@ -2117,21 +2107,14 @@ postcore_initcall(omap_gpio_drv_reg);static int __init omap_gpio_sysinit (void ) { -int ret =0 ; -mpuio_init ();#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) { -if (ret ==0 ) { - ret =sysdev_class_register (&omap_gpio_sysclass); -if (ret ==0 ) - ret =sysdev_register (&omap_gpio_device); - } - } +if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) +register_syscore_ops (&omap_gpio_syscore_ops);#endif -return ret; +return 0 ; }arch_initcall (omap_gpio_sysinit);
PATCH 2/7 ARM / OMAP: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management in the OMAP's GPIO code with a struct syscore_ops object which is simpler.
--- arch/arm/plat-omap/gpio.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-)
arch/arm/plat-omap/gpio.c +9 -26
@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h>
@@ -1379,9 +1379,7 @@ static const struct dev_pm_ops omap_mpui .resume_noirq = omap_mpuio_resume_noirq, }; -/* use platform_driver for this, now that there's no longer any -* point to sys_device (other than not disturbing old code). -*/ +/* use platform_driver for this. */ static struct platform_driver omap_mpuio_driver = { .driver = { .name ="mpuio" ,
@@ -1754,7 +1752,7 @@ static int __devinit omap_gpio_probe(str }#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -static int omap_gpio_suspend (struct sys_device *dev,pm_message_t mesg) +static int omap_gpio_suspend (void ) {int i;
@@ -1804,12 +1802,12 @@ static int omap_gpio_suspend(struct sys_return 0 ; } -static int omap_gpio_resume (struct sys_device *dev) +static void omap_gpio_resume (void ) {int i;if (!cpu_class_is_omap2 () && !cpu_is_omap16xx ()) -return 0 ; +return ;for (i =0 ; i < gpio_bank_count; i++) {struct gpio_bank *bank = &gpio_bank[i];
@@ -1845,21 +1843,13 @@ static int omap_gpio_resume(struct sys_d__raw_writel (bank->saved_wakeup, wake_set); spin_unlock_irqrestore(&bank->lock, flags); } - -return 0 ; } -static struct sysdev_class omap_gpio_sysclass = { - .name ="gpio" , +static struct syscore_ops omap_gpio_syscore_ops = { .suspend = omap_gpio_suspend, .resume = omap_gpio_resume, }; -static struct sys_device omap_gpio_device = { - .id =0 , - .cls = &omap_gpio_sysclass, -}; -#endif #ifdef CONFIG_ARCH_OMAP2PLUS
@@ -2117,21 +2107,14 @@ postcore_initcall(omap_gpio_drv_reg);static int __init omap_gpio_sysinit (void ) { -int ret =0 ; -mpuio_init ();#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) { -if (ret ==0 ) { - ret =sysdev_class_register (&omap_gpio_sysclass); -if (ret ==0 ) - ret =sysdev_register (&omap_gpio_device); - } - } +if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) +register_syscore_ops (&omap_gpio_syscore_ops);#endif -return ret; +return 0 ; }arch_initcall (omap_gpio_sysinit);
PATCH 3/7 ARM / Integrator: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management by the Integrator interrupt-handling code with a struct syscore_ops object which is simpler.
--- arch/arm/mach-integrator/integrator_ap.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
arch/arm/mach-integrator/integrator_ap.c +9 -17
@@ -24,7 +24,7 @@#include <linux/platform_device.h> #include <linux/slab.h> #include <linux/string.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/amba/bus.h> #include <linux/amba/kmi.h> #include <linux/clocksource.h>
@@ -180,13 +180,13 @@ static void __init ap_init_irq(void)#ifdef CONFIG_PM static unsigned long ic_irq_enable; -static int irq_suspend (struct sys_device *dev,pm_message_t state) +static int irq_suspend (void ) { ic_irq_enable =readl (VA_IC_BASE +IRQ_ENABLE );return 0 ; } -static int irq_resume (struct sys_device *dev) +static void irq_resume (void ) {/* disable all irq sources */ writel (-1 ,VA_CMIC_BASE +IRQ_ENABLE_CLEAR );
@@ -194,33 +194,25 @@ static int irq_resume(struct sys_devicewritel (-1 ,VA_IC_BASE +FIQ_ENABLE_CLEAR ); writel(ic_irq_enable, VA_IC_BASE + IRQ_ENABLE_SET); - return 0; }#else #define irq_suspend NULL#define irq_resume NULL#endif -static struct sysdev_class irq_class = { - .name ="irq" , +static struct syscore_ops irq_syscore_ops = { .suspend = irq_suspend, .resume = irq_resume, }; -static struct sys_device irq_device = { - .id =0 , - .cls = &irq_class, -}; - -static int __init irq_init_sysfs (void ) +static int __init irq_syscore_init (void ) { -int ret =sysdev_class_register (&irq_class); -if (ret ==0 ) - ret =sysdev_register (&irq_device); -return ret; +register_syscore_ops (&irq_syscore_ops); + +return 0 ; } -device_initcall (irq_init_sysfs); +device_initcall (irq_syscore_init);/* * Flash handling.
PATCH 3/7 ARM / Integrator: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management by the Integrator interrupt-handling code with a struct syscore_ops object which is simpler.
--- arch/arm/mach-integrator/integrator_ap.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
arch/arm/mach-integrator/integrator_ap.c +9 -17
@@ -24,7 +24,7 @@#include <linux/platform_device.h> #include <linux/slab.h> #include <linux/string.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/amba/bus.h> #include <linux/amba/kmi.h> #include <linux/clocksource.h>
@@ -180,13 +180,13 @@ static void __init ap_init_irq(void)#ifdef CONFIG_PM static unsigned long ic_irq_enable; -static int irq_suspend (struct sys_device *dev,pm_message_t state) +static int irq_suspend (void ) { ic_irq_enable =readl (VA_IC_BASE +IRQ_ENABLE );return 0 ; } -static int irq_resume (struct sys_device *dev) +static void irq_resume (void ) {/* disable all irq sources */ writel (-1 ,VA_CMIC_BASE +IRQ_ENABLE_CLEAR );
@@ -194,33 +194,25 @@ static int irq_resume(struct sys_devicewritel (-1 ,VA_IC_BASE +FIQ_ENABLE_CLEAR ); writel(ic_irq_enable, VA_IC_BASE + IRQ_ENABLE_SET); - return 0; }#else #define irq_suspend NULL#define irq_resume NULL#endif -static struct sysdev_class irq_class = { - .name ="irq" , +static struct syscore_ops irq_syscore_ops = { .suspend = irq_suspend, .resume = irq_resume, }; -static struct sys_device irq_device = { - .id =0 , - .cls = &irq_class, -}; - -static int __init irq_init_sysfs (void ) +static int __init irq_syscore_init (void ) { -int ret =sysdev_class_register (&irq_class); -if (ret ==0 ) - ret =sysdev_register (&irq_device); -return ret; +register_syscore_ops (&irq_syscore_ops); + +return 0 ; } -device_initcall (irq_init_sysfs); +device_initcall (irq_syscore_init);/* * Flash handling.
PATCH 4/7 ARM / SA1100: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management by the SA1100 interrupt-handling code with a struct syscore_ops object which is simpler.
--- arch/arm/mach-sa1100/irq.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
arch/arm/mach-sa1100/irq.c +6 -13
@@ -14,7 +14,7 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <asm/mach/irq.h>
@@ -234,7 +234,7 @@ static struct sa1100irq_state {unsigned int iccr; } sa1100irq_state; -static int sa1100irq_suspend (struct sys_device *dev,pm_message_t state) +static int sa1100irq_suspend (void ) {struct sa1100irq_state *st = &sa1100irq_state;
@@ -264,7 +264,7 @@ static int sa1100irq_suspend(struct sys_return 0 ; } -static int sa1100irq_resume (struct sys_device *dev) +static void sa1100irq_resume (void ) {struct sa1100irq_state *st = &sa1100irq_state;
@@ -277,24 +277,17 @@ static int sa1100irq_resume(struct sys_dICMR = st->icmr; } -return 0 ; } -static struct sysdev_class sa1100irq_sysclass = { - .name ="sa11x0-irq" , +static struct syscore_ops sa1100irq_syscore_ops = { .suspend = sa1100irq_suspend, .resume = sa1100irq_resume, }; -static struct sys_device sa1100irq_device = { - .id =0 , - .cls = &sa1100irq_sysclass, -}; -static int __init sa1100irq_init_devicefs (void ) { -sysdev_class_register (&sa1100irq_sysclass); -return sysdev_register (&sa1100irq_device); +register_syscore_ops (&sa1100irq_syscore_ops); +return 0 ; }device_initcall (sa1100irq_init_devicefs);
PATCH 4/7 ARM / SA1100: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management by the SA1100 interrupt-handling code with a struct syscore_ops object which is simpler.
--- arch/arm/mach-sa1100/irq.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
arch/arm/mach-sa1100/irq.c +6 -13
@@ -14,7 +14,7 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <asm/mach/irq.h>
@@ -234,7 +234,7 @@ static struct sa1100irq_state {unsigned int iccr; } sa1100irq_state; -static int sa1100irq_suspend (struct sys_device *dev,pm_message_t state) +static int sa1100irq_suspend (void ) {struct sa1100irq_state *st = &sa1100irq_state;
@@ -264,7 +264,7 @@ static int sa1100irq_suspend(struct sys_return 0 ; } -static int sa1100irq_resume (struct sys_device *dev) +static void sa1100irq_resume (void ) {struct sa1100irq_state *st = &sa1100irq_state;
@@ -277,24 +277,17 @@ static int sa1100irq_resume(struct sys_dICMR = st->icmr; } -return 0 ; } -static struct sysdev_class sa1100irq_sysclass = { - .name ="sa11x0-irq" , +static struct syscore_ops sa1100irq_syscore_ops = { .suspend = sa1100irq_suspend, .resume = sa1100irq_resume, }; -static struct sys_device sa1100irq_device = { - .id =0 , - .cls = &sa1100irq_sysclass, -}; -static int __init sa1100irq_init_devicefs (void ) { -sysdev_class_register (&sa1100irq_sysclass); -return sysdev_register (&sa1100irq_device); +register_syscore_ops (&sa1100irq_syscore_ops); +return 0 ; }device_initcall (sa1100irq_init_devicefs);
PATCH 5/7 ARM / PXA: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct sys_device objects used for "core" power management by the PXA platform code with struct syscore_ops objects that are simpler.
This reduces the code size and the kernel memory footprint. It also is necessary for removing sysdevs entirely from the kernel in the future.
--- arch/arm/mach-pxa/balloon3.c | 1 arch/arm/mach-pxa/clock-pxa2xx.c | 18 ++---------- arch/arm/mach-pxa/clock-pxa3xx.c | 17 ++--------- arch/arm/mach-pxa/clock.h | 7 ++-- arch/arm/mach-pxa/cm-x270.c | 1 arch/arm/mach-pxa/cm-x2xx.c | 23 ++++------------ arch/arm/mach-pxa/colibri-evalboard.c | 1 arch/arm/mach-pxa/colibri-pxa270-income.c | 1 arch/arm/mach-pxa/colibri-pxa270.c | 1 arch/arm/mach-pxa/generic.h | 8 ++--- arch/arm/mach-pxa/irq.c | 17 ++--------- arch/arm/mach-pxa/lpd270.c | 20 ++++--------- arch/arm/mach-pxa/lubbock.c | 21 ++++---------- arch/arm/mach-pxa/mainstone.c | 22 ++++----------- arch/arm/mach-pxa/mfp-pxa2xx.c | 12 +++----- arch/arm/mach-pxa/mfp-pxa3xx.c | 21 +++----------- arch/arm/mach-pxa/mioa701.c | 43 +++++------------------------- arch/arm/mach-pxa/palmld.c | 1 arch/arm/mach-pxa/palmtreo.c | 1 arch/arm/mach-pxa/palmz72.c | 24 +++++----------- arch/arm/mach-pxa/pxa25x.c | 25 ++++------------- arch/arm/mach-pxa/pxa27x.c | 25 ++++------------- arch/arm/mach-pxa/pxa3xx.c | 25 ++++------------- arch/arm/mach-pxa/pxa95x.c | 20 ++----------- arch/arm/mach-pxa/raumfeld.c | 1 arch/arm/mach-pxa/smemc.c | 29 ++++---------------- arch/arm/mach-pxa/trizeps4.c | 1 arch/arm/mach-pxa/viper.c | 12 ++++---- arch/arm/mach-pxa/vpac270.c | 1 arch/arm/plat-pxa/gpio.c | 17 ++--------- arch/arm/plat-pxa/mfp.c | 1 31 files changed, 110 insertions(+), 307 deletions(-)
arch/arm/plat-pxa/gpio.c +4 -13
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/slab.h> #include <mach/gpio.h>
@@ -295,7 +295,7 @@ void __init pxa_init_gpio(int mux_irq, i }#ifdef CONFIG_PM -static int pxa_gpio_suspend (struct sys_device *dev,pm_message_t state) +static int pxa_gpio_suspend (void ) {struct pxa_gpio_chip *c;int gpio;
@@ -312,7 +312,7 @@ static int pxa_gpio_suspend(struct sys_dreturn 0 ; } -static int pxa_gpio_resume (struct sys_device *dev) +static void pxa_gpio_resume (void ) {struct pxa_gpio_chip *c;int gpio;
@@ -326,22 +326,13 @@ static int pxa_gpio_resume(struct sys_de__raw_writel (c->saved_gfer, c->regbase +GFER_OFFSET ); __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET); } -return 0 ; }#else #define pxa_gpio_suspend NULL#define pxa_gpio_resume NULL#endif -struct sysdev_class pxa_gpio_sysclass = { - .name ="gpio" , +struct syscore_ops pxa_gpio_syscore_ops = { .suspend = pxa_gpio_suspend, .resume = pxa_gpio_resume, }; - -static int __init pxa_gpio_init (void ) -{ -return sysdev_class_register (&pxa_gpio_sysclass); -} - -core_initcall (pxa_gpio_init);
arch/arm/mach-pxa/generic.h +4 -4
@@ -61,10 +61,10 @@ extern unsigned pxa3xx_get_clk_frequency#define pxa3xx_get_clk_frequency_khz (x) (0)#endif -extern struct sysdev_class pxa_irq_sysclass; -extern struct sysdev_class pxa_gpio_sysclass; -extern struct sysdev_class pxa2xx_mfp_sysclass; -extern struct sysdev_class pxa3xx_mfp_sysclass; +extern struct syscore_ops pxa_irq_syscore_ops; +extern struct syscore_ops pxa_gpio_syscore_ops; +extern struct syscore_ops pxa2xx_mfp_syscore_ops; +extern struct syscore_ops pxa3xx_mfp_syscore_ops;void __init pxa_set_ffuart_info (void *info);void __init pxa_set_btuart_info (void *info);
arch/arm/mach-pxa/pxa95x.c +4 -16
@@ -18,7 +18,7 @@#include <linux/i2c/pxa-i2c.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/gpio.h>
@@ -260,16 +260,6 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa95x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa3xx_clock_sysclass, - } -}; -static int __init pxa95x_init (void ) {int ret =0 , i;
@@ -293,11 +283,9 @@ static int __init pxa95x_init(void)if ((ret =pxa_init_dma (IRQ_DMA ,32 )))return ret; -for (i =0 ; i <ARRAY_SIZE (pxa95x_sysdev); i++) { - ret =sysdev_register (&pxa95x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa3xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/clock-pxa3xx.c +4 -13
@@ -10,6 +10,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/syscore_ops.h> #include <mach/smemc.h> #include <mach/pxa3xx-regs.h>
@@ -182,7 +183,7 @@ const struct clkops clk_pxa3xx_pout_opsstatic uint32_t cken[2 ];static uint32_t accr; -static int pxa3xx_clock_suspend (struct sys_device *d,pm_message_t state) +static int pxa3xx_clock_suspend (void ) { cken[0 ] =CKENA ; cken[1 ] =CKENB ;
@@ -190,28 +191,18 @@ static int pxa3xx_clock_suspend(struct s return 0; } -static int pxa3xx_clock_resume (struct sys_device *d) +static void pxa3xx_clock_resume (void ) {ACCR = accr;CKENA = cken[0 ];CKENB = cken[1 ]; -return 0 ; }#else #define pxa3xx_clock_suspend NULL#define pxa3xx_clock_resume NULL#endif -struct sysdev_class pxa3xx_clock_sysclass = { - .name ="pxa3xx-clock" , +struct syscore_ops pxa3xx_clock_syscore_ops = { .suspend = pxa3xx_clock_suspend, .resume = pxa3xx_clock_resume, }; - -static int __init pxa3xx_clock_init (void ) -{ -if (cpu_is_pxa3xx () ||cpu_is_pxa95x ()) -return sysdev_class_register (&pxa3xx_clock_sysclass); -return 0 ; -} -postcore_initcall (pxa3xx_clock_init);
arch/arm/mach-pxa/clock.h +4 -3
@@ -1,5 +1,5 @@#include <linux/clkdev.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> struct clkops {void (*enable)(struct clk *);
@@ -54,7 +54,7 @@ extern const struct clkops clk_pxa2xx_ckvoid clk_pxa2xx_cken_enable (struct clk *clk);void clk_pxa2xx_cken_disable (struct clk *clk); -extern struct sysdev_class pxa2xx_clock_sysclass; +extern struct syscore_ops pxa2xx_clock_syscore_ops;#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)#define DEFINE_PXA3_CKEN (_name, _cken, _rate, _delay) \
@@ -74,5 +74,6 @@ extern const struct clkops clk_pxa3xx_smextern void clk_pxa3xx_cken_enable (struct clk *);extern void clk_pxa3xx_cken_disable (struct clk *); -extern struct sysdev_class pxa3xx_clock_sysclass; +extern struct syscore_ops pxa3xx_clock_syscore_ops; +#endif
arch/arm/mach-pxa/irq.c +4 -13
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <linux/irq.h>
@@ -183,7 +183,7 @@ void __init pxa_init_irq(int irq_nr, setstatic unsigned long saved_icmr[MAX_INTERNAL_IRQS /32 ];static unsigned long saved_ipr[MAX_INTERNAL_IRQS ]; -static int pxa_irq_suspend (struct sys_device *dev,pm_message_t state) +static int pxa_irq_suspend (void ) {int i;
@@ -202,7 +202,7 @@ static int pxa_irq_suspend(struct sys_dereturn 0 ; } -static int pxa_irq_resume (struct sys_device *dev) +static void pxa_irq_resume (void ) {int i;
@@ -218,22 +218,13 @@ static int pxa_irq_resume(struct sys_dev__raw_writel (saved_ipr[i],IRQ_BASE +IPR (i)); __raw_writel(1, IRQ_BASE + ICCR); - return 0; }#else #define pxa_irq_suspend NULL#define pxa_irq_resume NULL#endif -struct sysdev_class pxa_irq_sysclass = { - .name ="irq" , +struct syscore_ops pxa_irq_syscore_ops = { .suspend = pxa_irq_suspend, .resume = pxa_irq_resume, }; - -static int __init pxa_irq_init (void ) -{ -return sysdev_class_register (&pxa_irq_sysclass); -} - -core_initcall (pxa_irq_init);
arch/arm/mach-pxa/clock-pxa2xx.c +4 -14
@@ -9,7 +9,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/pxa2xx-regs.h>
@@ -33,32 +33,22 @@ const struct clkops clk_pxa2xx_cken_ops#ifdef CONFIG_PM static uint32_t saved_cken; -static int pxa2xx_clock_suspend (struct sys_device *d,pm_message_t state) +static int pxa2xx_clock_suspend (void ) { saved_cken =CKEN ;return 0 ; } -static int pxa2xx_clock_resume (struct sys_device *d) +static void pxa2xx_clock_resume (void ) {CKEN = saved_cken; -return 0 ; }#else #define pxa2xx_clock_suspend NULL#define pxa2xx_clock_resume NULL#endif -struct sysdev_class pxa2xx_clock_sysclass = { - .name ="pxa2xx-clock" , +struct syscore_ops pxa2xx_clock_syscore_ops = { .suspend = pxa2xx_clock_suspend, .resume = pxa2xx_clock_resume, }; - -static int __init pxa2xx_clock_init (void ) -{ -if (cpu_is_pxa2xx ()) -return sysdev_class_register (&pxa2xx_clock_sysclass); -return 0 ; -} -postcore_initcall (pxa2xx_clock_init);
arch/arm/mach-pxa/mfp-pxa3xx.c +5 -16
@@ -17,7 +17,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/mfp-pxa3xx.h>
@@ -31,13 +31,13 @@* a pull-down mode if they're an active low chip select, and we're * just entering standby. */ -static int pxa3xx_mfp_suspend (struct sys_device *d,pm_message_t state) +static int pxa3xx_mfp_suspend (void ) {mfp_config_lpm ();return 0 ; } -static int pxa3xx_mfp_resume (struct sys_device *d) +static void pxa3xx_mfp_resume (void ) {mfp_config_run ();
@@ -47,24 +47,13 @@ static int pxa3xx_mfp_resume(struct sys_* preserve them here in case they will be referenced later */ ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); - return 0; }#else #define pxa3xx_mfp_suspend NULL#define pxa3xx_mfp_resume NULL#endif -struct sysdev_class pxa3xx_mfp_sysclass = { - .name ="mfp" , +struct syscore_ops pxa3xx_mfp_syscore_ops = { .suspend = pxa3xx_mfp_suspend, - .resume = pxa3xx_mfp_resume, + .resume = pxa3xx_mfp_resume, }; - -static int __init mfp_init_devicefs (void ) -{ -if (cpu_is_pxa3xx ()) -return sysdev_class_register (&pxa3xx_mfp_sysclass); - -return 0 ; -} -postcore_initcall (mfp_init_devicefs);
arch/arm/mach-pxa/pxa3xx.c +6 -19
@@ -20,7 +20,7 @@#include <linux/platform_device.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/i2c/pxa-i2c.h> #include <asm/mach/map.h>
@@ -427,21 +427,9 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa3xx_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa3xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa3xx_clock_sysclass, - } -}; -static int __init pxa3xx_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa3xx ()) {
@@ -462,11 +450,10 @@ static int __init pxa3xx_init(void)pxa3xx_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa3xx_sysdev); i++) { - ret =sysdev_register (&pxa3xx_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa3xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa3xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/mfp-pxa2xx.c +5 -7
@@ -16,7 +16,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/gpio.h> #include <mach/pxa2xx-regs.h>
@@ -338,7 +338,7 @@ static unsigned long saved_gafr[2][4];static unsigned long saved_gpdr[4 ];static unsigned long saved_pgsr[4 ]; -static int pxa2xx_mfp_suspend (struct sys_device *d,pm_message_t state) +static int pxa2xx_mfp_suspend (void ) {int i;
@@ -365,7 +365,7 @@ static int pxa2xx_mfp_suspend(struct sysreturn 0 ; } -static int pxa2xx_mfp_resume (struct sys_device *d) +static void pxa2xx_mfp_resume (void ) {int i;
@@ -376,15 +376,13 @@ static int pxa2xx_mfp_resume(struct sys_ PGSR(i) = saved_pgsr[i]; }PSSR =PSSR_RDH |PSSR_PH ; -return 0 ; }#else #define pxa2xx_mfp_suspend NULL#define pxa2xx_mfp_resume NULL#endif -struct sysdev_class pxa2xx_mfp_sysclass = { - .name ="mfp" , +struct syscore_ops pxa2xx_mfp_syscore_ops = { .suspend = pxa2xx_mfp_suspend, .resume = pxa2xx_mfp_resume, };
@@ -409,6 +407,6 @@ static int __init pxa2xx_mfp_init(void)for (i =0 ; i <=gpio_to_bank (pxa_last_gpio); i++) gpdr_lpm[i] =GPDR (i *32 ); -return sysdev_class_register (&pxa2xx_mfp_sysclass); +return 0 ; }postcore_initcall (pxa2xx_mfp_init);
arch/arm/mach-pxa/pxa25x.c +6 -19
@@ -21,7 +21,7 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/suspend.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <asm/mach/map.h>
@@ -350,21 +350,9 @@ static struct platform_device *pxa25x_de &pxa_device_asoc_platform, }; -static struct sys_device pxa25x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa2xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa2xx_clock_sysclass, - } -}; -static int __init pxa25x_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa25x ()) {
@@ -377,11 +365,10 @@ static int __init pxa25x_init(void)pxa25x_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa25x_sysdev); i++) { - ret =sysdev_register (&pxa25x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa2xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa2xx_clock_syscore_ops); ret =platform_add_devices (pxa25x_devices,ARRAY_SIZE (pxa25x_devices));
arch/arm/mach-pxa/pxa27x.c +6 -19
@@ -16,7 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <linux/irq.h> #include <linux/i2c/pxa-i2c.h>
@@ -428,21 +428,9 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa27x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa2xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa2xx_clock_sysclass, - } -}; -static int __init pxa27x_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa27x ()) {
@@ -455,11 +443,10 @@ static int __init pxa27x_init(void)pxa27x_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa27x_sysdev); i++) { - ret =sysdev_register (&pxa27x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa2xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa2xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/mioa701.c +8 -35
81 lines not on this page · raw message
arch/arm/mach-pxa/mainstone.c +6 -16
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
@@ -185,31 +185,21 @@ static void __init mainstone_init_irq(vo#ifdef CONFIG_PM -static int mainstone_irq_resume (struct sys_device *dev) +static void mainstone_irq_resume (void ) {MST_INTMSKENA = mainstone_irq_enabled; -return 0 ; } -static struct sysdev_class mainstone_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops mainstone_irq_syscore_ops = { .resume = mainstone_irq_resume, }; -static struct sys_device mainstone_irq_device = { - .cls = &mainstone_irq_sysclass, -}; -static int __init mainstone_irq_device_init (void ) { -int ret = -ENODEV ; +if (machine_is_mainstone ()) +register_syscore_ops (&mainstone_irq_syscore_ops); -if (machine_is_mainstone ()) { - ret =sysdev_class_register (&mainstone_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&mainstone_irq_device); - } -return ret; +return 0 ; }device_initcall (mainstone_irq_device_init);
arch/arm/mach-pxa/cm-x2xx.c +7 -16
@@ -10,7 +10,7 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <linux/gpio.h>
@@ -388,7 +388,7 @@ static inline void cmx2xx_init_display(v#ifdef CONFIG_PM static unsigned long sleep_save_msc[10 ]; -static int cmx2xx_suspend (struct sys_device *dev,pm_message_t state) +static int cmx2xx_suspend (void ) {cmx2xx_pci_suspend ();
@@ -412,7 +412,7 @@ static int cmx2xx_suspend(struct sys_devreturn 0 ; } -static int cmx2xx_resume (struct sys_device *dev) +static void cmx2xx_resume (void ) {cmx2xx_pci_resume ();
@@ -420,27 +420,18 @@ static int cmx2xx_resume(struct sys_devi__raw_writel (sleep_save_msc[0 ],MSC0 );__raw_writel (sleep_save_msc[1 ],MSC1 ); __raw_writel(sleep_save_msc[2], MSC2); - - return 0; } -static struct sysdev_class cmx2xx_pm_sysclass = { - .name ="pm" , +static struct syscore_ops cmx2xx_pm_syscore_ops = { .resume = cmx2xx_resume, .suspend = cmx2xx_suspend, }; -static struct sys_device cmx2xx_pm_device = { - .cls = &cmx2xx_pm_sysclass, -}; -static int __init cmx2xx_pm_init (void ) { -int error; - error =sysdev_class_register (&cmx2xx_pm_sysclass); -if (error ==0 ) - error =sysdev_register (&cmx2xx_pm_device); -return error; +register_syscore_ops (&cmx2xx_pm_syscore_ops); + +return 0 ; }#else static int __init cmx2xx_pm_init (void ) {return 0 ; }
arch/arm/mach-pxa/lpd270.c +6 -14
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
@@ -159,30 +159,22 @@ static void __init lpd270_init_irq(void)#ifdef CONFIG_PM -static int lpd270_irq_resume (struct sys_device *dev) +static void lpd270_irq_resume (void ) {__raw_writew (lpd270_irq_enabled,LPD270_INT_MASK ); -return 0 ; } -static struct sysdev_class lpd270_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops lpd270_irq_syscore_ops = { .resume = lpd270_irq_resume, }; -static struct sys_device lpd270_irq_device = { - .cls = &lpd270_irq_sysclass, -}; -static int __init lpd270_irq_device_init (void ) { -int ret = -ENODEV ;if (machine_is_logicpd_pxa270 ()) { - ret =sysdev_class_register (&lpd270_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&lpd270_irq_device); +register_syscore_ops (&lpd270_irq_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (lpd270_irq_device_init);
arch/arm/mach-pxa/lubbock.c +6 -15
@@ -15,7 +15,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/major.h> #include <linux/fb.h> #include <linux/interrupt.h>
@@ -176,31 +176,22 @@ static void __init lubbock_init_irq(void#ifdef CONFIG_PM -static int lubbock_irq_resume (struct sys_device *dev) +static void lubbock_irq_resume (void ) {LUB_IRQ_MASK_EN = lubbock_irq_enabled; -return 0 ; } -static struct sysdev_class lubbock_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops lubbock_irq_syscore_ops = { .resume = lubbock_irq_resume, }; -static struct sys_device lubbock_irq_device = { - .cls = &lubbock_irq_sysclass, -}; -static int __init lubbock_irq_device_init (void ) { -int ret = -ENODEV ; -if (machine_is_lubbock ()) { - ret =sysdev_class_register (&lubbock_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&lubbock_irq_device); +register_syscore_ops (&lubbock_irq_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (lubbock_irq_device_init);
arch/arm/mach-pxa/viper.c +6 -6
@@ -44,6 +44,7 @@#include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> +#include <linux/syscore_ops.h> #include <mach/pxa25x.h> #include <mach/audio.h>
@@ -130,20 +131,19 @@ static u8 viper_hw_version(void)return v1; } -/* CPU sysdev */ -static int viper_cpu_suspend (struct sys_device *sysdev,pm_message_t state) +/* CPU system core operations. */ +static int viper_cpu_suspend (void ) {viper_icr_set_bit (VIPER_ICR_R_DIS );return 0 ; } -static int viper_cpu_resume (struct sys_device *sysdev) +static void viper_cpu_resume (void ) {viper_icr_clear_bit (VIPER_ICR_R_DIS ); -return 0 ; } -static struct sysdev_driver viper_cpu_sysdev_driver = { +static struct syscore_ops viper_cpu_syscore_ops = { .suspend = viper_cpu_suspend, .resume = viper_cpu_resume, };
@@ -945,7 +945,7 @@ static void __init viper_init(void)viper_init_vcore_gpios ();viper_init_cpufreq (); -sysdev_driver_register (&cpu_sysdev_class, &viper_cpu_sysdev_driver); +register_syscore_ops (&viper_cpu_syscore_ops);if (version) { pr_info("viper: hardware v%di%d detected. "
arch/arm/mach-pxa/palmz72.c +8 -16
@@ -19,7 +19,7 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/delay.h> #include <linux/irq.h> #include <linux/gpio_keys.h>
@@ -207,9 +207,9 @@ static struct palmz72_resume_info palmz7static unsigned long store_ptr; -/* sys_device for Palm Zire 72 PM */ +/* syscore_ops for Palm Zire 72 PM */ -static int palmz72_pm_suspend (struct sys_device *dev,pm_message_t msg) +static int palmz72_pm_suspend (void ) {/* setup the resume_info struct for the original bootloader */ palmz72_resume_info.resume_addr = (u32 ) cpu_resume;
@@ -223,31 +223,23 @@ static int palmz72_pm_suspend(struct sysreturn 0 ; } -static int palmz72_pm_resume (struct sys_device *dev) +static void palmz72_pm_resume (void ) { *PALMZ72_SAVE_DWORD = store_ptr; -return 0 ; } -static struct sysdev_class palmz72_pm_sysclass = { - .name ="palmz72_pm" , +static struct syscore_ops palmz72_pm_syscore_ops = { .suspend = palmz72_pm_suspend, .resume = palmz72_pm_resume, }; -static struct sys_device palmz72_pm_device = { - .cls = &palmz72_pm_sysclass, -}; -static int __init palmz72_pm_init (void ) { -int ret = -ENODEV ;if (machine_is_palmz72 ()) { - ret =sysdev_class_register (&palmz72_pm_sysclass); -if (ret ==0 ) - ret =sysdev_register (&palmz72_pm_device); +register_syscore_ops (&palmz72_pm_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (palmz72_pm_init);
arch/arm/mach-pxa/smemc.c +7 -22
@@ -6,7 +6,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/smemc.h>
@@ -16,7 +16,7 @@ static unsigned long msc[2];static unsigned long sxcnfg, memclkcfg;static unsigned long csadrcfg[4 ]; -static int pxa3xx_smemc_suspend (struct sys_device *dev,pm_message_t state) +static int pxa3xx_smemc_suspend (void ) { msc[0 ] =__raw_readl (MSC0 ); msc[1 ] =__raw_readl (MSC1 );
@@ -30,7 +30,7 @@ static int pxa3xx_smemc_suspend(struct sreturn 0 ; } -static int pxa3xx_smemc_resume (struct sys_device *dev) +static void pxa3xx_smemc_resume (void ) {__raw_writel (msc[0 ],MSC0 );__raw_writel (msc[1 ],MSC1 );
@@ -40,34 +40,19 @@ static int pxa3xx_smemc_resume(struct sy__raw_writel (csadrcfg[1 ],CSADRCFG1 );__raw_writel (csadrcfg[2 ],CSADRCFG2 ); __raw_writel(csadrcfg[3], CSADRCFG3); - - return 0; } -static struct sysdev_class smemc_sysclass = { - .name ="smemc" , +static struct syscore_ops smemc_syscore_ops = { .suspend = pxa3xx_smemc_suspend, .resume = pxa3xx_smemc_resume, }; -static struct sys_device smemc_sysdev = { - .id =0 , - .cls = &smemc_sysclass, -}; -static int __init smemc_init (void ) { -int ret =0 ; +if (cpu_is_pxa3xx ()) +register_syscore_ops (&smemc_syscore_ops); -if (cpu_is_pxa3xx ()) { - ret =sysdev_class_register (&smemc_sysclass); -if (ret) -return ret; - - ret =sysdev_register (&smemc_sysdev); - } - -return ret; +return 0 ; }subsys_initcall (smemc_init);#endif
arch/arm/mach-pxa/palmtreo.c +0 -1
@@ -25,7 +25,6 @@#include <linux/pwm_backlight.h> #include <linux/gpio.h> #include <linux/power_supply.h> -#include <linux/sysdev.h> #include <linux/w1-gpio.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/palmld.c +0 -1
@@ -24,7 +24,6 @@#include <linux/gpio.h> #include <linux/wm97xx.h> #include <linux/power_supply.h> -#include <linux/sysdev.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h>
arch/arm/mach-pxa/colibri-pxa270.c +0 -1
@@ -17,7 +17,6 @@#include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/ucb1400.h> #include <asm/mach/arch.h>
arch/arm/mach-pxa/raumfeld.c +0 -1
@@ -18,7 +18,6 @@#include <linux/init.h> #include <linux/kernel.h> -#include <linux/sysdev.h> #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/gpio.h>
arch/arm/mach-pxa/cm-x270.c +0 -1
@@ -10,7 +10,6 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <linux/gpio.h> #include <linux/delay.h>
arch/arm/mach-pxa/trizeps4.c +0 -1
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
arch/arm/mach-pxa/colibri-evalboard.c +0 -1
@@ -13,7 +13,6 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/gpio.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/vpac270.c +0 -1
@@ -16,7 +16,6 @@#include <linux/gpio_keys.h> #include <linux/input.h> #include <linux/gpio.h> -#include <linux/sysdev.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h>
arch/arm/mach-pxa/colibri-pxa270-income.c +0 -1
@@ -22,7 +22,6 @@#include <linux/platform_device.h> #include <linux/pwm_backlight.h> #include <linux/i2c/pxa-i2c.h> -#include <linux/sysdev.h> #include <asm/irq.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/balloon3.c +0 -1
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
arch/arm/plat-pxa/mfp.c +0 -1
@@ -17,7 +17,6 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> #include <plat/mfp.h>
PATCH 5/7 ARM / PXA: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct sys_device objects used for "core" power management by the PXA platform code with struct syscore_ops objects that are simpler.
This reduces the code size and the kernel memory footprint. It also is necessary for removing sysdevs entirely from the kernel in the future.
--- arch/arm/mach-pxa/balloon3.c | 1 arch/arm/mach-pxa/clock-pxa2xx.c | 18 ++---------- arch/arm/mach-pxa/clock-pxa3xx.c | 17 ++--------- arch/arm/mach-pxa/clock.h | 7 ++-- arch/arm/mach-pxa/cm-x270.c | 1 arch/arm/mach-pxa/cm-x2xx.c | 23 ++++------------ arch/arm/mach-pxa/colibri-evalboard.c | 1 arch/arm/mach-pxa/colibri-pxa270-income.c | 1 arch/arm/mach-pxa/colibri-pxa270.c | 1 arch/arm/mach-pxa/generic.h | 8 ++--- arch/arm/mach-pxa/irq.c | 17 ++--------- arch/arm/mach-pxa/lpd270.c | 20 ++++--------- arch/arm/mach-pxa/lubbock.c | 21 ++++---------- arch/arm/mach-pxa/mainstone.c | 22 ++++----------- arch/arm/mach-pxa/mfp-pxa2xx.c | 12 +++----- arch/arm/mach-pxa/mfp-pxa3xx.c | 21 +++----------- arch/arm/mach-pxa/mioa701.c | 43 +++++------------------------- arch/arm/mach-pxa/palmld.c | 1 arch/arm/mach-pxa/palmtreo.c | 1 arch/arm/mach-pxa/palmz72.c | 24 +++++----------- arch/arm/mach-pxa/pxa25x.c | 25 ++++------------- arch/arm/mach-pxa/pxa27x.c | 25 ++++------------- arch/arm/mach-pxa/pxa3xx.c | 25 ++++------------- arch/arm/mach-pxa/pxa95x.c | 20 ++----------- arch/arm/mach-pxa/raumfeld.c | 1 arch/arm/mach-pxa/smemc.c | 29 ++++---------------- arch/arm/mach-pxa/trizeps4.c | 1 arch/arm/mach-pxa/viper.c | 12 ++++---- arch/arm/mach-pxa/vpac270.c | 1 arch/arm/plat-pxa/gpio.c | 17 ++--------- arch/arm/plat-pxa/mfp.c | 1 31 files changed, 110 insertions(+), 307 deletions(-)
arch/arm/plat-pxa/gpio.c +4 -13
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/slab.h> #include <mach/gpio.h>
@@ -295,7 +295,7 @@ void __init pxa_init_gpio(int mux_irq, i }#ifdef CONFIG_PM -static int pxa_gpio_suspend (struct sys_device *dev,pm_message_t state) +static int pxa_gpio_suspend (void ) {struct pxa_gpio_chip *c;int gpio;
@@ -312,7 +312,7 @@ static int pxa_gpio_suspend(struct sys_dreturn 0 ; } -static int pxa_gpio_resume (struct sys_device *dev) +static void pxa_gpio_resume (void ) {struct pxa_gpio_chip *c;int gpio;
@@ -326,22 +326,13 @@ static int pxa_gpio_resume(struct sys_de__raw_writel (c->saved_gfer, c->regbase +GFER_OFFSET ); __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET); } -return 0 ; }#else #define pxa_gpio_suspend NULL#define pxa_gpio_resume NULL#endif -struct sysdev_class pxa_gpio_sysclass = { - .name ="gpio" , +struct syscore_ops pxa_gpio_syscore_ops = { .suspend = pxa_gpio_suspend, .resume = pxa_gpio_resume, }; - -static int __init pxa_gpio_init (void ) -{ -return sysdev_class_register (&pxa_gpio_sysclass); -} - -core_initcall (pxa_gpio_init);
arch/arm/mach-pxa/generic.h +4 -4
@@ -61,10 +61,10 @@ extern unsigned pxa3xx_get_clk_frequency#define pxa3xx_get_clk_frequency_khz (x) (0)#endif -extern struct sysdev_class pxa_irq_sysclass; -extern struct sysdev_class pxa_gpio_sysclass; -extern struct sysdev_class pxa2xx_mfp_sysclass; -extern struct sysdev_class pxa3xx_mfp_sysclass; +extern struct syscore_ops pxa_irq_syscore_ops; +extern struct syscore_ops pxa_gpio_syscore_ops; +extern struct syscore_ops pxa2xx_mfp_syscore_ops; +extern struct syscore_ops pxa3xx_mfp_syscore_ops;void __init pxa_set_ffuart_info (void *info);void __init pxa_set_btuart_info (void *info);
arch/arm/mach-pxa/pxa95x.c +4 -16
@@ -18,7 +18,7 @@#include <linux/i2c/pxa-i2c.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/gpio.h>
@@ -260,16 +260,6 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa95x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa3xx_clock_sysclass, - } -}; -static int __init pxa95x_init (void ) {int ret =0 , i;
@@ -293,11 +283,9 @@ static int __init pxa95x_init(void)if ((ret =pxa_init_dma (IRQ_DMA ,32 )))return ret; -for (i =0 ; i <ARRAY_SIZE (pxa95x_sysdev); i++) { - ret =sysdev_register (&pxa95x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa3xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/clock-pxa3xx.c +4 -13
@@ -10,6 +10,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/syscore_ops.h> #include <mach/smemc.h> #include <mach/pxa3xx-regs.h>
@@ -182,7 +183,7 @@ const struct clkops clk_pxa3xx_pout_opsstatic uint32_t cken[2 ];static uint32_t accr; -static int pxa3xx_clock_suspend (struct sys_device *d,pm_message_t state) +static int pxa3xx_clock_suspend (void ) { cken[0 ] =CKENA ; cken[1 ] =CKENB ;
@@ -190,28 +191,18 @@ static int pxa3xx_clock_suspend(struct s return 0; } -static int pxa3xx_clock_resume (struct sys_device *d) +static void pxa3xx_clock_resume (void ) {ACCR = accr;CKENA = cken[0 ];CKENB = cken[1 ]; -return 0 ; }#else #define pxa3xx_clock_suspend NULL#define pxa3xx_clock_resume NULL#endif -struct sysdev_class pxa3xx_clock_sysclass = { - .name ="pxa3xx-clock" , +struct syscore_ops pxa3xx_clock_syscore_ops = { .suspend = pxa3xx_clock_suspend, .resume = pxa3xx_clock_resume, }; - -static int __init pxa3xx_clock_init (void ) -{ -if (cpu_is_pxa3xx () ||cpu_is_pxa95x ()) -return sysdev_class_register (&pxa3xx_clock_sysclass); -return 0 ; -} -postcore_initcall (pxa3xx_clock_init);
arch/arm/mach-pxa/clock.h +4 -3
@@ -1,5 +1,5 @@#include <linux/clkdev.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> struct clkops {void (*enable)(struct clk *);
@@ -54,7 +54,7 @@ extern const struct clkops clk_pxa2xx_ckvoid clk_pxa2xx_cken_enable (struct clk *clk);void clk_pxa2xx_cken_disable (struct clk *clk); -extern struct sysdev_class pxa2xx_clock_sysclass; +extern struct syscore_ops pxa2xx_clock_syscore_ops;#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)#define DEFINE_PXA3_CKEN (_name, _cken, _rate, _delay) \
@@ -74,5 +74,6 @@ extern const struct clkops clk_pxa3xx_smextern void clk_pxa3xx_cken_enable (struct clk *);extern void clk_pxa3xx_cken_disable (struct clk *); -extern struct sysdev_class pxa3xx_clock_sysclass; +extern struct syscore_ops pxa3xx_clock_syscore_ops; +#endif
arch/arm/mach-pxa/irq.c +4 -13
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <linux/irq.h>
@@ -183,7 +183,7 @@ void __init pxa_init_irq(int irq_nr, setstatic unsigned long saved_icmr[MAX_INTERNAL_IRQS /32 ];static unsigned long saved_ipr[MAX_INTERNAL_IRQS ]; -static int pxa_irq_suspend (struct sys_device *dev,pm_message_t state) +static int pxa_irq_suspend (void ) {int i;
@@ -202,7 +202,7 @@ static int pxa_irq_suspend(struct sys_dereturn 0 ; } -static int pxa_irq_resume (struct sys_device *dev) +static void pxa_irq_resume (void ) {int i;
@@ -218,22 +218,13 @@ static int pxa_irq_resume(struct sys_dev__raw_writel (saved_ipr[i],IRQ_BASE +IPR (i)); __raw_writel(1, IRQ_BASE + ICCR); - return 0; }#else #define pxa_irq_suspend NULL#define pxa_irq_resume NULL#endif -struct sysdev_class pxa_irq_sysclass = { - .name ="irq" , +struct syscore_ops pxa_irq_syscore_ops = { .suspend = pxa_irq_suspend, .resume = pxa_irq_resume, }; - -static int __init pxa_irq_init (void ) -{ -return sysdev_class_register (&pxa_irq_sysclass); -} - -core_initcall (pxa_irq_init);
arch/arm/mach-pxa/clock-pxa2xx.c +4 -14
@@ -9,7 +9,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/pxa2xx-regs.h>
@@ -33,32 +33,22 @@ const struct clkops clk_pxa2xx_cken_ops#ifdef CONFIG_PM static uint32_t saved_cken; -static int pxa2xx_clock_suspend (struct sys_device *d,pm_message_t state) +static int pxa2xx_clock_suspend (void ) { saved_cken =CKEN ;return 0 ; } -static int pxa2xx_clock_resume (struct sys_device *d) +static void pxa2xx_clock_resume (void ) {CKEN = saved_cken; -return 0 ; }#else #define pxa2xx_clock_suspend NULL#define pxa2xx_clock_resume NULL#endif -struct sysdev_class pxa2xx_clock_sysclass = { - .name ="pxa2xx-clock" , +struct syscore_ops pxa2xx_clock_syscore_ops = { .suspend = pxa2xx_clock_suspend, .resume = pxa2xx_clock_resume, }; - -static int __init pxa2xx_clock_init (void ) -{ -if (cpu_is_pxa2xx ()) -return sysdev_class_register (&pxa2xx_clock_sysclass); -return 0 ; -} -postcore_initcall (pxa2xx_clock_init);
arch/arm/mach-pxa/mfp-pxa3xx.c +5 -16
@@ -17,7 +17,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/mfp-pxa3xx.h>
@@ -31,13 +31,13 @@* a pull-down mode if they're an active low chip select, and we're * just entering standby. */ -static int pxa3xx_mfp_suspend (struct sys_device *d,pm_message_t state) +static int pxa3xx_mfp_suspend (void ) {mfp_config_lpm ();return 0 ; } -static int pxa3xx_mfp_resume (struct sys_device *d) +static void pxa3xx_mfp_resume (void ) {mfp_config_run ();
@@ -47,24 +47,13 @@ static int pxa3xx_mfp_resume(struct sys_* preserve them here in case they will be referenced later */ ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); - return 0; }#else #define pxa3xx_mfp_suspend NULL#define pxa3xx_mfp_resume NULL#endif -struct sysdev_class pxa3xx_mfp_sysclass = { - .name ="mfp" , +struct syscore_ops pxa3xx_mfp_syscore_ops = { .suspend = pxa3xx_mfp_suspend, - .resume = pxa3xx_mfp_resume, + .resume = pxa3xx_mfp_resume, }; - -static int __init mfp_init_devicefs (void ) -{ -if (cpu_is_pxa3xx ()) -return sysdev_class_register (&pxa3xx_mfp_sysclass); - -return 0 ; -} -postcore_initcall (mfp_init_devicefs);
arch/arm/mach-pxa/pxa3xx.c +6 -19
@@ -20,7 +20,7 @@#include <linux/platform_device.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/i2c/pxa-i2c.h> #include <asm/mach/map.h>
@@ -427,21 +427,9 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa3xx_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa3xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa3xx_clock_sysclass, - } -}; -static int __init pxa3xx_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa3xx ()) {
@@ -462,11 +450,10 @@ static int __init pxa3xx_init(void)pxa3xx_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa3xx_sysdev); i++) { - ret =sysdev_register (&pxa3xx_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa3xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa3xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/mfp-pxa2xx.c +5 -7
@@ -16,7 +16,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/gpio.h> #include <mach/pxa2xx-regs.h>
@@ -338,7 +338,7 @@ static unsigned long saved_gafr[2][4];static unsigned long saved_gpdr[4 ];static unsigned long saved_pgsr[4 ]; -static int pxa2xx_mfp_suspend (struct sys_device *d,pm_message_t state) +static int pxa2xx_mfp_suspend (void ) {int i;
@@ -365,7 +365,7 @@ static int pxa2xx_mfp_suspend(struct sysreturn 0 ; } -static int pxa2xx_mfp_resume (struct sys_device *d) +static void pxa2xx_mfp_resume (void ) {int i;
@@ -376,15 +376,13 @@ static int pxa2xx_mfp_resume(struct sys_ PGSR(i) = saved_pgsr[i]; }PSSR =PSSR_RDH |PSSR_PH ; -return 0 ; }#else #define pxa2xx_mfp_suspend NULL#define pxa2xx_mfp_resume NULL#endif -struct sysdev_class pxa2xx_mfp_sysclass = { - .name ="mfp" , +struct syscore_ops pxa2xx_mfp_syscore_ops = { .suspend = pxa2xx_mfp_suspend, .resume = pxa2xx_mfp_resume, };
@@ -409,6 +407,6 @@ static int __init pxa2xx_mfp_init(void)for (i =0 ; i <=gpio_to_bank (pxa_last_gpio); i++) gpdr_lpm[i] =GPDR (i *32 ); -return sysdev_class_register (&pxa2xx_mfp_sysclass); +return 0 ; }postcore_initcall (pxa2xx_mfp_init);
arch/arm/mach-pxa/pxa25x.c +6 -19
@@ -21,7 +21,7 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/suspend.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <asm/mach/map.h>
@@ -350,21 +350,9 @@ static struct platform_device *pxa25x_de &pxa_device_asoc_platform, }; -static struct sys_device pxa25x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa2xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa2xx_clock_sysclass, - } -}; -static int __init pxa25x_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa25x ()) {
@@ -377,11 +365,10 @@ static int __init pxa25x_init(void)pxa25x_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa25x_sysdev); i++) { - ret =sysdev_register (&pxa25x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa2xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa2xx_clock_syscore_ops); ret =platform_add_devices (pxa25x_devices,ARRAY_SIZE (pxa25x_devices));
arch/arm/mach-pxa/pxa27x.c +6 -19
@@ -16,7 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <linux/irq.h> #include <linux/i2c/pxa-i2c.h>
@@ -428,21 +428,9 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa27x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa2xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa2xx_clock_sysclass, - } -}; -static int __init pxa27x_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa27x ()) {
@@ -455,11 +443,10 @@ static int __init pxa27x_init(void)pxa27x_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa27x_sysdev); i++) { - ret =sysdev_register (&pxa27x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa2xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa2xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/mioa701.c +8 -35
81 lines not on this page · raw message
arch/arm/mach-pxa/mainstone.c +6 -16
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
@@ -185,31 +185,21 @@ static void __init mainstone_init_irq(vo#ifdef CONFIG_PM -static int mainstone_irq_resume (struct sys_device *dev) +static void mainstone_irq_resume (void ) {MST_INTMSKENA = mainstone_irq_enabled; -return 0 ; } -static struct sysdev_class mainstone_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops mainstone_irq_syscore_ops = { .resume = mainstone_irq_resume, }; -static struct sys_device mainstone_irq_device = { - .cls = &mainstone_irq_sysclass, -}; -static int __init mainstone_irq_device_init (void ) { -int ret = -ENODEV ; +if (machine_is_mainstone ()) +register_syscore_ops (&mainstone_irq_syscore_ops); -if (machine_is_mainstone ()) { - ret =sysdev_class_register (&mainstone_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&mainstone_irq_device); - } -return ret; +return 0 ; }device_initcall (mainstone_irq_device_init);
arch/arm/mach-pxa/cm-x2xx.c +7 -16
@@ -10,7 +10,7 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <linux/gpio.h>
@@ -388,7 +388,7 @@ static inline void cmx2xx_init_display(v#ifdef CONFIG_PM static unsigned long sleep_save_msc[10 ]; -static int cmx2xx_suspend (struct sys_device *dev,pm_message_t state) +static int cmx2xx_suspend (void ) {cmx2xx_pci_suspend ();
@@ -412,7 +412,7 @@ static int cmx2xx_suspend(struct sys_devreturn 0 ; } -static int cmx2xx_resume (struct sys_device *dev) +static void cmx2xx_resume (void ) {cmx2xx_pci_resume ();
@@ -420,27 +420,18 @@ static int cmx2xx_resume(struct sys_devi__raw_writel (sleep_save_msc[0 ],MSC0 );__raw_writel (sleep_save_msc[1 ],MSC1 ); __raw_writel(sleep_save_msc[2], MSC2); - - return 0; } -static struct sysdev_class cmx2xx_pm_sysclass = { - .name ="pm" , +static struct syscore_ops cmx2xx_pm_syscore_ops = { .resume = cmx2xx_resume, .suspend = cmx2xx_suspend, }; -static struct sys_device cmx2xx_pm_device = { - .cls = &cmx2xx_pm_sysclass, -}; -static int __init cmx2xx_pm_init (void ) { -int error; - error =sysdev_class_register (&cmx2xx_pm_sysclass); -if (error ==0 ) - error =sysdev_register (&cmx2xx_pm_device); -return error; +register_syscore_ops (&cmx2xx_pm_syscore_ops); + +return 0 ; }#else static int __init cmx2xx_pm_init (void ) {return 0 ; }
arch/arm/mach-pxa/lpd270.c +6 -14
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
@@ -159,30 +159,22 @@ static void __init lpd270_init_irq(void)#ifdef CONFIG_PM -static int lpd270_irq_resume (struct sys_device *dev) +static void lpd270_irq_resume (void ) {__raw_writew (lpd270_irq_enabled,LPD270_INT_MASK ); -return 0 ; } -static struct sysdev_class lpd270_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops lpd270_irq_syscore_ops = { .resume = lpd270_irq_resume, }; -static struct sys_device lpd270_irq_device = { - .cls = &lpd270_irq_sysclass, -}; -static int __init lpd270_irq_device_init (void ) { -int ret = -ENODEV ;if (machine_is_logicpd_pxa270 ()) { - ret =sysdev_class_register (&lpd270_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&lpd270_irq_device); +register_syscore_ops (&lpd270_irq_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (lpd270_irq_device_init);
arch/arm/mach-pxa/lubbock.c +6 -15
@@ -15,7 +15,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/major.h> #include <linux/fb.h> #include <linux/interrupt.h>
@@ -176,31 +176,22 @@ static void __init lubbock_init_irq(void#ifdef CONFIG_PM -static int lubbock_irq_resume (struct sys_device *dev) +static void lubbock_irq_resume (void ) {LUB_IRQ_MASK_EN = lubbock_irq_enabled; -return 0 ; } -static struct sysdev_class lubbock_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops lubbock_irq_syscore_ops = { .resume = lubbock_irq_resume, }; -static struct sys_device lubbock_irq_device = { - .cls = &lubbock_irq_sysclass, -}; -static int __init lubbock_irq_device_init (void ) { -int ret = -ENODEV ; -if (machine_is_lubbock ()) { - ret =sysdev_class_register (&lubbock_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&lubbock_irq_device); +register_syscore_ops (&lubbock_irq_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (lubbock_irq_device_init);
arch/arm/mach-pxa/viper.c +6 -6
@@ -44,6 +44,7 @@#include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> +#include <linux/syscore_ops.h> #include <mach/pxa25x.h> #include <mach/audio.h>
@@ -130,20 +131,19 @@ static u8 viper_hw_version(void)return v1; } -/* CPU sysdev */ -static int viper_cpu_suspend (struct sys_device *sysdev,pm_message_t state) +/* CPU system core operations. */ +static int viper_cpu_suspend (void ) {viper_icr_set_bit (VIPER_ICR_R_DIS );return 0 ; } -static int viper_cpu_resume (struct sys_device *sysdev) +static void viper_cpu_resume (void ) {viper_icr_clear_bit (VIPER_ICR_R_DIS ); -return 0 ; } -static struct sysdev_driver viper_cpu_sysdev_driver = { +static struct syscore_ops viper_cpu_syscore_ops = { .suspend = viper_cpu_suspend, .resume = viper_cpu_resume, };
@@ -945,7 +945,7 @@ static void __init viper_init(void)viper_init_vcore_gpios ();viper_init_cpufreq (); -sysdev_driver_register (&cpu_sysdev_class, &viper_cpu_sysdev_driver); +register_syscore_ops (&viper_cpu_syscore_ops);if (version) { pr_info("viper: hardware v%di%d detected. "
arch/arm/mach-pxa/palmz72.c +8 -16
@@ -19,7 +19,7 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/delay.h> #include <linux/irq.h> #include <linux/gpio_keys.h>
@@ -207,9 +207,9 @@ static struct palmz72_resume_info palmz7static unsigned long store_ptr; -/* sys_device for Palm Zire 72 PM */ +/* syscore_ops for Palm Zire 72 PM */ -static int palmz72_pm_suspend (struct sys_device *dev,pm_message_t msg) +static int palmz72_pm_suspend (void ) {/* setup the resume_info struct for the original bootloader */ palmz72_resume_info.resume_addr = (u32 ) cpu_resume;
@@ -223,31 +223,23 @@ static int palmz72_pm_suspend(struct sysreturn 0 ; } -static int palmz72_pm_resume (struct sys_device *dev) +static void palmz72_pm_resume (void ) { *PALMZ72_SAVE_DWORD = store_ptr; -return 0 ; } -static struct sysdev_class palmz72_pm_sysclass = { - .name ="palmz72_pm" , +static struct syscore_ops palmz72_pm_syscore_ops = { .suspend = palmz72_pm_suspend, .resume = palmz72_pm_resume, }; -static struct sys_device palmz72_pm_device = { - .cls = &palmz72_pm_sysclass, -}; -static int __init palmz72_pm_init (void ) { -int ret = -ENODEV ;if (machine_is_palmz72 ()) { - ret =sysdev_class_register (&palmz72_pm_sysclass); -if (ret ==0 ) - ret =sysdev_register (&palmz72_pm_device); +register_syscore_ops (&palmz72_pm_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (palmz72_pm_init);
arch/arm/mach-pxa/smemc.c +7 -22
@@ -6,7 +6,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/smemc.h>
@@ -16,7 +16,7 @@ static unsigned long msc[2];static unsigned long sxcnfg, memclkcfg;static unsigned long csadrcfg[4 ]; -static int pxa3xx_smemc_suspend (struct sys_device *dev,pm_message_t state) +static int pxa3xx_smemc_suspend (void ) { msc[0 ] =__raw_readl (MSC0 ); msc[1 ] =__raw_readl (MSC1 );
@@ -30,7 +30,7 @@ static int pxa3xx_smemc_suspend(struct sreturn 0 ; } -static int pxa3xx_smemc_resume (struct sys_device *dev) +static void pxa3xx_smemc_resume (void ) {__raw_writel (msc[0 ],MSC0 );__raw_writel (msc[1 ],MSC1 );
@@ -40,34 +40,19 @@ static int pxa3xx_smemc_resume(struct sy__raw_writel (csadrcfg[1 ],CSADRCFG1 );__raw_writel (csadrcfg[2 ],CSADRCFG2 ); __raw_writel(csadrcfg[3], CSADRCFG3); - - return 0; } -static struct sysdev_class smemc_sysclass = { - .name ="smemc" , +static struct syscore_ops smemc_syscore_ops = { .suspend = pxa3xx_smemc_suspend, .resume = pxa3xx_smemc_resume, }; -static struct sys_device smemc_sysdev = { - .id =0 , - .cls = &smemc_sysclass, -}; -static int __init smemc_init (void ) { -int ret =0 ; +if (cpu_is_pxa3xx ()) +register_syscore_ops (&smemc_syscore_ops); -if (cpu_is_pxa3xx ()) { - ret =sysdev_class_register (&smemc_sysclass); -if (ret) -return ret; - - ret =sysdev_register (&smemc_sysdev); - } - -return ret; +return 0 ; }subsys_initcall (smemc_init);#endif
arch/arm/mach-pxa/palmtreo.c +0 -1
@@ -25,7 +25,6 @@#include <linux/pwm_backlight.h> #include <linux/gpio.h> #include <linux/power_supply.h> -#include <linux/sysdev.h> #include <linux/w1-gpio.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/palmld.c +0 -1
@@ -24,7 +24,6 @@#include <linux/gpio.h> #include <linux/wm97xx.h> #include <linux/power_supply.h> -#include <linux/sysdev.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h>
arch/arm/mach-pxa/colibri-pxa270.c +0 -1
@@ -17,7 +17,6 @@#include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/ucb1400.h> #include <asm/mach/arch.h>
arch/arm/mach-pxa/raumfeld.c +0 -1
@@ -18,7 +18,6 @@#include <linux/init.h> #include <linux/kernel.h> -#include <linux/sysdev.h> #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/gpio.h>
arch/arm/mach-pxa/cm-x270.c +0 -1
@@ -10,7 +10,6 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <linux/gpio.h> #include <linux/delay.h>
arch/arm/mach-pxa/trizeps4.c +0 -1
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
arch/arm/mach-pxa/colibri-evalboard.c +0 -1
@@ -13,7 +13,6 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/gpio.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/vpac270.c +0 -1
@@ -16,7 +16,6 @@#include <linux/gpio_keys.h> #include <linux/input.h> #include <linux/gpio.h> -#include <linux/sysdev.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h>
arch/arm/mach-pxa/colibri-pxa270-income.c +0 -1
@@ -22,7 +22,6 @@#include <linux/platform_device.h> #include <linux/pwm_backlight.h> #include <linux/i2c/pxa-i2c.h> -#include <linux/sysdev.h> #include <asm/irq.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/balloon3.c +0 -1
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
arch/arm/plat-pxa/mfp.c +0 -1
@@ -17,7 +17,6 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> #include <plat/mfp.h>
PATCH 6/7 ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 + arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62 ++++++++++++++-------------- arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68 +++++++++++-------------------- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)
arch/arm/plat-samsung/include/plat/pm.h +4 -2
@@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struc#ifdef CONFIG_PM extern int s3c_irqext_wake (struct irq_data *data,unsigned int state); -extern int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state); -extern int s3c24xx_irq_resume (struct sys_device *dev); +extern int s3c24xx_irq_suspend (void ); +extern void s3c24xx_irq_resume (void );#else #define s3c_irqext_wake NULL#define s3c24xx_irq_suspend NULL#define s3c24xx_irq_resume NULL#endif +extern struct syscore_ops s3c24xx_irq_syscore_ops; +/* PM debug functions */ #ifdef CONFIG_SAMSUNG_PM_DEBUG
arch/arm/plat-s5p/irq-pm.c +2 -5
@@ -16,7 +16,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <plat/cpu.h> #include <plat/irqs.h>
@@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = { SAVE_ITEM(S5P_EINT_MASK(3)), }; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {s3c_pm_do_save (eint_save,ARRAY_SIZE (eint_save));return 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {s3c_pm_do_restore (eint_save,ARRAY_SIZE (eint_save)); - -return 0 ; }
arch/arm/plat-s3c24xx/irq-pm.c +2 -5
@@ -14,7 +14,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <plat/cpu.h>
@@ -65,7 +64,7 @@ static unsigned long save_extint[3];static unsigned long save_eintflt[4 ];static unsigned long save_eintmask; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {unsigned int i;
@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_devicreturn 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {unsigned int i;
@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_devices3c_pm_do_restore (irq_save,ARRAY_SIZE (irq_save));__raw_writel (save_eintmask,S3C24XX_EINTMASK ); - -return 0 ; }
arch/arm/mach-s3c2410/irq.c +2 -28
@@ -23,38 +23,12 @@#include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <plat/cpu.h> #include <plat/pm.h> -static int s3c2410_irq_add (struct sys_device *sysdev) -{ -return 0 ; -} - -static struct sysdev_driver s3c2410_irq_driver = { - .add = s3c2410_irq_add, +struct syscore_ops s3c24xx_irq_syscore_ops = { .suspend = s3c24xx_irq_suspend, .resume = s3c24xx_irq_resume, }; - -static int __init s3c2410_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410_sysclass, &s3c2410_irq_driver); -} - -arch_initcall (s3c2410_irq_init); - -static struct sysdev_driver s3c2410a_irq_driver = { - .add = s3c2410_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, -}; - -static int __init s3c2410a_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410a_sysclass, &s3c2410a_irq_driver); -} - -arch_initcall (s3c2410a_irq_init);
arch/arm/mach-s3c2410/pm.c +6 -7
@@ -25,6 +25,7 @@#include <linux/errno.h> #include <linux/time.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/io.h>
@@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void) } } -static int s3c2410_pm_resume (struct sys_device *dev) +static void s3c2410_pm_resume (void ) {unsigned long tmp;
@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_if (machine_is_aml_m5900 () )s3c2410_gpio_setpin (S3C2410_GPF (2 ),0 ); - -return 0 ; } +struct syscore_ops s3c2410_pm_syscore_ops = { + .resume = s3c2410_pm_resume, +}; +static int s3c2410_pm_add (struct sys_device *dev) { pm_cpu_prep = s3c2410_pm_prepare;
@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_dev#if defined(CONFIG_CPU_S3C2410 )static struct sysdev_driver s3c2410_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };/* register ourselves */
@@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);static struct sysdev_driver s3c2410a_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2410a_pm_drvinit (void )
@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);#if defined(CONFIG_CPU_S3C2440 )static struct sysdev_driver s3c2440_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2440_pm_drvinit (void )
@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);#if defined(CONFIG_CPU_S3C2442 )static struct sysdev_driver s3c2442_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2442_pm_drvinit (void )
arch/arm/plat-samsung/include/plat/cpu.h +6 -0
@@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *struct sys_timer ;extern struct sys_timer s3c24xx_timer; +extern struct syscore_ops s3c2410_pm_syscore_ops; +extern struct syscore_ops s3c2412_pm_syscore_ops; +extern struct syscore_ops s3c2416_pm_syscore_ops; +extern struct syscore_ops s3c244x_pm_syscore_ops; +extern struct syscore_ops s3c64xx_irq_syscore_ops; +/* system device classes */ extern struct sysdev_class s3c2410_sysclass;
arch/arm/mach-s3c2410/s3c2410.c +5 -0
@@ -19,6 +19,7 @@#include <linux/gpio.h> #include <linux/clk.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -40,6 +41,7 @@#include <plat/devs.h> #include <plat/clock.h> #include <plat/pll.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -168,6 +170,9 @@ int __init s3c2410_init(void) {printk ("S3C2410: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2410_sysdev); }
arch/arm/mach-s3c2412/irq.c +0 -2
@@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_destatic struct sysdev_driver s3c2412_irq_driver = { .add = s3c2412_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2412_irq_init (void )
arch/arm/mach-s3c2412/pm.c +15 -12
@@ -17,6 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] SAVE_ITEM(S3C2413_GPJSLPCON), }; -static int s3c2412_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2412_pm_driver = { + .add = s3c2412_pm_add, +}; + +static __init int s3c2412_pm_init (void ) +{ +return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); +} + +arch_initcall (s3c2412_pm_init); + +static int s3c2412_pm_suspend (void ) {s3c_pm_do_save (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep));return 0 ; } -static int s3c2412_pm_resume (struct sys_device *dev) +static void s3c2412_pm_resume (void ) {unsigned long tmp;
@@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys___raw_writel (tmp,S3C2412_PWRCFG );s3c_pm_do_restore (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep)); -return 0 ; } -static struct sysdev_driver s3c2412_pm_driver = { - .add = s3c2412_pm_add, +struct syscore_ops s3c2412_pm_syscore_ops = { .suspend = s3c2412_pm_suspend, .resume = s3c2412_pm_resume, }; - -static __init int s3c2412_pm_init (void ) -{ -return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); -} - -arch_initcall (s3c2412_pm_init);
arch/arm/mach-s3c2412/s3c2412.c +4 -0
@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -244,5 +245,8 @@ int __init s3c2412_init(void) {printk ("S3C2412: Initialising architecture\n" ); +register_syscore_ops (&s3c2412_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2412_sysdev); }
arch/arm/mach-s3c2416/irq.c +0 -2
@@ -238,8 +238,6 @@ static int __init s3c2416_irq_add(structstatic struct sysdev_driver s3c2416_irq_driver = { .add = s3c2416_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int __init s3c2416_irq_init (void )
arch/arm/mach-s3c2416/pm.c +12 -15
@@ -11,6 +11,7 @@*/ #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h>
@@ -55,30 +56,26 @@ static int s3c2416_pm_add(struct sys_devreturn 0 ; } -static int s3c2416_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2416_pm_driver = { + .add = s3c2416_pm_add, +}; + +static __init int s3c2416_pm_init (void ) { -return 0 ; +return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); } -static int s3c2416_pm_resume (struct sys_device *dev) +arch_initcall (s3c2416_pm_init); + + +static void s3c2416_pm_resume (void ) {/* unset the return-from-sleep amd inform flags */ __raw_writel (0x0 ,S3C2443_PWRMODE );__raw_writel (0x0 ,S3C2412_INFORM0 );__raw_writel (0x0 ,S3C2412_INFORM1 ); - -return 0 ; } -static struct sysdev_driver s3c2416_pm_driver = { - .add = s3c2416_pm_add, - .suspend = s3c2416_pm_suspend, +struct syscore_ops s3c2416_pm_syscore_ops = { .resume = s3c2416_pm_resume, }; - -static __init int s3c2416_pm_init (void ) -{ -return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); -} - -arch_initcall (s3c2416_pm_init);
arch/arm/mach-s3c2416/s3c2416.c +5 -0
@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h>
@@ -54,6 +55,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/sdhci.h> +#include <plat/pm.h> #include <plat/iic-core.h> #include <plat/fb-core.h>
@@ -95,6 +97,9 @@ int __init s3c2416_init(void)s3c_fb_setname ("s3c2443-fb" ); +register_syscore_ops (&s3c2416_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2416_sysdev); }
arch/arm/mach-s3c2440/s3c244x-irq.c +0 -4
@@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_destatic struct sysdev_driver s3c2440_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2440_irq_init (void )
@@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);static struct sysdev_driver s3c2442_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };
arch/arm/mach-s3c2440/s3c244x.c +31 -31
85 lines not on this page · raw message
arch/arm/mach-s3c2440/s3c2440.c +8 -0
@@ -19,6 +19,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h>
@@ -33,6 +34,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -51,6 +53,12 @@ int __init s3c2440_init(void) s3c_device_wdt.resource[1 ].start =IRQ_S3C2440_WDT ; s3c_device_wdt.resource[1 ].end =IRQ_S3C2440_WDT ; +/* register suspend/resume handlers */ + +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +/* register our system device for everything else */ return sysdev_register (&s3c2440_sysdev);
arch/arm/mach-s3c2440/s3c2442.c +6 -0
@@ -29,6 +29,7 @@#include <linux/err.h> #include <linux/device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/mutex.h>
@@ -45,6 +46,7 @@#include <plat/clock.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -167,6 +169,10 @@ int __init s3c2442_init(void) {printk ("S3C2442: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2442_sysdev); }
arch/arm/mach-s3c64xx/irq-pm.c +9 -9
@@ -13,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/serial_core.h> #include <linux/irq.h>
@@ -54,7 +54,7 @@ static struct irq_grp_save {static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS ]; -static int s3c64xx_irq_pm_suspend (struct sys_device *dev,pm_message_t state) +static int s3c64xx_irq_pm_suspend (void ) {struct irq_grp_save *grp = eint_grp_save;int i;
@@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(structreturn 0 ; } -static int s3c64xx_irq_pm_resume (struct sys_device *dev) +static void s3c64xx_irq_pm_resume (void ) {struct irq_grp_save *grp = eint_grp_save;int i;
@@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct }S3C_PMDBG ("%s: IRQ configuration restored\n" , __func__); -return 0 ; } -static struct sysdev_driver s3c64xx_irq_driver = { +struct syscore_ops s3c64xx_irq_syscore_ops = { .suspend = s3c64xx_irq_pm_suspend, .resume = s3c64xx_irq_pm_resume, }; -static int __init s3c64xx_irq_pm_init (void ) +static __init int s3c64xx_syscore_init (void ) { -return sysdev_driver_register (&s3c64xx_sysclass, &s3c64xx_irq_driver); -} +register_syscore_ops (&s3c64xx_irq_syscore_ops); -arch_initcall (s3c64xx_irq_pm_init); +return 0 ; +} +core_initcall (s3c64xx_syscore_init);
arch/arm/mach-s5pv210/pm.c +17 -8
@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <plat/cpu.h>
@@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_devreturn 0 ; } -static int s5pv210_pm_resume (struct sys_device *dev) +static struct sysdev_driver s5pv210_pm_driver = { + .add = s5pv210_pm_add, +}; + +static __init int s5pv210_pm_drvinit (void ) +{ +return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +} +arch_initcall (s5pv210_pm_drvinit); + +static void s5pv210_pm_resume (void ) {u32 tmp;
@@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys___raw_writel (tmp ,S5P_OTHERS );s3c_pm_do_restore_core (s5pv210_core_save,ARRAY_SIZE (s5pv210_core_save)); - -return 0 ; } -static struct sysdev_driver s5pv210_pm_driver = { - .add = s5pv210_pm_add, +static struct syscore_ops s5pv210_pm_syscore_ops = { .resume = s5pv210_pm_resume, }; -static __init int s5pv210_pm_drvinit (void ) +static __init int s5pv210_pm_syscore_init (void ) { -return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +register_syscore_ops (&s5pv210_pm_syscore_ops); +return 0 ; } -arch_initcall (s5pv210_pm_drvinit); +arch_initcall (s5pv210_pm_syscore_init);
arch/arm/mach-exynos4/pm.c +27 -18
67 lines not on this page · raw message
arch/arm/mach-s3c2410/mach-bast.c +5 -12
@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/dm9000.h>
@@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartc/* NAND Flash on BAST board */ #ifdef CONFIG_PM -static int bast_pm_suspend (struct sys_device *sd,pm_message_t state) +static int bast_pm_suspend (void ) {/* ensure that an nRESET is not generated on resume. */ gpio_direction_output (S3C2410_GPA (21 ),1 );return 0 ; } -static int bast_pm_resume (struct sys_device *sd) +static void bast_pm_resume (void ) {s3c_gpio_cfgpin (S3C2410_GPA (21 ), S3C2410_GPA21_nRSTOUT); -return 0 ; }#else
@@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_dev#define bast_pm_resume NULL#endif -static struct sysdev_class bast_pm_sysclass = { - .name ="mach-bast" , +static struct syscore_ops bast_pm_syscore_ops = { .suspend = bast_pm_suspend, .resume = bast_pm_resume, }; -static struct sys_device bast_pm_sysdev = { - .cls = &bast_pm_sysclass, -}; -static int smartmedia_map[] = {0 };static int chip0_map[] = {1 };static int chip1_map[] = {2 };
@@ -642,8 +636,7 @@ static void __init bast_map_io(void)static void __init bast_init (void ) { -sysdev_class_register (&bast_pm_sysclass); -sysdev_register (&bast_pm_sysdev); +register_syscore_ops (&bast_pm_syscore_ops);s3c_i2c0_set_platdata (&bast_i2c_info);s3c_nand_set_platdata (&bast_nand_info);
arch/arm/plat-s3c24xx/dma.c +26 -42
117 lines not on this page · raw message
arch/arm/mach-s3c2440/mach-osiris.c +5 -13
@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/gpio.h> #include <linux/device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/clk.h> #include <linux/i2c.h>
@@ -284,7 +284,7 @@ static struct platform_device osiris_pcm#ifdef CONFIG_PM static unsigned char pm_osiris_ctrl0; -static int osiris_pm_suspend (struct sys_device *sd,pm_message_t state) +static int osiris_pm_suspend (void ) {unsigned int tmp;
@@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_return 0 ; } -static int osiris_pm_resume (struct sys_device *sd) +static void osiris_pm_resume (void ) {if (pm_osiris_ctrl0 &OSIRIS_CTRL0_FIX8 )__raw_writeb (OSIRIS_CTRL1_FIX8 ,OSIRIS_VA_CTRL1 );
@@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_d__raw_writeb (pm_osiris_ctrl0,OSIRIS_VA_CTRL0 ); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); - - return 0; }#else
@@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_d#define osiris_pm_resume NULL#endif -static struct sysdev_class osiris_pm_sysclass = { - .name ="mach-osiris" , +static struct syscore_ops osiris_pm_syscore_ops = { .suspend = osiris_pm_suspend, .resume = osiris_pm_resume, }; -static struct sys_device osiris_pm_sysdev = { - .cls = &osiris_pm_sysclass, -}; -/* Link for DVS driver to TPS65011 */ static void osiris_tps_release (struct device *dev)
@@ -439,8 +432,7 @@ static void __init osiris_map_io(void)static void __init osiris_init (void ) { -sysdev_class_register (&osiris_pm_sysclass); -sysdev_register (&osiris_pm_sysdev); +register_syscore_ops (&osiris_pm_syscore_ops);s3c_i2c0_set_platdata (NULL );s3c_nand_set_platdata (&osiris_nand_info);
arch/arm/mach-s3c2412/mach-jive.c +6 -13
@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/i2c.h>
@@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive/* Jive power management device */ #ifdef CONFIG_PM -static int jive_pm_suspend (struct sys_device *sd,pm_message_t state) +static int jive_pm_suspend (void ) {/* Write the magic value u-boot uses to check for resume into * the INFORM0 register, and ensure INFORM1 is set to the
@@ -498,10 +498,9 @@ static int jive_pm_suspend(struct sys_de return 0; } -static int jive_pm_resume (struct sys_device *sd) +static void jive_pm_resume (void ) {__raw_writel (0x0 ,S3C2412_INFORM0 ); -return 0 ; }#else
@@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_dev#define jive_pm_resume NULL#endif -static struct sysdev_class jive_pm_sysclass = { - .name ="jive-pm" , +static struct syscore_ops jive_pm_syscore_ops = { .suspend = jive_pm_suspend, .resume = jive_pm_resume, }; -static struct sys_device jive_pm_sysdev = { - .cls = &jive_pm_sysclass, -}; -static void __init jive_map_io (void ) {s3c24xx_init_io (jive_iodesc,ARRAY_SIZE (jive_iodesc));
@@ -536,10 +530,9 @@ static void jive_power_off(void)static void __init jive_machine_init (void ) { -/* register system devices for managing low level suspend */ +/* register system core operations for managing low level suspend */ -sysdev_class_register (&jive_pm_sysclass); -sysdev_register (&jive_pm_sysdev); +register_syscore_ops (&jive_pm_syscore_ops);/* write our sleep configurations for the IO. Pull down all unused * IO, ensure that we have turned off all peripherals we do not
Re: [PATCH 6/7] ARM / Samsung: Use struct syscore_ops for "core" power management
Quoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects 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.
Hmm, does it still allow the system to choose which bits are bound depending on the cpu being registered, as for the s3c stuff it isn't just about the suspend/resume, it's binding items that get registered early in the startup sequence?
Quoted 1,158 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 + arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62 ++++++++++++++-------------- arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68 +++++++++++-------------------- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)Index:
linux-2.6/arch/arm/plat-samsung/include/plat/pm.h
===================================================================arch/arm/plat-samsung/include/plat/pm.h +4
-2@@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struc#ifdef CONFIG_PM extern int s3c_irqext_wake (struct irq_data *data,unsigned int state); -extern int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state); -extern int s3c24xx_irq_resume (struct sys_device *dev); +extern int s3c24xx_irq_suspend (void ); +extern void s3c24xx_irq_resume (void );#else #define s3c_irqext_wake NULL#define s3c24xx_irq_suspend NULL#define s3c24xx_irq_resume NULL#endif +extern struct syscore_ops s3c24xx_irq_syscore_ops; +/* PM debug functions */ #ifdef CONFIG_SAMSUNG_PM_DEBUG Index:
linux-2.6/arch/arm/plat-s5p/irq-pm.c
===================================================================arch/arm/plat-s5p/irq-pm.c +2
-5@@ -16,7 +16,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <plat/cpu.h> #include <plat/irqs.h> @@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = { SAVE_ITEM(S5P_EINT_MASK(3)), }; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {s3c_pm_do_save (eint_save,ARRAY_SIZE (eint_save));return 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {s3c_pm_do_restore (eint_save,ARRAY_SIZE (eint_save)); - -return 0 ; }Index:
linux-2.6/arch/arm/plat-s3c24xx/irq-pm.c
===================================================================arch/arm/plat-s3c24xx/irq-pm.c +2
-5@@ -14,7 +14,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <plat/cpu.h> @@ -65,7 +64,7 @@ static unsigned long save_extint[3];static unsigned long save_eintflt[4 ];static unsigned long save_eintmask; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {unsigned int i;@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_devicreturn 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {unsigned int i;@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_devices3c_pm_do_restore (irq_save,ARRAY_SIZE (irq_save));__raw_writel (save_eintmask,S3C24XX_EINTMASK ); - -return 0 ; }Index:
linux-2.6/arch/arm/mach-s3c2410/irq.c
===================================================================arch/arm/mach-s3c2410/irq.c +2
-28@@ -23,38 +23,12 @@#include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <plat/cpu.h> #include <plat/pm.h> -static int s3c2410_irq_add (struct sys_device *sysdev) -{ -return 0 ; -} - -static struct sysdev_driver s3c2410_irq_driver = { - .add = s3c2410_irq_add, +struct syscore_ops s3c24xx_irq_syscore_ops = { .suspend = s3c24xx_irq_suspend, .resume = s3c24xx_irq_resume, }; - -static int __init s3c2410_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410_sysclass, &s3c2410_irq_driver); -} - -arch_initcall (s3c2410_irq_init); - -static struct sysdev_driver s3c2410a_irq_driver = { - .add = s3c2410_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, -}; - -static int __init s3c2410a_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410a_sysclass, &s3c2410a_irq_driver); -} - -arch_initcall (s3c2410a_irq_init);Index:
linux-2.6/arch/arm/mach-s3c2410/pm.c
===================================================================arch/arm/mach-s3c2410/pm.c +6
-7@@ -25,6 +25,7 @@#include <linux/errno.h> #include <linux/time.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/io.h> @@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void) } } -static int s3c2410_pm_resume (struct sys_device *dev) +static void s3c2410_pm_resume (void ) {unsigned long tmp;@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_if (machine_is_aml_m5900 () )s3c2410_gpio_setpin (S3C2410_GPF (2 ),0 ); - -return 0 ; } +struct syscore_ops s3c2410_pm_syscore_ops = { + .resume = s3c2410_pm_resume, +}; +static int s3c2410_pm_add (struct sys_device *dev) { pm_cpu_prep = s3c2410_pm_prepare;@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_dev#if defined(CONFIG_CPU_S3C2410 )static struct sysdev_driver s3c2410_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };/* register ourselves */ @@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);static struct sysdev_driver s3c2410a_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2410a_pm_drvinit (void )@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);#if defined(CONFIG_CPU_S3C2440 )static struct sysdev_driver s3c2440_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2440_pm_drvinit (void )@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);#if defined(CONFIG_CPU_S3C2442 )static struct sysdev_driver s3c2442_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2442_pm_drvinit (void )Index:
linux-2.6/arch/arm/plat-samsung/include/plat/cpu.h
===================================================================arch/arm/plat-samsung/include/plat/cpu.h +6
-0@@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *struct sys_timer ;extern struct sys_timer s3c24xx_timer; +extern struct syscore_ops s3c2410_pm_syscore_ops; +extern struct syscore_ops s3c2412_pm_syscore_ops; +extern struct syscore_ops s3c2416_pm_syscore_ops; +extern struct syscore_ops s3c244x_pm_syscore_ops; +extern struct syscore_ops s3c64xx_irq_syscore_ops; +/* system device classes */ extern struct sysdev_class s3c2410_sysclass;Index:
linux-2.6/arch/arm/mach-s3c2410/s3c2410.c
===================================================================arch/arm/mach-s3c2410/s3c2410.c +5
-0@@ -19,6 +19,7 @@#include <linux/gpio.h> #include <linux/clk.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -40,6 +41,7 @@#include <plat/devs.h> #include <plat/clock.h> #include <plat/pll.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -168,6 +170,9 @@ int __init s3c2410_init(void) {printk ("S3C2410: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2410_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2412/irq.c
===================================================================arch/arm/mach-s3c2412/irq.c +0
-2@@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_destatic struct sysdev_driver s3c2412_irq_driver = { .add = s3c2412_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2412_irq_init (void )Index:
linux-2.6/arch/arm/mach-s3c2412/pm.c
===================================================================arch/arm/mach-s3c2412/pm.c +15
-12@@ -17,6 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] SAVE_ITEM(S3C2413_GPJSLPCON), }; -static int s3c2412_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2412_pm_driver = { + .add = s3c2412_pm_add, +}; + +static __init int s3c2412_pm_init (void ) +{ +return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); +} + +arch_initcall (s3c2412_pm_init); + +static int s3c2412_pm_suspend (void ) {s3c_pm_do_save (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep));return 0 ; } -static int s3c2412_pm_resume (struct sys_device *dev) +static void s3c2412_pm_resume (void ) {unsigned long tmp;@@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys___raw_writel (tmp,S3C2412_PWRCFG );s3c_pm_do_restore (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep)); -return 0 ; } -static struct sysdev_driver s3c2412_pm_driver = { - .add = s3c2412_pm_add, +struct syscore_ops s3c2412_pm_syscore_ops = { .suspend = s3c2412_pm_suspend, .resume = s3c2412_pm_resume, }; - -static __init int s3c2412_pm_init (void ) -{ -return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); -} - -arch_initcall (s3c2412_pm_init);Index:
linux-2.6/arch/arm/mach-s3c2412/s3c2412.c
===================================================================arch/arm/mach-s3c2412/s3c2412.c +4
-0@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -244,5 +245,8 @@ int __init s3c2412_init(void) {printk ("S3C2412: Initialising architecture\n" ); +register_syscore_ops (&s3c2412_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2412_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2416/irq.c
===================================================================arch/arm/mach-s3c2416/irq.c +0
-2@@ -238,8 +238,6 @@ static int __init s3c2416_irq_add(structstatic struct sysdev_driver s3c2416_irq_driver = { .add = s3c2416_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int __init s3c2416_irq_init (void )Index:
linux-2.6/arch/arm/mach-s3c2416/pm.c
===================================================================arch/arm/mach-s3c2416/pm.c +12
-15@@ -11,6 +11,7 @@*/ #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h> @@ -55,30 +56,26 @@ static int s3c2416_pm_add(struct sys_devreturn 0 ; } -static int s3c2416_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2416_pm_driver = { + .add = s3c2416_pm_add, +}; + +static __init int s3c2416_pm_init (void ) { -return 0 ; +return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); } -static int s3c2416_pm_resume (struct sys_device *dev) +arch_initcall (s3c2416_pm_init); + + +static void s3c2416_pm_resume (void ) {/* unset the return-from-sleep amd inform flags */ __raw_writel (0x0 ,S3C2443_PWRMODE );__raw_writel (0x0 ,S3C2412_INFORM0 );__raw_writel (0x0 ,S3C2412_INFORM1 ); - -return 0 ; } -static struct sysdev_driver s3c2416_pm_driver = { - .add = s3c2416_pm_add, - .suspend = s3c2416_pm_suspend, +struct syscore_ops s3c2416_pm_syscore_ops = { .resume = s3c2416_pm_resume, }; - -static __init int s3c2416_pm_init (void ) -{ -return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); -} - -arch_initcall (s3c2416_pm_init);Index:
linux-2.6/arch/arm/mach-s3c2416/s3c2416.c
===================================================================arch/arm/mach-s3c2416/s3c2416.c +5
-0@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h> @@ -54,6 +55,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/sdhci.h> +#include <plat/pm.h> #include <plat/iic-core.h> #include <plat/fb-core.h> @@ -95,6 +97,9 @@ int __init s3c2416_init(void)s3c_fb_setname ("s3c2443-fb" ); +register_syscore_ops (&s3c2416_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2416_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2440/s3c244x-irq.c
===================================================================arch/arm/mach-s3c2440/s3c244x-irq.c +0
-4@@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_destatic struct sysdev_driver s3c2440_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2440_irq_init (void )@@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);static struct sysdev_driver s3c2442_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };Index:
linux-2.6/arch/arm/mach-s3c2440/s3c244x.c
===================================================================arch/arm/mach-s3c2440/s3c244x.c +31
-31@@ -19,6 +19,7 @@#include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h> @@ -134,45 +135,14 @@ void __init s3c244x_init_clocks(int xtals3c2410_baseclk_add (); } -#ifdef CONFIG_PM - -static struct sleep_save s3c244x_sleep[] = { -SAVE_ITEM (S3C2440_DSC0 ), -SAVE_ITEM (S3C2440_DSC1 ), -SAVE_ITEM (S3C2440_GPJDAT ), -SAVE_ITEM (S3C2440_GPJCON ), -SAVE_ITEM (S3C2440_GPJUP ) -}; - -static int s3c244x_suspend (struct sys_device *dev,pm_message_t state) -{ -s3c_pm_do_save (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); -return 0 ; -} - -static int s3c244x_resume (struct sys_device *dev) -{ -s3c_pm_do_restore (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); -return 0 ; -} - -#else -#define s3c244x_suspend NULL -#define s3c244x_resume NULL -#endif -/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */ struct sysdev_class s3c2440_sysclass = { .name ="s3c2440-core" , - .suspend = s3c244x_suspend, - .resume = s3c244x_resume };struct sysdev_class s3c2442_sysclass = { .name ="s3c2442-core" , - .suspend = s3c244x_suspend, - .resume = s3c244x_resume };/* need to register class before we actually register the device, and @@ -194,3 +164,33 @@ static int __init s3c2442_core_init(void }core_initcall (s3c2442_core_init); + + +#ifdef CONFIG_PM +static struct sleep_save s3c244x_sleep[] = { +SAVE_ITEM (S3C2440_DSC0 ), +SAVE_ITEM (S3C2440_DSC1 ), +SAVE_ITEM (S3C2440_GPJDAT ), +SAVE_ITEM (S3C2440_GPJCON ), +SAVE_ITEM (S3C2440_GPJUP ) +}; + +static int s3c244x_suspend (void ) +{ +s3c_pm_do_save (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); +return 0 ; +} + +static void s3c244x_resume (void ) +{ +s3c_pm_do_restore (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); +} +#else +#define s3c244x_suspend NULL +#define s3c244x_resume NULL +#endif + +struct syscore_ops s3c244x_pm_syscore_ops = { + .suspend = s3c244x_suspend, + .resume = s3c244x_resume, +};Index:
linux-2.6/arch/arm/mach-s3c2440/s3c2440.c
===================================================================arch/arm/mach-s3c2440/s3c2440.c +8
-0@@ -19,6 +19,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h> @@ -33,6 +34,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -51,6 +53,12 @@ int __init s3c2440_init(void) s3c_device_wdt.resource[1 ].start =IRQ_S3C2440_WDT ; s3c_device_wdt.resource[1 ].end =IRQ_S3C2440_WDT ; +/* register suspend/resume handlers */ + +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +/* register our system device for everything else */ return sysdev_register (&s3c2440_sysdev);Index:
linux-2.6/arch/arm/mach-s3c2440/s3c2442.c
===================================================================arch/arm/mach-s3c2440/s3c2442.c +6
-0@@ -29,6 +29,7 @@#include <linux/err.h> #include <linux/device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/mutex.h> @@ -45,6 +46,7 @@#include <plat/clock.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -167,6 +169,10 @@ int __init s3c2442_init(void) {printk ("S3C2442: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2442_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c64xx/irq-pm.c
===================================================================arch/arm/mach-s3c64xx/irq-pm.c +9
-9@@ -13,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/serial_core.h> #include <linux/irq.h> @@ -54,7 +54,7 @@ static struct irq_grp_save {static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS ]; -static int s3c64xx_irq_pm_suspend (struct sys_device *dev,pm_message_t state) +static int s3c64xx_irq_pm_suspend (void ) {struct irq_grp_save *grp = eint_grp_save;int i;@@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(structreturn 0 ; } -static int s3c64xx_irq_pm_resume (struct sys_device *dev) +static void s3c64xx_irq_pm_resume (void ) {struct irq_grp_save *grp = eint_grp_save;int i;@@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct }S3C_PMDBG ("%s: IRQ configuration restored\n" , __func__); -return 0 ; } -static struct sysdev_driver s3c64xx_irq_driver = { +struct syscore_ops s3c64xx_irq_syscore_ops = { .suspend = s3c64xx_irq_pm_suspend, .resume = s3c64xx_irq_pm_resume, }; -static int __init s3c64xx_irq_pm_init (void ) +static __init int s3c64xx_syscore_init (void ) { -return sysdev_driver_register (&s3c64xx_sysclass, &s3c64xx_irq_driver); -} +register_syscore_ops (&s3c64xx_irq_syscore_ops); -arch_initcall (s3c64xx_irq_pm_init); +return 0 ; +} +core_initcall (s3c64xx_syscore_init);Index:
linux-2.6/arch/arm/mach-s5pv210/pm.c
===================================================================arch/arm/mach-s5pv210/pm.c +17
-8@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <plat/cpu.h> @@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_devreturn 0 ; } -static int s5pv210_pm_resume (struct sys_device *dev) +static struct sysdev_driver s5pv210_pm_driver = { + .add = s5pv210_pm_add, +}; + +static __init int s5pv210_pm_drvinit (void ) +{ +return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +} +arch_initcall (s5pv210_pm_drvinit); + +static void s5pv210_pm_resume (void ) {u32 tmp;@@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys___raw_writel (tmp ,S5P_OTHERS );s3c_pm_do_restore_core (s5pv210_core_save,ARRAY_SIZE (s5pv210_core_save)); - -return 0 ; } -static struct sysdev_driver s5pv210_pm_driver = { - .add = s5pv210_pm_add, +static struct syscore_ops s5pv210_pm_syscore_ops = { .resume = s5pv210_pm_resume, }; -static __init int s5pv210_pm_drvinit (void ) +static __init int s5pv210_pm_syscore_init (void ) { -return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +register_syscore_ops (&s5pv210_pm_syscore_ops); +return 0 ; } -arch_initcall (s5pv210_pm_drvinit); +arch_initcall (s5pv210_pm_syscore_init);Index:
linux-2.6/arch/arm/mach-exynos4/pm.c
===================================================================arch/arm/mach-exynos4/pm.c +27
-18@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h> @@ -372,7 +373,27 @@ void exynos4_scu_enable(void __iomem *scflush_cache_all (); } -static int exynos4_pm_resume (struct sys_device *dev) +static struct sysdev_driver exynos4_pm_driver = { + .add = exynos4_pm_add, +}; + +static __init int exynos4_pm_drvinit (void ) +{ +unsigned int tmp; + +s3c_pm_init (); + +/* All wakeup disable */ + + tmp =__raw_readl (S5P_WAKEUP_MASK ); + tmp |= ((0xFF <<8 ) | (0x1F <<1 )); +__raw_writel (tmp,S5P_WAKEUP_MASK ); + +return sysdev_driver_register (&exynos4_sysclass, &exynos4_pm_driver); +} +arch_initcall (exynos4_pm_drvinit); + +static void exynos4_pm_resume (void ) {/* For release retention */ @@ -394,27 +415,15 @@ static int exynos4_pm_resume(struct sys_/* enable L2X0*/ writel_relaxed (1 ,S5P_VA_L2CC +L2X0_CTRL );#endif - -return 0 ; } -static struct sysdev_driver exynos4_pm_driver = { - .add = exynos4_pm_add, +static struct syscore_ops exynos4_pm_syscore_ops = { .resume = exynos4_pm_resume, }; -static __init int exynos4_pm_drvinit (void ) +static __init int exynos4_pm_syscore_init (void ) { -unsigned int tmp; - -s3c_pm_init (); - -/* All wakeup disable */ - - tmp =__raw_readl (S5P_WAKEUP_MASK ); - tmp |= ((0xFF <<8 ) | (0x1F <<1 )); -__raw_writel (tmp,S5P_WAKEUP_MASK ); - -return sysdev_driver_register (&exynos4_sysclass, &exynos4_pm_driver); +register_syscore_ops (&exynos4_pm_syscore_ops); +return 0 ; } -arch_initcall (exynos4_pm_drvinit); +arch_initcall (exynos4_pm_syscore_init);Index:
linux-2.6/arch/arm/mach-s3c2410/mach-bast.c
===================================================================arch/arm/mach-s3c2410/mach-bast.c +5
-12@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/dm9000.h> @@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartc/* NAND Flash on BAST board */ #ifdef CONFIG_PM -static int bast_pm_suspend (struct sys_device *sd,pm_message_t state) +static int bast_pm_suspend (void ) {/* ensure that an nRESET is not generated on resume. */ gpio_direction_output (S3C2410_GPA (21 ),1 );return 0 ; } -static int bast_pm_resume (struct sys_device *sd) +static void bast_pm_resume (void ) {s3c_gpio_cfgpin (S3C2410_GPA (21 ), S3C2410_GPA21_nRSTOUT); -return 0 ; }#else @@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_dev#define bast_pm_resume NULL#endif -static struct sysdev_class bast_pm_sysclass = { - .name ="mach-bast" , +static struct syscore_ops bast_pm_syscore_ops = { .suspend = bast_pm_suspend, .resume = bast_pm_resume, }; -static struct sys_device bast_pm_sysdev = { - .cls = &bast_pm_sysclass, -}; -static int smartmedia_map[] = {0 };static int chip0_map[] = {1 };static int chip1_map[] = {2 };@@ -642,8 +636,7 @@ static void __init bast_map_io(void)static void __init bast_init (void ) { -sysdev_class_register (&bast_pm_sysclass); -sysdev_register (&bast_pm_sysdev); +register_syscore_ops (&bast_pm_syscore_ops);s3c_i2c0_set_platdata (&bast_i2c_info);s3c_nand_set_platdata (&bast_nand_info);Index:
linux-2.6/arch/arm/plat-s3c24xx/dma.c
===================================================================arch/arm/plat-s3c24xx/dma.c +26
-42@@ -22,7 +22,7 @@#include <linux/sched.h> #include <linux/spinlock.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/slab.h> #include <linux/errno.h> #include <linux/io.h> @@ -1195,19 +1195,12 @@ int s3c2410_dma_getposition(unsigned intEXPORT_SYMBOL (s3c2410_dma_getposition); -static inline struct s3c2410_dma_chan *to_dma_chan (struct sys_device *dev) -{ - return container_of(dev, struct s3c2410_dma_chan, dev); -} - -/* system device class */ +/* system core operations */ #ifdef CONFIG_PM -static int s3c2410_dma_suspend (struct sys_device *dev,pm_message_t state) +static void s3c2410_dma_suspend_chan (s3c2410_dma_chan *cp) { -struct s3c2410_dma_chan *cp =to_dma_chan (dev); -printk (KERN_DEBUG "suspending dma channel %d\n" , cp->number);if (dma_rdreg (cp,S3C2410_DMA_DMASKTRIG ) &S3C2410_DMASKTRIG_ON ) {@@ -1222,13 +1215,21 @@ static int s3c2410_dma_suspend(struct sys3c2410_dma_dostop (cp); } +} + +static int s3c2410_dma_suspend (void ) +{ +struct s3c2410_dma_chan *cp = s3c2410_chans; +int channel; + +for (channel =0 ; channel < dma_channels; cp++, channel++) +s3c2410_dma_suspend_chan (cp);return 0 ; } -static int s3c2410_dma_resume (struct sys_device *dev) +static void s3c2410_dma_resume_chan (struct s3c2410_dma_chan *cp) { -struct s3c2410_dma_chan *cp =to_dma_chan (dev);unsigned int no = cp->number |DMACH_LOW_LEVEL ;/* restore channel's hardware configuration */ @@ -1249,13 +1250,21 @@ static int s3c2410_dma_resume(struct sys return 0; } +static void s3c2410_dma_resume (void ) +{ +struct s3c2410_dma_chan *cp = s3c2410_chans + dma_channels -1 ; +int channel; + +for (channel = dma_channels -1 ; channel >=0 ; cp++, channel--) +s3c2410_dma_resume_chan (cp); +} +#else #define s3c2410_dma_suspend NULL#define s3c2410_dma_resume NULL#endif /* CONFIG_PM */ -struct sysdev_class dma_sysclass = { - .name ="s3c24xx-dma" , +struct syscore_ops dma_syscore_ops = { .suspend = s3c2410_dma_suspend, .resume = s3c2410_dma_resume, };@@ -1269,39 +1278,14 @@ static void s3c2410_dma_cache_ctor(void/* initialisation code */ -static int __init s3c24xx_dma_sysclass_init (void ) +static int __init s3c24xx_dma_syscore_init (void ) { -int ret =sysdev_class_register (&dma_sysclass); - -if (ret !=0 ) -printk (KERN_ERR "dma sysclass registration failed\n" ); - -return ret; -} - -core_initcall (s3c24xx_dma_sysclass_init); - -static int __init s3c24xx_dma_sysdev_register (void ) -{ -struct s3c2410_dma_chan *cp = s3c2410_chans; -int channel, ret; - -for (channel =0 ; channel < dma_channels; cp++, channel++) { - cp->dev.cls = &dma_sysclass; - cp->dev.id = channel; - ret =sysdev_register (&cp->dev); - -if (ret) { -printk (KERN_ERR "error registering dev for dma %d\n" , - channel); -return ret; - } - } +register_syscore_ops (&dma_syscore_ops);return 0 ; } -late_initcall (s3c24xx_dma_sysdev_register); +late_initcall (s3c24xx_dma_syscore_init);int __init s3c24xx_dma_init (unsigned int channels,unsigned int irq,unsigned int stride)Index:
linux-2.6/arch/arm/mach-s3c2440/mach-osiris.c
===================================================================arch/arm/mach-s3c2440/mach-osiris.c +5
-13@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/gpio.h> #include <linux/device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/clk.h> #include <linux/i2c.h> @@ -284,7 +284,7 @@ static struct platform_device osiris_pcm#ifdef CONFIG_PM static unsigned char pm_osiris_ctrl0; -static int osiris_pm_suspend (struct sys_device *sd,pm_message_t state) +static int osiris_pm_suspend (void ) {unsigned int tmp;@@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_return 0 ; } -static int osiris_pm_resume (struct sys_device *sd) +static void osiris_pm_resume (void ) {if (pm_osiris_ctrl0 &OSIRIS_CTRL0_FIX8 )__raw_writeb (OSIRIS_CTRL1_FIX8 ,OSIRIS_VA_CTRL1 );@@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_d__raw_writeb (pm_osiris_ctrl0,OSIRIS_VA_CTRL0 ); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); - - return 0; }#else @@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_d#define osiris_pm_resume NULL#endif -static struct sysdev_class osiris_pm_sysclass = { - .name ="mach-osiris" , +static struct syscore_ops osiris_pm_syscore_ops = { .suspend = osiris_pm_suspend, .resume = osiris_pm_resume, }; -static struct sys_device osiris_pm_sysdev = { - .cls = &osiris_pm_sysclass, -}; -/* Link for DVS driver to TPS65011 */ static void osiris_tps_release (struct device *dev)@@ -439,8 +432,7 @@ static void __init osiris_map_io(void)static void __init osiris_init (void ) { -sysdev_class_register (&osiris_pm_sysclass); -sysdev_register (&osiris_pm_sysdev); +register_syscore_ops (&osiris_pm_syscore_ops);s3c_i2c0_set_platdata (NULL );s3c_nand_set_platdata (&osiris_nand_info);Index:
linux-2.6/arch/arm/mach-s3c2412/mach-jive.c
===================================================================arch/arm/mach-s3c2412/mach-jive.c +6
-13@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/i2c.h> @@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive/* Jive power management device */ #ifdef CONFIG_PM -static int jive_pm_suspend (struct sys_device *sd,pm_message_t state) +static int jive_pm_suspend (void ) {/* Write the magic value u-boot uses to check for resume into * the INFORM0 register, and ensure INFORM1 is set to the @@ -498,10 +498,9 @@ static int jive_pm_suspend(struct sys_de return 0; } -static int jive_pm_resume (struct sys_device *sd) +static void jive_pm_resume (void ) {__raw_writel (0x0 ,S3C2412_INFORM0 ); -return 0 ; }#else @@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_dev#define jive_pm_resume NULL#endif -static struct sysdev_class jive_pm_sysclass = { - .name ="jive-pm" , +static struct syscore_ops jive_pm_syscore_ops = { .suspend = jive_pm_suspend, .resume = jive_pm_resume, }; -static struct sys_device jive_pm_sysdev = { - .cls = &jive_pm_sysclass, -}; -static void __init jive_map_io (void ) {s3c24xx_init_io (jive_iodesc,ARRAY_SIZE (jive_iodesc));@@ -536,10 +530,9 @@ static void jive_power_off(void)static void __init jive_machine_init (void ) { -/* register system devices for managing low level suspend */ +/* register system core operations for managing low level suspend */ -sysdev_class_register (&jive_pm_sysclass); -sysdev_register (&jive_pm_sysdev); +register_syscore_ops (&jive_pm_syscore_ops);/* write our sleep configurations for the IO. Pull down all unused * IO, ensure that we have turned off all peripherals we do not _______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
Ben Dooks, ben at fluff.org, http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear.
Re: [PATCH 6/7] ARM / Samsung: Use struct syscore_ops for "core" power management
Quoted 7 lines · Ben Dooks
Quoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects that are simpler.
Quoted 8 lines
Quoted 3 lines
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.
Hmm, does it still allow the system to choose which bits are bound depending on the cpu being registered, as for the s3c stuff it isn't just about the suspend/resume, it's binding items that get registered early in the startup sequence?
The registering is still done through sysdevs, the syscore_ops are only used for power management. I did my best to retain the existing flow of control as far as possible.
Thanks,
Rafael
Re: [PATCH 6/7] ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Ben DooksQuoted 7 lines · Ben Dooks
Quoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects that are simpler.
Quoted 8 lines
Quoted 3 lines
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.
Hmm, does it still allow the system to choose which bits are bound depending on the cpu being registered, as for the s3c stuff it isn't just about the suspend/resume, it's binding items that get registered early in the startup sequence?
The registering is still done through sysdevs, the syscore_ops are only used for power management. I did my best to retain the existing flow of control as far as possible.
Thanks,
Rafael
Re: [PATCH 6/7] ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Ben DooksQuoted 7 lines · Ben Dooks
Quoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects that are simpler.
Quoted 8 lines
Quoted 3 lines
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.
Hmm, does it still allow the system to choose which bits are bound depending on the cpu being registered, as for the s3c stuff it isn't just about the suspend/resume, it's binding items that get registered early in the startup sequence?
Yes, it does, AFAICS. It didn't change the bits that weren't directly related to suspend/resume (at least that wasn't the intention).
That said, using sysdevs for the initialization of things the way you describe will have to change anyway, because sysdevs are going to be removed entirely from the kernel at one point.
Thanks,
Rafael
Re: [PATCH 6/7] ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Ben DooksQuoted 7 lines · Ben Dooks
Quoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects that are simpler.
Quoted 8 lines
Quoted 3 lines
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.
Hmm, does it still allow the system to choose which bits are bound depending on the cpu being registered, as for the s3c stuff it isn't just about the suspend/resume, it's binding items that get registered early in the startup sequence?
Yes, it does, AFAICS. It didn't change the bits that weren't directly related to suspend/resume (at least that wasn't the intention).
That said, using sysdevs for the initialization of things the way you describe will have to change anyway, because sysdevs are going to be removed entirely from the kernel at one point.
Thanks,
Rafael
Re: [PATCH 6/7] ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiQuoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects 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.
Hmm, does it still allow the system to choose which bits are bound depending on the cpu being registered, as for the s3c stuff it isn't just about the suspend/resume, it's binding items that get registered early in the startup sequence?
Quoted 1,158 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 + arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62 ++++++++++++++-------------- arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68 +++++++++++-------------------- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)Index:
linux-2.6/arch/arm/plat-samsung/include/plat/pm.h
===================================================================arch/arm/plat-samsung/include/plat/pm.h +4
-2@@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struc#ifdef CONFIG_PM extern int s3c_irqext_wake (struct irq_data *data,unsigned int state); -extern int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state); -extern int s3c24xx_irq_resume (struct sys_device *dev); +extern int s3c24xx_irq_suspend (void ); +extern void s3c24xx_irq_resume (void );#else #define s3c_irqext_wake NULL#define s3c24xx_irq_suspend NULL#define s3c24xx_irq_resume NULL#endif +extern struct syscore_ops s3c24xx_irq_syscore_ops; +/* PM debug functions */ #ifdef CONFIG_SAMSUNG_PM_DEBUG Index:
linux-2.6/arch/arm/plat-s5p/irq-pm.c
===================================================================arch/arm/plat-s5p/irq-pm.c +2
-5@@ -16,7 +16,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <plat/cpu.h> #include <plat/irqs.h> @@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = { SAVE_ITEM(S5P_EINT_MASK(3)), }; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {s3c_pm_do_save (eint_save,ARRAY_SIZE (eint_save));return 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {s3c_pm_do_restore (eint_save,ARRAY_SIZE (eint_save)); - -return 0 ; }Index:
linux-2.6/arch/arm/plat-s3c24xx/irq-pm.c
===================================================================arch/arm/plat-s3c24xx/irq-pm.c +2
-5@@ -14,7 +14,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <plat/cpu.h> @@ -65,7 +64,7 @@ static unsigned long save_extint[3];static unsigned long save_eintflt[4 ];static unsigned long save_eintmask; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {unsigned int i;@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_devicreturn 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {unsigned int i;@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_devices3c_pm_do_restore (irq_save,ARRAY_SIZE (irq_save));__raw_writel (save_eintmask,S3C24XX_EINTMASK ); - -return 0 ; }Index:
linux-2.6/arch/arm/mach-s3c2410/irq.c
===================================================================arch/arm/mach-s3c2410/irq.c +2
-28@@ -23,38 +23,12 @@#include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <plat/cpu.h> #include <plat/pm.h> -static int s3c2410_irq_add (struct sys_device *sysdev) -{ -return 0 ; -} - -static struct sysdev_driver s3c2410_irq_driver = { - .add = s3c2410_irq_add, +struct syscore_ops s3c24xx_irq_syscore_ops = { .suspend = s3c24xx_irq_suspend, .resume = s3c24xx_irq_resume, }; - -static int __init s3c2410_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410_sysclass, &s3c2410_irq_driver); -} - -arch_initcall (s3c2410_irq_init); - -static struct sysdev_driver s3c2410a_irq_driver = { - .add = s3c2410_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, -}; - -static int __init s3c2410a_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410a_sysclass, &s3c2410a_irq_driver); -} - -arch_initcall (s3c2410a_irq_init);Index:
linux-2.6/arch/arm/mach-s3c2410/pm.c
===================================================================arch/arm/mach-s3c2410/pm.c +6
-7@@ -25,6 +25,7 @@#include <linux/errno.h> #include <linux/time.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/io.h> @@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void) } } -static int s3c2410_pm_resume (struct sys_device *dev) +static void s3c2410_pm_resume (void ) {unsigned long tmp;@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_if (machine_is_aml_m5900 () )s3c2410_gpio_setpin (S3C2410_GPF (2 ),0 ); - -return 0 ; } +struct syscore_ops s3c2410_pm_syscore_ops = { + .resume = s3c2410_pm_resume, +}; +static int s3c2410_pm_add (struct sys_device *dev) { pm_cpu_prep = s3c2410_pm_prepare;@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_dev#if defined(CONFIG_CPU_S3C2410 )static struct sysdev_driver s3c2410_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };/* register ourselves */ @@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);static struct sysdev_driver s3c2410a_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2410a_pm_drvinit (void )@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);#if defined(CONFIG_CPU_S3C2440 )static struct sysdev_driver s3c2440_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2440_pm_drvinit (void )@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);#if defined(CONFIG_CPU_S3C2442 )static struct sysdev_driver s3c2442_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2442_pm_drvinit (void )Index:
linux-2.6/arch/arm/plat-samsung/include/plat/cpu.h
===================================================================arch/arm/plat-samsung/include/plat/cpu.h +6
-0@@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *struct sys_timer ;extern struct sys_timer s3c24xx_timer; +extern struct syscore_ops s3c2410_pm_syscore_ops; +extern struct syscore_ops s3c2412_pm_syscore_ops; +extern struct syscore_ops s3c2416_pm_syscore_ops; +extern struct syscore_ops s3c244x_pm_syscore_ops; +extern struct syscore_ops s3c64xx_irq_syscore_ops; +/* system device classes */ extern struct sysdev_class s3c2410_sysclass;Index:
linux-2.6/arch/arm/mach-s3c2410/s3c2410.c
===================================================================arch/arm/mach-s3c2410/s3c2410.c +5
-0@@ -19,6 +19,7 @@#include <linux/gpio.h> #include <linux/clk.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -40,6 +41,7 @@#include <plat/devs.h> #include <plat/clock.h> #include <plat/pll.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -168,6 +170,9 @@ int __init s3c2410_init(void) {printk ("S3C2410: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2410_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2412/irq.c
===================================================================arch/arm/mach-s3c2412/irq.c +0
-2@@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_destatic struct sysdev_driver s3c2412_irq_driver = { .add = s3c2412_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2412_irq_init (void )Index:
linux-2.6/arch/arm/mach-s3c2412/pm.c
===================================================================arch/arm/mach-s3c2412/pm.c +15
-12@@ -17,6 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] SAVE_ITEM(S3C2413_GPJSLPCON), }; -static int s3c2412_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2412_pm_driver = { + .add = s3c2412_pm_add, +}; + +static __init int s3c2412_pm_init (void ) +{ +return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); +} + +arch_initcall (s3c2412_pm_init); + +static int s3c2412_pm_suspend (void ) {s3c_pm_do_save (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep));return 0 ; } -static int s3c2412_pm_resume (struct sys_device *dev) +static void s3c2412_pm_resume (void ) {unsigned long tmp;@@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys___raw_writel (tmp,S3C2412_PWRCFG );s3c_pm_do_restore (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep)); -return 0 ; } -static struct sysdev_driver s3c2412_pm_driver = { - .add = s3c2412_pm_add, +struct syscore_ops s3c2412_pm_syscore_ops = { .suspend = s3c2412_pm_suspend, .resume = s3c2412_pm_resume, }; - -static __init int s3c2412_pm_init (void ) -{ -return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); -} - -arch_initcall (s3c2412_pm_init);Index:
linux-2.6/arch/arm/mach-s3c2412/s3c2412.c
===================================================================arch/arm/mach-s3c2412/s3c2412.c +4
-0@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -244,5 +245,8 @@ int __init s3c2412_init(void) {printk ("S3C2412: Initialising architecture\n" ); +register_syscore_ops (&s3c2412_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2412_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2416/irq.c
===================================================================arch/arm/mach-s3c2416/irq.c +0
-2@@ -238,8 +238,6 @@ static int __init s3c2416_irq_add(structstatic struct sysdev_driver s3c2416_irq_driver = { .add = s3c2416_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int __init s3c2416_irq_init (void )Index:
linux-2.6/arch/arm/mach-s3c2416/pm.c
===================================================================arch/arm/mach-s3c2416/pm.c +12
-15@@ -11,6 +11,7 @@*/ #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h> @@ -55,30 +56,26 @@ static int s3c2416_pm_add(struct sys_devreturn 0 ; } -static int s3c2416_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2416_pm_driver = { + .add = s3c2416_pm_add, +}; + +static __init int s3c2416_pm_init (void ) { -return 0 ; +return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); } -static int s3c2416_pm_resume (struct sys_device *dev) +arch_initcall (s3c2416_pm_init); + + +static void s3c2416_pm_resume (void ) {/* unset the return-from-sleep amd inform flags */ __raw_writel (0x0 ,S3C2443_PWRMODE );__raw_writel (0x0 ,S3C2412_INFORM0 );__raw_writel (0x0 ,S3C2412_INFORM1 ); - -return 0 ; } -static struct sysdev_driver s3c2416_pm_driver = { - .add = s3c2416_pm_add, - .suspend = s3c2416_pm_suspend, +struct syscore_ops s3c2416_pm_syscore_ops = { .resume = s3c2416_pm_resume, }; - -static __init int s3c2416_pm_init (void ) -{ -return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); -} - -arch_initcall (s3c2416_pm_init);Index:
linux-2.6/arch/arm/mach-s3c2416/s3c2416.c
===================================================================arch/arm/mach-s3c2416/s3c2416.c +5
-0@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h> @@ -54,6 +55,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/sdhci.h> +#include <plat/pm.h> #include <plat/iic-core.h> #include <plat/fb-core.h> @@ -95,6 +97,9 @@ int __init s3c2416_init(void)s3c_fb_setname ("s3c2443-fb" ); +register_syscore_ops (&s3c2416_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2416_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2440/s3c244x-irq.c
===================================================================arch/arm/mach-s3c2440/s3c244x-irq.c +0
-4@@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_destatic struct sysdev_driver s3c2440_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2440_irq_init (void )@@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);static struct sysdev_driver s3c2442_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };Index:
linux-2.6/arch/arm/mach-s3c2440/s3c244x.c
===================================================================arch/arm/mach-s3c2440/s3c244x.c +31
-31@@ -19,6 +19,7 @@#include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h> @@ -134,45 +135,14 @@ void __init s3c244x_init_clocks(int xtals3c2410_baseclk_add (); } -#ifdef CONFIG_PM - -static struct sleep_save s3c244x_sleep[] = { -SAVE_ITEM (S3C2440_DSC0 ), -SAVE_ITEM (S3C2440_DSC1 ), -SAVE_ITEM (S3C2440_GPJDAT ), -SAVE_ITEM (S3C2440_GPJCON ), -SAVE_ITEM (S3C2440_GPJUP ) -}; - -static int s3c244x_suspend (struct sys_device *dev,pm_message_t state) -{ -s3c_pm_do_save (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); -return 0 ; -} - -static int s3c244x_resume (struct sys_device *dev) -{ -s3c_pm_do_restore (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); -return 0 ; -} - -#else -#define s3c244x_suspend NULL -#define s3c244x_resume NULL -#endif -/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */ struct sysdev_class s3c2440_sysclass = { .name ="s3c2440-core" , - .suspend = s3c244x_suspend, - .resume = s3c244x_resume };struct sysdev_class s3c2442_sysclass = { .name ="s3c2442-core" , - .suspend = s3c244x_suspend, - .resume = s3c244x_resume };/* need to register class before we actually register the device, and @@ -194,3 +164,33 @@ static int __init s3c2442_core_init(void }core_initcall (s3c2442_core_init); + + +#ifdef CONFIG_PM +static struct sleep_save s3c244x_sleep[] = { +SAVE_ITEM (S3C2440_DSC0 ), +SAVE_ITEM (S3C2440_DSC1 ), +SAVE_ITEM (S3C2440_GPJDAT ), +SAVE_ITEM (S3C2440_GPJCON ), +SAVE_ITEM (S3C2440_GPJUP ) +}; + +static int s3c244x_suspend (void ) +{ +s3c_pm_do_save (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); +return 0 ; +} + +static void s3c244x_resume (void ) +{ +s3c_pm_do_restore (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); +} +#else +#define s3c244x_suspend NULL +#define s3c244x_resume NULL +#endif + +struct syscore_ops s3c244x_pm_syscore_ops = { + .suspend = s3c244x_suspend, + .resume = s3c244x_resume, +};Index:
linux-2.6/arch/arm/mach-s3c2440/s3c2440.c
===================================================================arch/arm/mach-s3c2440/s3c2440.c +8
-0@@ -19,6 +19,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h> @@ -33,6 +34,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -51,6 +53,12 @@ int __init s3c2440_init(void) s3c_device_wdt.resource[1 ].start =IRQ_S3C2440_WDT ; s3c_device_wdt.resource[1 ].end =IRQ_S3C2440_WDT ; +/* register suspend/resume handlers */ + +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +/* register our system device for everything else */ return sysdev_register (&s3c2440_sysdev);Index:
linux-2.6/arch/arm/mach-s3c2440/s3c2442.c
===================================================================arch/arm/mach-s3c2440/s3c2442.c +6
-0@@ -29,6 +29,7 @@#include <linux/err.h> #include <linux/device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/mutex.h> @@ -45,6 +46,7 @@#include <plat/clock.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -167,6 +169,10 @@ int __init s3c2442_init(void) {printk ("S3C2442: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2442_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c64xx/irq-pm.c
===================================================================arch/arm/mach-s3c64xx/irq-pm.c +9
-9@@ -13,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/serial_core.h> #include <linux/irq.h> @@ -54,7 +54,7 @@ static struct irq_grp_save {static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS ]; -static int s3c64xx_irq_pm_suspend (struct sys_device *dev,pm_message_t state) +static int s3c64xx_irq_pm_suspend (void ) {struct irq_grp_save *grp = eint_grp_save;int i;@@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(structreturn 0 ; } -static int s3c64xx_irq_pm_resume (struct sys_device *dev) +static void s3c64xx_irq_pm_resume (void ) {struct irq_grp_save *grp = eint_grp_save;int i;@@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct }S3C_PMDBG ("%s: IRQ configuration restored\n" , __func__); -return 0 ; } -static struct sysdev_driver s3c64xx_irq_driver = { +struct syscore_ops s3c64xx_irq_syscore_ops = { .suspend = s3c64xx_irq_pm_suspend, .resume = s3c64xx_irq_pm_resume, }; -static int __init s3c64xx_irq_pm_init (void ) +static __init int s3c64xx_syscore_init (void ) { -return sysdev_driver_register (&s3c64xx_sysclass, &s3c64xx_irq_driver); -} +register_syscore_ops (&s3c64xx_irq_syscore_ops); -arch_initcall (s3c64xx_irq_pm_init); +return 0 ; +} +core_initcall (s3c64xx_syscore_init);Index:
linux-2.6/arch/arm/mach-s5pv210/pm.c
===================================================================arch/arm/mach-s5pv210/pm.c +17
-8@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <plat/cpu.h> @@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_devreturn 0 ; } -static int s5pv210_pm_resume (struct sys_device *dev) +static struct sysdev_driver s5pv210_pm_driver = { + .add = s5pv210_pm_add, +}; + +static __init int s5pv210_pm_drvinit (void ) +{ +return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +} +arch_initcall (s5pv210_pm_drvinit); + +static void s5pv210_pm_resume (void ) {u32 tmp;@@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys___raw_writel (tmp ,S5P_OTHERS );s3c_pm_do_restore_core (s5pv210_core_save,ARRAY_SIZE (s5pv210_core_save)); - -return 0 ; } -static struct sysdev_driver s5pv210_pm_driver = { - .add = s5pv210_pm_add, +static struct syscore_ops s5pv210_pm_syscore_ops = { .resume = s5pv210_pm_resume, }; -static __init int s5pv210_pm_drvinit (void ) +static __init int s5pv210_pm_syscore_init (void ) { -return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +register_syscore_ops (&s5pv210_pm_syscore_ops); +return 0 ; } -arch_initcall (s5pv210_pm_drvinit); +arch_initcall (s5pv210_pm_syscore_init);Index:
linux-2.6/arch/arm/mach-exynos4/pm.c
===================================================================arch/arm/mach-exynos4/pm.c +27
-18@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h> @@ -372,7 +373,27 @@ void exynos4_scu_enable(void __iomem *scflush_cache_all (); } -static int exynos4_pm_resume (struct sys_device *dev) +static struct sysdev_driver exynos4_pm_driver = { + .add = exynos4_pm_add, +}; + +static __init int exynos4_pm_drvinit (void ) +{ +unsigned int tmp; + +s3c_pm_init (); + +/* All wakeup disable */ + + tmp =__raw_readl (S5P_WAKEUP_MASK ); + tmp |= ((0xFF <<8 ) | (0x1F <<1 )); +__raw_writel (tmp,S5P_WAKEUP_MASK ); + +return sysdev_driver_register (&exynos4_sysclass, &exynos4_pm_driver); +} +arch_initcall (exynos4_pm_drvinit); + +static void exynos4_pm_resume (void ) {/* For release retention */ @@ -394,27 +415,15 @@ static int exynos4_pm_resume(struct sys_/* enable L2X0*/ writel_relaxed (1 ,S5P_VA_L2CC +L2X0_CTRL );#endif - -return 0 ; } -static struct sysdev_driver exynos4_pm_driver = { - .add = exynos4_pm_add, +static struct syscore_ops exynos4_pm_syscore_ops = { .resume = exynos4_pm_resume, }; -static __init int exynos4_pm_drvinit (void ) +static __init int exynos4_pm_syscore_init (void ) { -unsigned int tmp; - -s3c_pm_init (); - -/* All wakeup disable */ - - tmp =__raw_readl (S5P_WAKEUP_MASK ); - tmp |= ((0xFF <<8 ) | (0x1F <<1 )); -__raw_writel (tmp,S5P_WAKEUP_MASK ); - -return sysdev_driver_register (&exynos4_sysclass, &exynos4_pm_driver); +register_syscore_ops (&exynos4_pm_syscore_ops); +return 0 ; } -arch_initcall (exynos4_pm_drvinit); +arch_initcall (exynos4_pm_syscore_init);Index:
linux-2.6/arch/arm/mach-s3c2410/mach-bast.c
===================================================================arch/arm/mach-s3c2410/mach-bast.c +5
-12@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/dm9000.h> @@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartc/* NAND Flash on BAST board */ #ifdef CONFIG_PM -static int bast_pm_suspend (struct sys_device *sd,pm_message_t state) +static int bast_pm_suspend (void ) {/* ensure that an nRESET is not generated on resume. */ gpio_direction_output (S3C2410_GPA (21 ),1 );return 0 ; } -static int bast_pm_resume (struct sys_device *sd) +static void bast_pm_resume (void ) {s3c_gpio_cfgpin (S3C2410_GPA (21 ), S3C2410_GPA21_nRSTOUT); -return 0 ; }#else @@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_dev#define bast_pm_resume NULL#endif -static struct sysdev_class bast_pm_sysclass = { - .name ="mach-bast" , +static struct syscore_ops bast_pm_syscore_ops = { .suspend = bast_pm_suspend, .resume = bast_pm_resume, }; -static struct sys_device bast_pm_sysdev = { - .cls = &bast_pm_sysclass, -}; -static int smartmedia_map[] = {0 };static int chip0_map[] = {1 };static int chip1_map[] = {2 };@@ -642,8 +636,7 @@ static void __init bast_map_io(void)static void __init bast_init (void ) { -sysdev_class_register (&bast_pm_sysclass); -sysdev_register (&bast_pm_sysdev); +register_syscore_ops (&bast_pm_syscore_ops);s3c_i2c0_set_platdata (&bast_i2c_info);s3c_nand_set_platdata (&bast_nand_info);Index:
linux-2.6/arch/arm/plat-s3c24xx/dma.c
===================================================================arch/arm/plat-s3c24xx/dma.c +26
-42@@ -22,7 +22,7 @@#include <linux/sched.h> #include <linux/spinlock.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/slab.h> #include <linux/errno.h> #include <linux/io.h> @@ -1195,19 +1195,12 @@ int s3c2410_dma_getposition(unsigned intEXPORT_SYMBOL (s3c2410_dma_getposition); -static inline struct s3c2410_dma_chan *to_dma_chan (struct sys_device *dev) -{ - return container_of(dev, struct s3c2410_dma_chan, dev); -} - -/* system device class */ +/* system core operations */ #ifdef CONFIG_PM -static int s3c2410_dma_suspend (struct sys_device *dev,pm_message_t state) +static void s3c2410_dma_suspend_chan (s3c2410_dma_chan *cp) { -struct s3c2410_dma_chan *cp =to_dma_chan (dev); -printk (KERN_DEBUG "suspending dma channel %d\n" , cp->number);if (dma_rdreg (cp,S3C2410_DMA_DMASKTRIG ) &S3C2410_DMASKTRIG_ON ) {@@ -1222,13 +1215,21 @@ static int s3c2410_dma_suspend(struct sys3c2410_dma_dostop (cp); } +} + +static int s3c2410_dma_suspend (void ) +{ +struct s3c2410_dma_chan *cp = s3c2410_chans; +int channel; + +for (channel =0 ; channel < dma_channels; cp++, channel++) +s3c2410_dma_suspend_chan (cp);return 0 ; } -static int s3c2410_dma_resume (struct sys_device *dev) +static void s3c2410_dma_resume_chan (struct s3c2410_dma_chan *cp) { -struct s3c2410_dma_chan *cp =to_dma_chan (dev);unsigned int no = cp->number |DMACH_LOW_LEVEL ;/* restore channel's hardware configuration */ @@ -1249,13 +1250,21 @@ static int s3c2410_dma_resume(struct sys return 0; } +static void s3c2410_dma_resume (void ) +{ +struct s3c2410_dma_chan *cp = s3c2410_chans + dma_channels -1 ; +int channel; + +for (channel = dma_channels -1 ; channel >=0 ; cp++, channel--) +s3c2410_dma_resume_chan (cp); +} +#else #define s3c2410_dma_suspend NULL#define s3c2410_dma_resume NULL#endif /* CONFIG_PM */ -struct sysdev_class dma_sysclass = { - .name ="s3c24xx-dma" , +struct syscore_ops dma_syscore_ops = { .suspend = s3c2410_dma_suspend, .resume = s3c2410_dma_resume, };@@ -1269,39 +1278,14 @@ static void s3c2410_dma_cache_ctor(void/* initialisation code */ -static int __init s3c24xx_dma_sysclass_init (void ) +static int __init s3c24xx_dma_syscore_init (void ) { -int ret =sysdev_class_register (&dma_sysclass); - -if (ret !=0 ) -printk (KERN_ERR "dma sysclass registration failed\n" ); - -return ret; -} - -core_initcall (s3c24xx_dma_sysclass_init); - -static int __init s3c24xx_dma_sysdev_register (void ) -{ -struct s3c2410_dma_chan *cp = s3c2410_chans; -int channel, ret; - -for (channel =0 ; channel < dma_channels; cp++, channel++) { - cp->dev.cls = &dma_sysclass; - cp->dev.id = channel; - ret =sysdev_register (&cp->dev); - -if (ret) { -printk (KERN_ERR "error registering dev for dma %d\n" , - channel); -return ret; - } - } +register_syscore_ops (&dma_syscore_ops);return 0 ; } -late_initcall (s3c24xx_dma_sysdev_register); +late_initcall (s3c24xx_dma_syscore_init);int __init s3c24xx_dma_init (unsigned int channels,unsigned int irq,unsigned int stride)Index:
linux-2.6/arch/arm/mach-s3c2440/mach-osiris.c
===================================================================arch/arm/mach-s3c2440/mach-osiris.c +5
-13@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/gpio.h> #include <linux/device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/clk.h> #include <linux/i2c.h> @@ -284,7 +284,7 @@ static struct platform_device osiris_pcm#ifdef CONFIG_PM static unsigned char pm_osiris_ctrl0; -static int osiris_pm_suspend (struct sys_device *sd,pm_message_t state) +static int osiris_pm_suspend (void ) {unsigned int tmp;@@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_return 0 ; } -static int osiris_pm_resume (struct sys_device *sd) +static void osiris_pm_resume (void ) {if (pm_osiris_ctrl0 &OSIRIS_CTRL0_FIX8 )__raw_writeb (OSIRIS_CTRL1_FIX8 ,OSIRIS_VA_CTRL1 );@@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_d__raw_writeb (pm_osiris_ctrl0,OSIRIS_VA_CTRL0 ); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); - - return 0; }#else @@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_d#define osiris_pm_resume NULL#endif -static struct sysdev_class osiris_pm_sysclass = { - .name ="mach-osiris" , +static struct syscore_ops osiris_pm_syscore_ops = { .suspend = osiris_pm_suspend, .resume = osiris_pm_resume, }; -static struct sys_device osiris_pm_sysdev = { - .cls = &osiris_pm_sysclass, -}; -/* Link for DVS driver to TPS65011 */ static void osiris_tps_release (struct device *dev)@@ -439,8 +432,7 @@ static void __init osiris_map_io(void)static void __init osiris_init (void ) { -sysdev_class_register (&osiris_pm_sysclass); -sysdev_register (&osiris_pm_sysdev); +register_syscore_ops (&osiris_pm_syscore_ops);s3c_i2c0_set_platdata (NULL );s3c_nand_set_platdata (&osiris_nand_info);Index:
linux-2.6/arch/arm/mach-s3c2412/mach-jive.c
===================================================================arch/arm/mach-s3c2412/mach-jive.c +6
-13@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/i2c.h> @@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive/* Jive power management device */ #ifdef CONFIG_PM -static int jive_pm_suspend (struct sys_device *sd,pm_message_t state) +static int jive_pm_suspend (void ) {/* Write the magic value u-boot uses to check for resume into * the INFORM0 register, and ensure INFORM1 is set to the @@ -498,10 +498,9 @@ static int jive_pm_suspend(struct sys_de return 0; } -static int jive_pm_resume (struct sys_device *sd) +static void jive_pm_resume (void ) {__raw_writel (0x0 ,S3C2412_INFORM0 ); -return 0 ; }#else @@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_dev#define jive_pm_resume NULL#endif -static struct sysdev_class jive_pm_sysclass = { - .name ="jive-pm" , +static struct syscore_ops jive_pm_syscore_ops = { .suspend = jive_pm_suspend, .resume = jive_pm_resume, }; -static struct sys_device jive_pm_sysdev = { - .cls = &jive_pm_sysclass, -}; -static void __init jive_map_io (void ) {s3c24xx_init_io (jive_iodesc,ARRAY_SIZE (jive_iodesc));@@ -536,10 +530,9 @@ static void jive_power_off(void)static void __init jive_machine_init (void ) { -/* register system devices for managing low level suspend */ +/* register system core operations for managing low level suspend */ -sysdev_class_register (&jive_pm_sysclass); -sysdev_register (&jive_pm_sysdev); +register_syscore_ops (&jive_pm_syscore_ops);/* write our sleep configurations for the IO. Pull down all unused * IO, ensure that we have turned off all peripherals we do not _______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
Ben Dooks, [email protected], http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear.
Re: [PATCH 6/7] ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiQuoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects 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.
Hmm, does it still allow the system to choose which bits are bound depending on the cpu being registered, as for the s3c stuff it isn't just about the suspend/resume, it's binding items that get registered early in the startup sequence?
Quoted 1,158 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 + arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62 ++++++++++++++-------------- arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68 +++++++++++-------------------- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)Index:
linux-2.6/arch/arm/plat-samsung/include/plat/pm.h
===================================================================arch/arm/plat-samsung/include/plat/pm.h +4
-2@@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struc#ifdef CONFIG_PM extern int s3c_irqext_wake (struct irq_data *data,unsigned int state); -extern int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state); -extern int s3c24xx_irq_resume (struct sys_device *dev); +extern int s3c24xx_irq_suspend (void ); +extern void s3c24xx_irq_resume (void );#else #define s3c_irqext_wake NULL#define s3c24xx_irq_suspend NULL#define s3c24xx_irq_resume NULL#endif +extern struct syscore_ops s3c24xx_irq_syscore_ops; +/* PM debug functions */ #ifdef CONFIG_SAMSUNG_PM_DEBUG Index:
linux-2.6/arch/arm/plat-s5p/irq-pm.c
===================================================================arch/arm/plat-s5p/irq-pm.c +2
-5@@ -16,7 +16,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <plat/cpu.h> #include <plat/irqs.h> @@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = { SAVE_ITEM(S5P_EINT_MASK(3)), }; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {s3c_pm_do_save (eint_save,ARRAY_SIZE (eint_save));return 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {s3c_pm_do_restore (eint_save,ARRAY_SIZE (eint_save)); - -return 0 ; }Index:
linux-2.6/arch/arm/plat-s3c24xx/irq-pm.c
===================================================================arch/arm/plat-s3c24xx/irq-pm.c +2
-5@@ -14,7 +14,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <plat/cpu.h> @@ -65,7 +64,7 @@ static unsigned long save_extint[3];static unsigned long save_eintflt[4 ];static unsigned long save_eintmask; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {unsigned int i;@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_devicreturn 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {unsigned int i;@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_devices3c_pm_do_restore (irq_save,ARRAY_SIZE (irq_save));__raw_writel (save_eintmask,S3C24XX_EINTMASK ); - -return 0 ; }Index:
linux-2.6/arch/arm/mach-s3c2410/irq.c
===================================================================arch/arm/mach-s3c2410/irq.c +2
-28@@ -23,38 +23,12 @@#include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <plat/cpu.h> #include <plat/pm.h> -static int s3c2410_irq_add (struct sys_device *sysdev) -{ -return 0 ; -} - -static struct sysdev_driver s3c2410_irq_driver = { - .add = s3c2410_irq_add, +struct syscore_ops s3c24xx_irq_syscore_ops = { .suspend = s3c24xx_irq_suspend, .resume = s3c24xx_irq_resume, }; - -static int __init s3c2410_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410_sysclass, &s3c2410_irq_driver); -} - -arch_initcall (s3c2410_irq_init); - -static struct sysdev_driver s3c2410a_irq_driver = { - .add = s3c2410_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, -}; - -static int __init s3c2410a_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410a_sysclass, &s3c2410a_irq_driver); -} - -arch_initcall (s3c2410a_irq_init);Index:
linux-2.6/arch/arm/mach-s3c2410/pm.c
===================================================================arch/arm/mach-s3c2410/pm.c +6
-7@@ -25,6 +25,7 @@#include <linux/errno.h> #include <linux/time.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/io.h> @@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void) } } -static int s3c2410_pm_resume (struct sys_device *dev) +static void s3c2410_pm_resume (void ) {unsigned long tmp;@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_if (machine_is_aml_m5900 () )s3c2410_gpio_setpin (S3C2410_GPF (2 ),0 ); - -return 0 ; } +struct syscore_ops s3c2410_pm_syscore_ops = { + .resume = s3c2410_pm_resume, +}; +static int s3c2410_pm_add (struct sys_device *dev) { pm_cpu_prep = s3c2410_pm_prepare;@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_dev#if defined(CONFIG_CPU_S3C2410 )static struct sysdev_driver s3c2410_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };/* register ourselves */ @@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);static struct sysdev_driver s3c2410a_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2410a_pm_drvinit (void )@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);#if defined(CONFIG_CPU_S3C2440 )static struct sysdev_driver s3c2440_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2440_pm_drvinit (void )@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);#if defined(CONFIG_CPU_S3C2442 )static struct sysdev_driver s3c2442_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2442_pm_drvinit (void )Index:
linux-2.6/arch/arm/plat-samsung/include/plat/cpu.h
===================================================================arch/arm/plat-samsung/include/plat/cpu.h +6
-0@@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *struct sys_timer ;extern struct sys_timer s3c24xx_timer; +extern struct syscore_ops s3c2410_pm_syscore_ops; +extern struct syscore_ops s3c2412_pm_syscore_ops; +extern struct syscore_ops s3c2416_pm_syscore_ops; +extern struct syscore_ops s3c244x_pm_syscore_ops; +extern struct syscore_ops s3c64xx_irq_syscore_ops; +/* system device classes */ extern struct sysdev_class s3c2410_sysclass;Index:
linux-2.6/arch/arm/mach-s3c2410/s3c2410.c
===================================================================arch/arm/mach-s3c2410/s3c2410.c +5
-0@@ -19,6 +19,7 @@#include <linux/gpio.h> #include <linux/clk.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -40,6 +41,7 @@#include <plat/devs.h> #include <plat/clock.h> #include <plat/pll.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -168,6 +170,9 @@ int __init s3c2410_init(void) {printk ("S3C2410: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2410_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2412/irq.c
===================================================================arch/arm/mach-s3c2412/irq.c +0
-2@@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_destatic struct sysdev_driver s3c2412_irq_driver = { .add = s3c2412_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2412_irq_init (void )Index:
linux-2.6/arch/arm/mach-s3c2412/pm.c
===================================================================arch/arm/mach-s3c2412/pm.c +15
-12@@ -17,6 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] SAVE_ITEM(S3C2413_GPJSLPCON), }; -static int s3c2412_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2412_pm_driver = { + .add = s3c2412_pm_add, +}; + +static __init int s3c2412_pm_init (void ) +{ +return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); +} + +arch_initcall (s3c2412_pm_init); + +static int s3c2412_pm_suspend (void ) {s3c_pm_do_save (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep));return 0 ; } -static int s3c2412_pm_resume (struct sys_device *dev) +static void s3c2412_pm_resume (void ) {unsigned long tmp;@@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys___raw_writel (tmp,S3C2412_PWRCFG );s3c_pm_do_restore (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep)); -return 0 ; } -static struct sysdev_driver s3c2412_pm_driver = { - .add = s3c2412_pm_add, +struct syscore_ops s3c2412_pm_syscore_ops = { .suspend = s3c2412_pm_suspend, .resume = s3c2412_pm_resume, }; - -static __init int s3c2412_pm_init (void ) -{ -return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); -} - -arch_initcall (s3c2412_pm_init);Index:
linux-2.6/arch/arm/mach-s3c2412/s3c2412.c
===================================================================arch/arm/mach-s3c2412/s3c2412.c +4
-0@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> @@ -244,5 +245,8 @@ int __init s3c2412_init(void) {printk ("S3C2412: Initialising architecture\n" ); +register_syscore_ops (&s3c2412_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2412_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2416/irq.c
===================================================================arch/arm/mach-s3c2416/irq.c +0
-2@@ -238,8 +238,6 @@ static int __init s3c2416_irq_add(structstatic struct sysdev_driver s3c2416_irq_driver = { .add = s3c2416_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int __init s3c2416_irq_init (void )Index:
linux-2.6/arch/arm/mach-s3c2416/pm.c
===================================================================arch/arm/mach-s3c2416/pm.c +12
-15@@ -11,6 +11,7 @@*/ #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h> @@ -55,30 +56,26 @@ static int s3c2416_pm_add(struct sys_devreturn 0 ; } -static int s3c2416_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2416_pm_driver = { + .add = s3c2416_pm_add, +}; + +static __init int s3c2416_pm_init (void ) { -return 0 ; +return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); } -static int s3c2416_pm_resume (struct sys_device *dev) +arch_initcall (s3c2416_pm_init); + + +static void s3c2416_pm_resume (void ) {/* unset the return-from-sleep amd inform flags */ __raw_writel (0x0 ,S3C2443_PWRMODE );__raw_writel (0x0 ,S3C2412_INFORM0 );__raw_writel (0x0 ,S3C2412_INFORM1 ); - -return 0 ; } -static struct sysdev_driver s3c2416_pm_driver = { - .add = s3c2416_pm_add, - .suspend = s3c2416_pm_suspend, +struct syscore_ops s3c2416_pm_syscore_ops = { .resume = s3c2416_pm_resume, }; - -static __init int s3c2416_pm_init (void ) -{ -return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); -} - -arch_initcall (s3c2416_pm_init);Index:
linux-2.6/arch/arm/mach-s3c2416/s3c2416.c
===================================================================arch/arm/mach-s3c2416/s3c2416.c +5
-0@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h> @@ -54,6 +55,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/sdhci.h> +#include <plat/pm.h> #include <plat/iic-core.h> #include <plat/fb-core.h> @@ -95,6 +97,9 @@ int __init s3c2416_init(void)s3c_fb_setname ("s3c2443-fb" ); +register_syscore_ops (&s3c2416_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2416_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c2440/s3c244x-irq.c
===================================================================arch/arm/mach-s3c2440/s3c244x-irq.c +0
-4@@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_destatic struct sysdev_driver s3c2440_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2440_irq_init (void )@@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);static struct sysdev_driver s3c2442_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };Index:
linux-2.6/arch/arm/mach-s3c2440/s3c244x.c
===================================================================arch/arm/mach-s3c2440/s3c244x.c +31
-31@@ -19,6 +19,7 @@#include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h> @@ -134,45 +135,14 @@ void __init s3c244x_init_clocks(int xtals3c2410_baseclk_add (); } -#ifdef CONFIG_PM - -static struct sleep_save s3c244x_sleep[] = { -SAVE_ITEM (S3C2440_DSC0 ), -SAVE_ITEM (S3C2440_DSC1 ), -SAVE_ITEM (S3C2440_GPJDAT ), -SAVE_ITEM (S3C2440_GPJCON ), -SAVE_ITEM (S3C2440_GPJUP ) -}; - -static int s3c244x_suspend (struct sys_device *dev,pm_message_t state) -{ -s3c_pm_do_save (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); -return 0 ; -} - -static int s3c244x_resume (struct sys_device *dev) -{ -s3c_pm_do_restore (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); -return 0 ; -} - -#else -#define s3c244x_suspend NULL -#define s3c244x_resume NULL -#endif -/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */ struct sysdev_class s3c2440_sysclass = { .name ="s3c2440-core" , - .suspend = s3c244x_suspend, - .resume = s3c244x_resume };struct sysdev_class s3c2442_sysclass = { .name ="s3c2442-core" , - .suspend = s3c244x_suspend, - .resume = s3c244x_resume };/* need to register class before we actually register the device, and @@ -194,3 +164,33 @@ static int __init s3c2442_core_init(void }core_initcall (s3c2442_core_init); + + +#ifdef CONFIG_PM +static struct sleep_save s3c244x_sleep[] = { +SAVE_ITEM (S3C2440_DSC0 ), +SAVE_ITEM (S3C2440_DSC1 ), +SAVE_ITEM (S3C2440_GPJDAT ), +SAVE_ITEM (S3C2440_GPJCON ), +SAVE_ITEM (S3C2440_GPJUP ) +}; + +static int s3c244x_suspend (void ) +{ +s3c_pm_do_save (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); +return 0 ; +} + +static void s3c244x_resume (void ) +{ +s3c_pm_do_restore (s3c244x_sleep,ARRAY_SIZE (s3c244x_sleep)); +} +#else +#define s3c244x_suspend NULL +#define s3c244x_resume NULL +#endif + +struct syscore_ops s3c244x_pm_syscore_ops = { + .suspend = s3c244x_suspend, + .resume = s3c244x_resume, +};Index:
linux-2.6/arch/arm/mach-s3c2440/s3c2440.c
===================================================================arch/arm/mach-s3c2440/s3c2440.c +8
-0@@ -19,6 +19,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h> @@ -33,6 +34,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -51,6 +53,12 @@ int __init s3c2440_init(void) s3c_device_wdt.resource[1 ].start =IRQ_S3C2440_WDT ; s3c_device_wdt.resource[1 ].end =IRQ_S3C2440_WDT ; +/* register suspend/resume handlers */ + +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +/* register our system device for everything else */ return sysdev_register (&s3c2440_sysdev);Index:
linux-2.6/arch/arm/mach-s3c2440/s3c2442.c
===================================================================arch/arm/mach-s3c2440/s3c2442.c +6
-0@@ -29,6 +29,7 @@#include <linux/err.h> #include <linux/device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/mutex.h> @@ -45,6 +46,7 @@#include <plat/clock.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h> @@ -167,6 +169,10 @@ int __init s3c2442_init(void) {printk ("S3C2442: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2442_sysdev); }Index:
linux-2.6/arch/arm/mach-s3c64xx/irq-pm.c
===================================================================arch/arm/mach-s3c64xx/irq-pm.c +9
-9@@ -13,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/serial_core.h> #include <linux/irq.h> @@ -54,7 +54,7 @@ static struct irq_grp_save {static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS ]; -static int s3c64xx_irq_pm_suspend (struct sys_device *dev,pm_message_t state) +static int s3c64xx_irq_pm_suspend (void ) {struct irq_grp_save *grp = eint_grp_save;int i;@@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(structreturn 0 ; } -static int s3c64xx_irq_pm_resume (struct sys_device *dev) +static void s3c64xx_irq_pm_resume (void ) {struct irq_grp_save *grp = eint_grp_save;int i;@@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct }S3C_PMDBG ("%s: IRQ configuration restored\n" , __func__); -return 0 ; } -static struct sysdev_driver s3c64xx_irq_driver = { +struct syscore_ops s3c64xx_irq_syscore_ops = { .suspend = s3c64xx_irq_pm_suspend, .resume = s3c64xx_irq_pm_resume, }; -static int __init s3c64xx_irq_pm_init (void ) +static __init int s3c64xx_syscore_init (void ) { -return sysdev_driver_register (&s3c64xx_sysclass, &s3c64xx_irq_driver); -} +register_syscore_ops (&s3c64xx_irq_syscore_ops); -arch_initcall (s3c64xx_irq_pm_init); +return 0 ; +} +core_initcall (s3c64xx_syscore_init);Index:
linux-2.6/arch/arm/mach-s5pv210/pm.c
===================================================================arch/arm/mach-s5pv210/pm.c +17
-8@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <plat/cpu.h> @@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_devreturn 0 ; } -static int s5pv210_pm_resume (struct sys_device *dev) +static struct sysdev_driver s5pv210_pm_driver = { + .add = s5pv210_pm_add, +}; + +static __init int s5pv210_pm_drvinit (void ) +{ +return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +} +arch_initcall (s5pv210_pm_drvinit); + +static void s5pv210_pm_resume (void ) {u32 tmp;@@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys___raw_writel (tmp ,S5P_OTHERS );s3c_pm_do_restore_core (s5pv210_core_save,ARRAY_SIZE (s5pv210_core_save)); - -return 0 ; } -static struct sysdev_driver s5pv210_pm_driver = { - .add = s5pv210_pm_add, +static struct syscore_ops s5pv210_pm_syscore_ops = { .resume = s5pv210_pm_resume, }; -static __init int s5pv210_pm_drvinit (void ) +static __init int s5pv210_pm_syscore_init (void ) { -return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +register_syscore_ops (&s5pv210_pm_syscore_ops); +return 0 ; } -arch_initcall (s5pv210_pm_drvinit); +arch_initcall (s5pv210_pm_syscore_init);Index:
linux-2.6/arch/arm/mach-exynos4/pm.c
===================================================================arch/arm/mach-exynos4/pm.c +27
-18@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h> @@ -372,7 +373,27 @@ void exynos4_scu_enable(void __iomem *scflush_cache_all (); } -static int exynos4_pm_resume (struct sys_device *dev) +static struct sysdev_driver exynos4_pm_driver = { + .add = exynos4_pm_add, +}; + +static __init int exynos4_pm_drvinit (void ) +{ +unsigned int tmp; + +s3c_pm_init (); + +/* All wakeup disable */ + + tmp =__raw_readl (S5P_WAKEUP_MASK ); + tmp |= ((0xFF <<8 ) | (0x1F <<1 )); +__raw_writel (tmp,S5P_WAKEUP_MASK ); + +return sysdev_driver_register (&exynos4_sysclass, &exynos4_pm_driver); +} +arch_initcall (exynos4_pm_drvinit); + +static void exynos4_pm_resume (void ) {/* For release retention */ @@ -394,27 +415,15 @@ static int exynos4_pm_resume(struct sys_/* enable L2X0*/ writel_relaxed (1 ,S5P_VA_L2CC +L2X0_CTRL );#endif - -return 0 ; } -static struct sysdev_driver exynos4_pm_driver = { - .add = exynos4_pm_add, +static struct syscore_ops exynos4_pm_syscore_ops = { .resume = exynos4_pm_resume, }; -static __init int exynos4_pm_drvinit (void ) +static __init int exynos4_pm_syscore_init (void ) { -unsigned int tmp; - -s3c_pm_init (); - -/* All wakeup disable */ - - tmp =__raw_readl (S5P_WAKEUP_MASK ); - tmp |= ((0xFF <<8 ) | (0x1F <<1 )); -__raw_writel (tmp,S5P_WAKEUP_MASK ); - -return sysdev_driver_register (&exynos4_sysclass, &exynos4_pm_driver); +register_syscore_ops (&exynos4_pm_syscore_ops); +return 0 ; } -arch_initcall (exynos4_pm_drvinit); +arch_initcall (exynos4_pm_syscore_init);Index:
linux-2.6/arch/arm/mach-s3c2410/mach-bast.c
===================================================================arch/arm/mach-s3c2410/mach-bast.c +5
-12@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/dm9000.h> @@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartc/* NAND Flash on BAST board */ #ifdef CONFIG_PM -static int bast_pm_suspend (struct sys_device *sd,pm_message_t state) +static int bast_pm_suspend (void ) {/* ensure that an nRESET is not generated on resume. */ gpio_direction_output (S3C2410_GPA (21 ),1 );return 0 ; } -static int bast_pm_resume (struct sys_device *sd) +static void bast_pm_resume (void ) {s3c_gpio_cfgpin (S3C2410_GPA (21 ), S3C2410_GPA21_nRSTOUT); -return 0 ; }#else @@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_dev#define bast_pm_resume NULL#endif -static struct sysdev_class bast_pm_sysclass = { - .name ="mach-bast" , +static struct syscore_ops bast_pm_syscore_ops = { .suspend = bast_pm_suspend, .resume = bast_pm_resume, }; -static struct sys_device bast_pm_sysdev = { - .cls = &bast_pm_sysclass, -}; -static int smartmedia_map[] = {0 };static int chip0_map[] = {1 };static int chip1_map[] = {2 };@@ -642,8 +636,7 @@ static void __init bast_map_io(void)static void __init bast_init (void ) { -sysdev_class_register (&bast_pm_sysclass); -sysdev_register (&bast_pm_sysdev); +register_syscore_ops (&bast_pm_syscore_ops);s3c_i2c0_set_platdata (&bast_i2c_info);s3c_nand_set_platdata (&bast_nand_info);Index:
linux-2.6/arch/arm/plat-s3c24xx/dma.c
===================================================================arch/arm/plat-s3c24xx/dma.c +26
-42@@ -22,7 +22,7 @@#include <linux/sched.h> #include <linux/spinlock.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/slab.h> #include <linux/errno.h> #include <linux/io.h> @@ -1195,19 +1195,12 @@ int s3c2410_dma_getposition(unsigned intEXPORT_SYMBOL (s3c2410_dma_getposition); -static inline struct s3c2410_dma_chan *to_dma_chan (struct sys_device *dev) -{ - return container_of(dev, struct s3c2410_dma_chan, dev); -} - -/* system device class */ +/* system core operations */ #ifdef CONFIG_PM -static int s3c2410_dma_suspend (struct sys_device *dev,pm_message_t state) +static void s3c2410_dma_suspend_chan (s3c2410_dma_chan *cp) { -struct s3c2410_dma_chan *cp =to_dma_chan (dev); -printk (KERN_DEBUG "suspending dma channel %d\n" , cp->number);if (dma_rdreg (cp,S3C2410_DMA_DMASKTRIG ) &S3C2410_DMASKTRIG_ON ) {@@ -1222,13 +1215,21 @@ static int s3c2410_dma_suspend(struct sys3c2410_dma_dostop (cp); } +} + +static int s3c2410_dma_suspend (void ) +{ +struct s3c2410_dma_chan *cp = s3c2410_chans; +int channel; + +for (channel =0 ; channel < dma_channels; cp++, channel++) +s3c2410_dma_suspend_chan (cp);return 0 ; } -static int s3c2410_dma_resume (struct sys_device *dev) +static void s3c2410_dma_resume_chan (struct s3c2410_dma_chan *cp) { -struct s3c2410_dma_chan *cp =to_dma_chan (dev);unsigned int no = cp->number |DMACH_LOW_LEVEL ;/* restore channel's hardware configuration */ @@ -1249,13 +1250,21 @@ static int s3c2410_dma_resume(struct sys return 0; } +static void s3c2410_dma_resume (void ) +{ +struct s3c2410_dma_chan *cp = s3c2410_chans + dma_channels -1 ; +int channel; + +for (channel = dma_channels -1 ; channel >=0 ; cp++, channel--) +s3c2410_dma_resume_chan (cp); +} +#else #define s3c2410_dma_suspend NULL#define s3c2410_dma_resume NULL#endif /* CONFIG_PM */ -struct sysdev_class dma_sysclass = { - .name ="s3c24xx-dma" , +struct syscore_ops dma_syscore_ops = { .suspend = s3c2410_dma_suspend, .resume = s3c2410_dma_resume, };@@ -1269,39 +1278,14 @@ static void s3c2410_dma_cache_ctor(void/* initialisation code */ -static int __init s3c24xx_dma_sysclass_init (void ) +static int __init s3c24xx_dma_syscore_init (void ) { -int ret =sysdev_class_register (&dma_sysclass); - -if (ret !=0 ) -printk (KERN_ERR "dma sysclass registration failed\n" ); - -return ret; -} - -core_initcall (s3c24xx_dma_sysclass_init); - -static int __init s3c24xx_dma_sysdev_register (void ) -{ -struct s3c2410_dma_chan *cp = s3c2410_chans; -int channel, ret; - -for (channel =0 ; channel < dma_channels; cp++, channel++) { - cp->dev.cls = &dma_sysclass; - cp->dev.id = channel; - ret =sysdev_register (&cp->dev); - -if (ret) { -printk (KERN_ERR "error registering dev for dma %d\n" , - channel); -return ret; - } - } +register_syscore_ops (&dma_syscore_ops);return 0 ; } -late_initcall (s3c24xx_dma_sysdev_register); +late_initcall (s3c24xx_dma_syscore_init);int __init s3c24xx_dma_init (unsigned int channels,unsigned int irq,unsigned int stride)Index:
linux-2.6/arch/arm/mach-s3c2440/mach-osiris.c
===================================================================arch/arm/mach-s3c2440/mach-osiris.c +5
-13@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/gpio.h> #include <linux/device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/clk.h> #include <linux/i2c.h> @@ -284,7 +284,7 @@ static struct platform_device osiris_pcm#ifdef CONFIG_PM static unsigned char pm_osiris_ctrl0; -static int osiris_pm_suspend (struct sys_device *sd,pm_message_t state) +static int osiris_pm_suspend (void ) {unsigned int tmp;@@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_return 0 ; } -static int osiris_pm_resume (struct sys_device *sd) +static void osiris_pm_resume (void ) {if (pm_osiris_ctrl0 &OSIRIS_CTRL0_FIX8 )__raw_writeb (OSIRIS_CTRL1_FIX8 ,OSIRIS_VA_CTRL1 );@@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_d__raw_writeb (pm_osiris_ctrl0,OSIRIS_VA_CTRL0 ); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); - - return 0; }#else @@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_d#define osiris_pm_resume NULL#endif -static struct sysdev_class osiris_pm_sysclass = { - .name ="mach-osiris" , +static struct syscore_ops osiris_pm_syscore_ops = { .suspend = osiris_pm_suspend, .resume = osiris_pm_resume, }; -static struct sys_device osiris_pm_sysdev = { - .cls = &osiris_pm_sysclass, -}; -/* Link for DVS driver to TPS65011 */ static void osiris_tps_release (struct device *dev)@@ -439,8 +432,7 @@ static void __init osiris_map_io(void)static void __init osiris_init (void ) { -sysdev_class_register (&osiris_pm_sysclass); -sysdev_register (&osiris_pm_sysdev); +register_syscore_ops (&osiris_pm_syscore_ops);s3c_i2c0_set_platdata (NULL );s3c_nand_set_platdata (&osiris_nand_info);Index:
linux-2.6/arch/arm/mach-s3c2412/mach-jive.c
===================================================================arch/arm/mach-s3c2412/mach-jive.c +6
-13@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/i2c.h> @@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive/* Jive power management device */ #ifdef CONFIG_PM -static int jive_pm_suspend (struct sys_device *sd,pm_message_t state) +static int jive_pm_suspend (void ) {/* Write the magic value u-boot uses to check for resume into * the INFORM0 register, and ensure INFORM1 is set to the @@ -498,10 +498,9 @@ static int jive_pm_suspend(struct sys_de return 0; } -static int jive_pm_resume (struct sys_device *sd) +static void jive_pm_resume (void ) {__raw_writel (0x0 ,S3C2412_INFORM0 ); -return 0 ; }#else @@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_dev#define jive_pm_resume NULL#endif -static struct sysdev_class jive_pm_sysclass = { - .name ="jive-pm" , +static struct syscore_ops jive_pm_syscore_ops = { .suspend = jive_pm_suspend, .resume = jive_pm_resume, }; -static struct sys_device jive_pm_sysdev = { - .cls = &jive_pm_sysclass, -}; -static void __init jive_map_io (void ) {s3c24xx_init_io (jive_iodesc,ARRAY_SIZE (jive_iodesc));@@ -536,10 +530,9 @@ static void jive_power_off(void)static void __init jive_machine_init (void ) { -/* register system devices for managing low level suspend */ +/* register system core operations for managing low level suspend */ -sysdev_class_register (&jive_pm_sysclass); -sysdev_register (&jive_pm_sysdev); +register_syscore_ops (&jive_pm_syscore_ops);/* write our sleep configurations for the IO. Pull down all unused * IO, ensure that we have turned off all peripherals we do not _______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 9 lines
Ben Dooks, [email protected], http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear. _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 6/7 ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 + arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62 ++++++++++++++-------------- arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68 +++++++++++-------------------- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)
arch/arm/plat-samsung/include/plat/pm.h +4 -2
@@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struc#ifdef CONFIG_PM extern int s3c_irqext_wake (struct irq_data *data,unsigned int state); -extern int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state); -extern int s3c24xx_irq_resume (struct sys_device *dev); +extern int s3c24xx_irq_suspend (void ); +extern void s3c24xx_irq_resume (void );#else #define s3c_irqext_wake NULL#define s3c24xx_irq_suspend NULL#define s3c24xx_irq_resume NULL#endif +extern struct syscore_ops s3c24xx_irq_syscore_ops; +/* PM debug functions */ #ifdef CONFIG_SAMSUNG_PM_DEBUG
arch/arm/plat-s5p/irq-pm.c +2 -5
@@ -16,7 +16,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <plat/cpu.h> #include <plat/irqs.h>
@@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = { SAVE_ITEM(S5P_EINT_MASK(3)), }; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {s3c_pm_do_save (eint_save,ARRAY_SIZE (eint_save));return 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {s3c_pm_do_restore (eint_save,ARRAY_SIZE (eint_save)); - -return 0 ; }
arch/arm/plat-s3c24xx/irq-pm.c +2 -5
@@ -14,7 +14,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <plat/cpu.h>
@@ -65,7 +64,7 @@ static unsigned long save_extint[3];static unsigned long save_eintflt[4 ];static unsigned long save_eintmask; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {unsigned int i;
@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_devicreturn 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {unsigned int i;
@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_devices3c_pm_do_restore (irq_save,ARRAY_SIZE (irq_save));__raw_writel (save_eintmask,S3C24XX_EINTMASK ); - -return 0 ; }
arch/arm/mach-s3c2410/irq.c +2 -28
@@ -23,38 +23,12 @@#include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <plat/cpu.h> #include <plat/pm.h> -static int s3c2410_irq_add (struct sys_device *sysdev) -{ -return 0 ; -} - -static struct sysdev_driver s3c2410_irq_driver = { - .add = s3c2410_irq_add, +struct syscore_ops s3c24xx_irq_syscore_ops = { .suspend = s3c24xx_irq_suspend, .resume = s3c24xx_irq_resume, }; - -static int __init s3c2410_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410_sysclass, &s3c2410_irq_driver); -} - -arch_initcall (s3c2410_irq_init); - -static struct sysdev_driver s3c2410a_irq_driver = { - .add = s3c2410_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, -}; - -static int __init s3c2410a_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410a_sysclass, &s3c2410a_irq_driver); -} - -arch_initcall (s3c2410a_irq_init);
arch/arm/mach-s3c2410/pm.c +6 -7
@@ -25,6 +25,7 @@#include <linux/errno.h> #include <linux/time.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/io.h>
@@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void) } } -static int s3c2410_pm_resume (struct sys_device *dev) +static void s3c2410_pm_resume (void ) {unsigned long tmp;
@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_if (machine_is_aml_m5900 () )s3c2410_gpio_setpin (S3C2410_GPF (2 ),0 ); - -return 0 ; } +struct syscore_ops s3c2410_pm_syscore_ops = { + .resume = s3c2410_pm_resume, +}; +static int s3c2410_pm_add (struct sys_device *dev) { pm_cpu_prep = s3c2410_pm_prepare;
@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_dev#if defined(CONFIG_CPU_S3C2410 )static struct sysdev_driver s3c2410_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };/* register ourselves */
@@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);static struct sysdev_driver s3c2410a_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2410a_pm_drvinit (void )
@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);#if defined(CONFIG_CPU_S3C2440 )static struct sysdev_driver s3c2440_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2440_pm_drvinit (void )
@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);#if defined(CONFIG_CPU_S3C2442 )static struct sysdev_driver s3c2442_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2442_pm_drvinit (void )
arch/arm/plat-samsung/include/plat/cpu.h +6 -0
@@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *struct sys_timer ;extern struct sys_timer s3c24xx_timer; +extern struct syscore_ops s3c2410_pm_syscore_ops; +extern struct syscore_ops s3c2412_pm_syscore_ops; +extern struct syscore_ops s3c2416_pm_syscore_ops; +extern struct syscore_ops s3c244x_pm_syscore_ops; +extern struct syscore_ops s3c64xx_irq_syscore_ops; +/* system device classes */ extern struct sysdev_class s3c2410_sysclass;
arch/arm/mach-s3c2410/s3c2410.c +5 -0
@@ -19,6 +19,7 @@#include <linux/gpio.h> #include <linux/clk.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -40,6 +41,7 @@#include <plat/devs.h> #include <plat/clock.h> #include <plat/pll.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -168,6 +170,9 @@ int __init s3c2410_init(void) {printk ("S3C2410: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2410_sysdev); }
arch/arm/mach-s3c2412/irq.c +0 -2
@@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_destatic struct sysdev_driver s3c2412_irq_driver = { .add = s3c2412_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2412_irq_init (void )
arch/arm/mach-s3c2412/pm.c +15 -12
@@ -17,6 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] SAVE_ITEM(S3C2413_GPJSLPCON), }; -static int s3c2412_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2412_pm_driver = { + .add = s3c2412_pm_add, +}; + +static __init int s3c2412_pm_init (void ) +{ +return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); +} + +arch_initcall (s3c2412_pm_init); + +static int s3c2412_pm_suspend (void ) {s3c_pm_do_save (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep));return 0 ; } -static int s3c2412_pm_resume (struct sys_device *dev) +static void s3c2412_pm_resume (void ) {unsigned long tmp;
@@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys___raw_writel (tmp,S3C2412_PWRCFG );s3c_pm_do_restore (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep)); -return 0 ; } -static struct sysdev_driver s3c2412_pm_driver = { - .add = s3c2412_pm_add, +struct syscore_ops s3c2412_pm_syscore_ops = { .suspend = s3c2412_pm_suspend, .resume = s3c2412_pm_resume, }; - -static __init int s3c2412_pm_init (void ) -{ -return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); -} - -arch_initcall (s3c2412_pm_init);
arch/arm/mach-s3c2412/s3c2412.c +4 -0
@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -244,5 +245,8 @@ int __init s3c2412_init(void) {printk ("S3C2412: Initialising architecture\n" ); +register_syscore_ops (&s3c2412_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2412_sysdev); }
arch/arm/mach-s3c2416/irq.c +0 -2
@@ -238,8 +238,6 @@ static int __init s3c2416_irq_add(structstatic struct sysdev_driver s3c2416_irq_driver = { .add = s3c2416_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int __init s3c2416_irq_init (void )
arch/arm/mach-s3c2416/pm.c +12 -15
@@ -11,6 +11,7 @@*/ #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h>
@@ -55,30 +56,26 @@ static int s3c2416_pm_add(struct sys_devreturn 0 ; } -static int s3c2416_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2416_pm_driver = { + .add = s3c2416_pm_add, +}; + +static __init int s3c2416_pm_init (void ) { -return 0 ; +return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); } -static int s3c2416_pm_resume (struct sys_device *dev) +arch_initcall (s3c2416_pm_init); + + +static void s3c2416_pm_resume (void ) {/* unset the return-from-sleep amd inform flags */ __raw_writel (0x0 ,S3C2443_PWRMODE );__raw_writel (0x0 ,S3C2412_INFORM0 );__raw_writel (0x0 ,S3C2412_INFORM1 ); - -return 0 ; } -static struct sysdev_driver s3c2416_pm_driver = { - .add = s3c2416_pm_add, - .suspend = s3c2416_pm_suspend, +struct syscore_ops s3c2416_pm_syscore_ops = { .resume = s3c2416_pm_resume, }; - -static __init int s3c2416_pm_init (void ) -{ -return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); -} - -arch_initcall (s3c2416_pm_init);
arch/arm/mach-s3c2416/s3c2416.c +5 -0
@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h>
@@ -54,6 +55,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/sdhci.h> +#include <plat/pm.h> #include <plat/iic-core.h> #include <plat/fb-core.h>
@@ -95,6 +97,9 @@ int __init s3c2416_init(void)s3c_fb_setname ("s3c2443-fb" ); +register_syscore_ops (&s3c2416_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2416_sysdev); }
arch/arm/mach-s3c2440/s3c244x-irq.c +0 -4
@@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_destatic struct sysdev_driver s3c2440_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2440_irq_init (void )
@@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);static struct sysdev_driver s3c2442_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };
arch/arm/mach-s3c2440/s3c244x.c +31 -31
85 lines not on this page · raw message
arch/arm/mach-s3c2440/s3c2440.c +8 -0
@@ -19,6 +19,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h>
@@ -33,6 +34,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -51,6 +53,12 @@ int __init s3c2440_init(void) s3c_device_wdt.resource[1 ].start =IRQ_S3C2440_WDT ; s3c_device_wdt.resource[1 ].end =IRQ_S3C2440_WDT ; +/* register suspend/resume handlers */ + +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +/* register our system device for everything else */ return sysdev_register (&s3c2440_sysdev);
arch/arm/mach-s3c2440/s3c2442.c +6 -0
@@ -29,6 +29,7 @@#include <linux/err.h> #include <linux/device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/mutex.h>
@@ -45,6 +46,7 @@#include <plat/clock.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -167,6 +169,10 @@ int __init s3c2442_init(void) {printk ("S3C2442: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2442_sysdev); }
arch/arm/mach-s3c64xx/irq-pm.c +9 -9
@@ -13,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/serial_core.h> #include <linux/irq.h>
@@ -54,7 +54,7 @@ static struct irq_grp_save {static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS ]; -static int s3c64xx_irq_pm_suspend (struct sys_device *dev,pm_message_t state) +static int s3c64xx_irq_pm_suspend (void ) {struct irq_grp_save *grp = eint_grp_save;int i;
@@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(structreturn 0 ; } -static int s3c64xx_irq_pm_resume (struct sys_device *dev) +static void s3c64xx_irq_pm_resume (void ) {struct irq_grp_save *grp = eint_grp_save;int i;
@@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct }S3C_PMDBG ("%s: IRQ configuration restored\n" , __func__); -return 0 ; } -static struct sysdev_driver s3c64xx_irq_driver = { +struct syscore_ops s3c64xx_irq_syscore_ops = { .suspend = s3c64xx_irq_pm_suspend, .resume = s3c64xx_irq_pm_resume, }; -static int __init s3c64xx_irq_pm_init (void ) +static __init int s3c64xx_syscore_init (void ) { -return sysdev_driver_register (&s3c64xx_sysclass, &s3c64xx_irq_driver); -} +register_syscore_ops (&s3c64xx_irq_syscore_ops); -arch_initcall (s3c64xx_irq_pm_init); +return 0 ; +} +core_initcall (s3c64xx_syscore_init);
arch/arm/mach-s5pv210/pm.c +17 -8
@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <plat/cpu.h>
@@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_devreturn 0 ; } -static int s5pv210_pm_resume (struct sys_device *dev) +static struct sysdev_driver s5pv210_pm_driver = { + .add = s5pv210_pm_add, +}; + +static __init int s5pv210_pm_drvinit (void ) +{ +return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +} +arch_initcall (s5pv210_pm_drvinit); + +static void s5pv210_pm_resume (void ) {u32 tmp;
@@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys___raw_writel (tmp ,S5P_OTHERS );s3c_pm_do_restore_core (s5pv210_core_save,ARRAY_SIZE (s5pv210_core_save)); - -return 0 ; } -static struct sysdev_driver s5pv210_pm_driver = { - .add = s5pv210_pm_add, +static struct syscore_ops s5pv210_pm_syscore_ops = { .resume = s5pv210_pm_resume, }; -static __init int s5pv210_pm_drvinit (void ) +static __init int s5pv210_pm_syscore_init (void ) { -return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +register_syscore_ops (&s5pv210_pm_syscore_ops); +return 0 ; } -arch_initcall (s5pv210_pm_drvinit); +arch_initcall (s5pv210_pm_syscore_init);
arch/arm/mach-exynos4/pm.c +27 -18
67 lines not on this page · raw message
arch/arm/mach-s3c2410/mach-bast.c +5 -12
@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/dm9000.h>
@@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartc/* NAND Flash on BAST board */ #ifdef CONFIG_PM -static int bast_pm_suspend (struct sys_device *sd,pm_message_t state) +static int bast_pm_suspend (void ) {/* ensure that an nRESET is not generated on resume. */ gpio_direction_output (S3C2410_GPA (21 ),1 );return 0 ; } -static int bast_pm_resume (struct sys_device *sd) +static void bast_pm_resume (void ) {s3c_gpio_cfgpin (S3C2410_GPA (21 ), S3C2410_GPA21_nRSTOUT); -return 0 ; }#else
@@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_dev#define bast_pm_resume NULL#endif -static struct sysdev_class bast_pm_sysclass = { - .name ="mach-bast" , +static struct syscore_ops bast_pm_syscore_ops = { .suspend = bast_pm_suspend, .resume = bast_pm_resume, }; -static struct sys_device bast_pm_sysdev = { - .cls = &bast_pm_sysclass, -}; -static int smartmedia_map[] = {0 };static int chip0_map[] = {1 };static int chip1_map[] = {2 };
@@ -642,8 +636,7 @@ static void __init bast_map_io(void)static void __init bast_init (void ) { -sysdev_class_register (&bast_pm_sysclass); -sysdev_register (&bast_pm_sysdev); +register_syscore_ops (&bast_pm_syscore_ops);s3c_i2c0_set_platdata (&bast_i2c_info);s3c_nand_set_platdata (&bast_nand_info);
arch/arm/plat-s3c24xx/dma.c +26 -42
117 lines not on this page · raw message
arch/arm/mach-s3c2440/mach-osiris.c +5 -13
@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/gpio.h> #include <linux/device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/clk.h> #include <linux/i2c.h>
@@ -284,7 +284,7 @@ static struct platform_device osiris_pcm#ifdef CONFIG_PM static unsigned char pm_osiris_ctrl0; -static int osiris_pm_suspend (struct sys_device *sd,pm_message_t state) +static int osiris_pm_suspend (void ) {unsigned int tmp;
@@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_return 0 ; } -static int osiris_pm_resume (struct sys_device *sd) +static void osiris_pm_resume (void ) {if (pm_osiris_ctrl0 &OSIRIS_CTRL0_FIX8 )__raw_writeb (OSIRIS_CTRL1_FIX8 ,OSIRIS_VA_CTRL1 );
@@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_d__raw_writeb (pm_osiris_ctrl0,OSIRIS_VA_CTRL0 ); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); - - return 0; }#else
@@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_d#define osiris_pm_resume NULL#endif -static struct sysdev_class osiris_pm_sysclass = { - .name ="mach-osiris" , +static struct syscore_ops osiris_pm_syscore_ops = { .suspend = osiris_pm_suspend, .resume = osiris_pm_resume, }; -static struct sys_device osiris_pm_sysdev = { - .cls = &osiris_pm_sysclass, -}; -/* Link for DVS driver to TPS65011 */ static void osiris_tps_release (struct device *dev)
@@ -439,8 +432,7 @@ static void __init osiris_map_io(void)static void __init osiris_init (void ) { -sysdev_class_register (&osiris_pm_sysclass); -sysdev_register (&osiris_pm_sysdev); +register_syscore_ops (&osiris_pm_syscore_ops);s3c_i2c0_set_platdata (NULL );s3c_nand_set_platdata (&osiris_nand_info);
arch/arm/mach-s3c2412/mach-jive.c +6 -13
@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/i2c.h>
@@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive/* Jive power management device */ #ifdef CONFIG_PM -static int jive_pm_suspend (struct sys_device *sd,pm_message_t state) +static int jive_pm_suspend (void ) {/* Write the magic value u-boot uses to check for resume into * the INFORM0 register, and ensure INFORM1 is set to the
@@ -498,10 +498,9 @@ static int jive_pm_suspend(struct sys_de return 0; } -static int jive_pm_resume (struct sys_device *sd) +static void jive_pm_resume (void ) {__raw_writel (0x0 ,S3C2412_INFORM0 ); -return 0 ; }#else
@@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_dev#define jive_pm_resume NULL#endif -static struct sysdev_class jive_pm_sysclass = { - .name ="jive-pm" , +static struct syscore_ops jive_pm_syscore_ops = { .suspend = jive_pm_suspend, .resume = jive_pm_resume, }; -static struct sys_device jive_pm_sysdev = { - .cls = &jive_pm_sysclass, -}; -static void __init jive_map_io (void ) {s3c24xx_init_io (jive_iodesc,ARRAY_SIZE (jive_iodesc));
@@ -536,10 +530,9 @@ static void jive_power_off(void)static void __init jive_machine_init (void ) { -/* register system devices for managing low level suspend */ +/* register system core operations for managing low level suspend */ -sysdev_class_register (&jive_pm_sysclass); -sysdev_register (&jive_pm_sysdev); +register_syscore_ops (&jive_pm_syscore_ops);/* write our sleep configurations for the IO. Pull down all unused * IO, ensure that we have turned off all peripherals we do not
PATCH 6/7 ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 + arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62 ++++++++++++++-------------- arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68 +++++++++++-------------------- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)
arch/arm/plat-samsung/include/plat/pm.h +4 -2
@@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struc#ifdef CONFIG_PM extern int s3c_irqext_wake (struct irq_data *data,unsigned int state); -extern int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state); -extern int s3c24xx_irq_resume (struct sys_device *dev); +extern int s3c24xx_irq_suspend (void ); +extern void s3c24xx_irq_resume (void );#else #define s3c_irqext_wake NULL#define s3c24xx_irq_suspend NULL#define s3c24xx_irq_resume NULL#endif +extern struct syscore_ops s3c24xx_irq_syscore_ops; +/* PM debug functions */ #ifdef CONFIG_SAMSUNG_PM_DEBUG
arch/arm/plat-s5p/irq-pm.c +2 -5
@@ -16,7 +16,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <plat/cpu.h> #include <plat/irqs.h>
@@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = { SAVE_ITEM(S5P_EINT_MASK(3)), }; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {s3c_pm_do_save (eint_save,ARRAY_SIZE (eint_save));return 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {s3c_pm_do_restore (eint_save,ARRAY_SIZE (eint_save)); - -return 0 ; }
arch/arm/plat-s3c24xx/irq-pm.c +2 -5
@@ -14,7 +14,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <plat/cpu.h>
@@ -65,7 +64,7 @@ static unsigned long save_extint[3];static unsigned long save_eintflt[4 ];static unsigned long save_eintmask; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {unsigned int i;
@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_devicreturn 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {unsigned int i;
@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_devices3c_pm_do_restore (irq_save,ARRAY_SIZE (irq_save));__raw_writel (save_eintmask,S3C24XX_EINTMASK ); - -return 0 ; }
arch/arm/mach-s3c2410/irq.c +2 -28
@@ -23,38 +23,12 @@#include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <plat/cpu.h> #include <plat/pm.h> -static int s3c2410_irq_add (struct sys_device *sysdev) -{ -return 0 ; -} - -static struct sysdev_driver s3c2410_irq_driver = { - .add = s3c2410_irq_add, +struct syscore_ops s3c24xx_irq_syscore_ops = { .suspend = s3c24xx_irq_suspend, .resume = s3c24xx_irq_resume, }; - -static int __init s3c2410_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410_sysclass, &s3c2410_irq_driver); -} - -arch_initcall (s3c2410_irq_init); - -static struct sysdev_driver s3c2410a_irq_driver = { - .add = s3c2410_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, -}; - -static int __init s3c2410a_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410a_sysclass, &s3c2410a_irq_driver); -} - -arch_initcall (s3c2410a_irq_init);
arch/arm/mach-s3c2410/pm.c +6 -7
@@ -25,6 +25,7 @@#include <linux/errno.h> #include <linux/time.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/io.h>
@@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void) } } -static int s3c2410_pm_resume (struct sys_device *dev) +static void s3c2410_pm_resume (void ) {unsigned long tmp;
@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_if (machine_is_aml_m5900 () )s3c2410_gpio_setpin (S3C2410_GPF (2 ),0 ); - -return 0 ; } +struct syscore_ops s3c2410_pm_syscore_ops = { + .resume = s3c2410_pm_resume, +}; +static int s3c2410_pm_add (struct sys_device *dev) { pm_cpu_prep = s3c2410_pm_prepare;
@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_dev#if defined(CONFIG_CPU_S3C2410 )static struct sysdev_driver s3c2410_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };/* register ourselves */
@@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);static struct sysdev_driver s3c2410a_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2410a_pm_drvinit (void )
@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);#if defined(CONFIG_CPU_S3C2440 )static struct sysdev_driver s3c2440_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2440_pm_drvinit (void )
@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);#if defined(CONFIG_CPU_S3C2442 )static struct sysdev_driver s3c2442_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2442_pm_drvinit (void )
arch/arm/plat-samsung/include/plat/cpu.h +6 -0
@@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *struct sys_timer ;extern struct sys_timer s3c24xx_timer; +extern struct syscore_ops s3c2410_pm_syscore_ops; +extern struct syscore_ops s3c2412_pm_syscore_ops; +extern struct syscore_ops s3c2416_pm_syscore_ops; +extern struct syscore_ops s3c244x_pm_syscore_ops; +extern struct syscore_ops s3c64xx_irq_syscore_ops; +/* system device classes */ extern struct sysdev_class s3c2410_sysclass;
arch/arm/mach-s3c2410/s3c2410.c +5 -0
@@ -19,6 +19,7 @@#include <linux/gpio.h> #include <linux/clk.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -40,6 +41,7 @@#include <plat/devs.h> #include <plat/clock.h> #include <plat/pll.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -168,6 +170,9 @@ int __init s3c2410_init(void) {printk ("S3C2410: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2410_sysdev); }
arch/arm/mach-s3c2412/irq.c +0 -2
@@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_destatic struct sysdev_driver s3c2412_irq_driver = { .add = s3c2412_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2412_irq_init (void )
arch/arm/mach-s3c2412/pm.c +15 -12
@@ -17,6 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] SAVE_ITEM(S3C2413_GPJSLPCON), }; -static int s3c2412_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2412_pm_driver = { + .add = s3c2412_pm_add, +}; + +static __init int s3c2412_pm_init (void ) +{ +return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); +} + +arch_initcall (s3c2412_pm_init); + +static int s3c2412_pm_suspend (void ) {s3c_pm_do_save (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep));return 0 ; } -static int s3c2412_pm_resume (struct sys_device *dev) +static void s3c2412_pm_resume (void ) {unsigned long tmp;
@@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys___raw_writel (tmp,S3C2412_PWRCFG );s3c_pm_do_restore (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep)); -return 0 ; } -static struct sysdev_driver s3c2412_pm_driver = { - .add = s3c2412_pm_add, +struct syscore_ops s3c2412_pm_syscore_ops = { .suspend = s3c2412_pm_suspend, .resume = s3c2412_pm_resume, }; - -static __init int s3c2412_pm_init (void ) -{ -return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); -} - -arch_initcall (s3c2412_pm_init);
arch/arm/mach-s3c2412/s3c2412.c +4 -0
@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -244,5 +245,8 @@ int __init s3c2412_init(void) {printk ("S3C2412: Initialising architecture\n" ); +register_syscore_ops (&s3c2412_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2412_sysdev); }
arch/arm/mach-s3c2416/irq.c +0 -2
@@ -238,8 +238,6 @@ static int __init s3c2416_irq_add(structstatic struct sysdev_driver s3c2416_irq_driver = { .add = s3c2416_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int __init s3c2416_irq_init (void )
arch/arm/mach-s3c2416/pm.c +12 -15
@@ -11,6 +11,7 @@*/ #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h>
@@ -55,30 +56,26 @@ static int s3c2416_pm_add(struct sys_devreturn 0 ; } -static int s3c2416_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2416_pm_driver = { + .add = s3c2416_pm_add, +}; + +static __init int s3c2416_pm_init (void ) { -return 0 ; +return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); } -static int s3c2416_pm_resume (struct sys_device *dev) +arch_initcall (s3c2416_pm_init); + + +static void s3c2416_pm_resume (void ) {/* unset the return-from-sleep amd inform flags */ __raw_writel (0x0 ,S3C2443_PWRMODE );__raw_writel (0x0 ,S3C2412_INFORM0 );__raw_writel (0x0 ,S3C2412_INFORM1 ); - -return 0 ; } -static struct sysdev_driver s3c2416_pm_driver = { - .add = s3c2416_pm_add, - .suspend = s3c2416_pm_suspend, +struct syscore_ops s3c2416_pm_syscore_ops = { .resume = s3c2416_pm_resume, }; - -static __init int s3c2416_pm_init (void ) -{ -return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); -} - -arch_initcall (s3c2416_pm_init);
arch/arm/mach-s3c2416/s3c2416.c +5 -0
@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h>
@@ -54,6 +55,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/sdhci.h> +#include <plat/pm.h> #include <plat/iic-core.h> #include <plat/fb-core.h>
@@ -95,6 +97,9 @@ int __init s3c2416_init(void)s3c_fb_setname ("s3c2443-fb" ); +register_syscore_ops (&s3c2416_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2416_sysdev); }
arch/arm/mach-s3c2440/s3c244x-irq.c +0 -4
@@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_destatic struct sysdev_driver s3c2440_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2440_irq_init (void )
@@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);static struct sysdev_driver s3c2442_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };
arch/arm/mach-s3c2440/s3c244x.c +31 -31
85 lines not on this page · raw message
arch/arm/mach-s3c2440/s3c2440.c +8 -0
@@ -19,6 +19,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h>
@@ -33,6 +34,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -51,6 +53,12 @@ int __init s3c2440_init(void) s3c_device_wdt.resource[1 ].start =IRQ_S3C2440_WDT ; s3c_device_wdt.resource[1 ].end =IRQ_S3C2440_WDT ; +/* register suspend/resume handlers */ + +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +/* register our system device for everything else */ return sysdev_register (&s3c2440_sysdev);
arch/arm/mach-s3c2440/s3c2442.c +6 -0
@@ -29,6 +29,7 @@#include <linux/err.h> #include <linux/device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/mutex.h>
@@ -45,6 +46,7 @@#include <plat/clock.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -167,6 +169,10 @@ int __init s3c2442_init(void) {printk ("S3C2442: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2442_sysdev); }
arch/arm/mach-s3c64xx/irq-pm.c +9 -9
@@ -13,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/serial_core.h> #include <linux/irq.h>
@@ -54,7 +54,7 @@ static struct irq_grp_save {static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS ]; -static int s3c64xx_irq_pm_suspend (struct sys_device *dev,pm_message_t state) +static int s3c64xx_irq_pm_suspend (void ) {struct irq_grp_save *grp = eint_grp_save;int i;
@@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(structreturn 0 ; } -static int s3c64xx_irq_pm_resume (struct sys_device *dev) +static void s3c64xx_irq_pm_resume (void ) {struct irq_grp_save *grp = eint_grp_save;int i;
@@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct }S3C_PMDBG ("%s: IRQ configuration restored\n" , __func__); -return 0 ; } -static struct sysdev_driver s3c64xx_irq_driver = { +struct syscore_ops s3c64xx_irq_syscore_ops = { .suspend = s3c64xx_irq_pm_suspend, .resume = s3c64xx_irq_pm_resume, }; -static int __init s3c64xx_irq_pm_init (void ) +static __init int s3c64xx_syscore_init (void ) { -return sysdev_driver_register (&s3c64xx_sysclass, &s3c64xx_irq_driver); -} +register_syscore_ops (&s3c64xx_irq_syscore_ops); -arch_initcall (s3c64xx_irq_pm_init); +return 0 ; +} +core_initcall (s3c64xx_syscore_init);
arch/arm/mach-s5pv210/pm.c +17 -8
@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <plat/cpu.h>
@@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_devreturn 0 ; } -static int s5pv210_pm_resume (struct sys_device *dev) +static struct sysdev_driver s5pv210_pm_driver = { + .add = s5pv210_pm_add, +}; + +static __init int s5pv210_pm_drvinit (void ) +{ +return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +} +arch_initcall (s5pv210_pm_drvinit); + +static void s5pv210_pm_resume (void ) {u32 tmp;
@@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys___raw_writel (tmp ,S5P_OTHERS );s3c_pm_do_restore_core (s5pv210_core_save,ARRAY_SIZE (s5pv210_core_save)); - -return 0 ; } -static struct sysdev_driver s5pv210_pm_driver = { - .add = s5pv210_pm_add, +static struct syscore_ops s5pv210_pm_syscore_ops = { .resume = s5pv210_pm_resume, }; -static __init int s5pv210_pm_drvinit (void ) +static __init int s5pv210_pm_syscore_init (void ) { -return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +register_syscore_ops (&s5pv210_pm_syscore_ops); +return 0 ; } -arch_initcall (s5pv210_pm_drvinit); +arch_initcall (s5pv210_pm_syscore_init);
arch/arm/mach-exynos4/pm.c +27 -18
67 lines not on this page · raw message
arch/arm/mach-s3c2410/mach-bast.c +5 -12
@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/dm9000.h>
@@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartc/* NAND Flash on BAST board */ #ifdef CONFIG_PM -static int bast_pm_suspend (struct sys_device *sd,pm_message_t state) +static int bast_pm_suspend (void ) {/* ensure that an nRESET is not generated on resume. */ gpio_direction_output (S3C2410_GPA (21 ),1 );return 0 ; } -static int bast_pm_resume (struct sys_device *sd) +static void bast_pm_resume (void ) {s3c_gpio_cfgpin (S3C2410_GPA (21 ), S3C2410_GPA21_nRSTOUT); -return 0 ; }#else
@@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_dev#define bast_pm_resume NULL#endif -static struct sysdev_class bast_pm_sysclass = { - .name ="mach-bast" , +static struct syscore_ops bast_pm_syscore_ops = { .suspend = bast_pm_suspend, .resume = bast_pm_resume, }; -static struct sys_device bast_pm_sysdev = { - .cls = &bast_pm_sysclass, -}; -static int smartmedia_map[] = {0 };static int chip0_map[] = {1 };static int chip1_map[] = {2 };
@@ -642,8 +636,7 @@ static void __init bast_map_io(void)static void __init bast_init (void ) { -sysdev_class_register (&bast_pm_sysclass); -sysdev_register (&bast_pm_sysdev); +register_syscore_ops (&bast_pm_syscore_ops);s3c_i2c0_set_platdata (&bast_i2c_info);s3c_nand_set_platdata (&bast_nand_info);
arch/arm/plat-s3c24xx/dma.c +26 -42
117 lines not on this page · raw message
arch/arm/mach-s3c2440/mach-osiris.c +5 -13
@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/gpio.h> #include <linux/device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/clk.h> #include <linux/i2c.h>
@@ -284,7 +284,7 @@ static struct platform_device osiris_pcm#ifdef CONFIG_PM static unsigned char pm_osiris_ctrl0; -static int osiris_pm_suspend (struct sys_device *sd,pm_message_t state) +static int osiris_pm_suspend (void ) {unsigned int tmp;
@@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_return 0 ; } -static int osiris_pm_resume (struct sys_device *sd) +static void osiris_pm_resume (void ) {if (pm_osiris_ctrl0 &OSIRIS_CTRL0_FIX8 )__raw_writeb (OSIRIS_CTRL1_FIX8 ,OSIRIS_VA_CTRL1 );
@@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_d__raw_writeb (pm_osiris_ctrl0,OSIRIS_VA_CTRL0 ); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); - - return 0; }#else
@@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_d#define osiris_pm_resume NULL#endif -static struct sysdev_class osiris_pm_sysclass = { - .name ="mach-osiris" , +static struct syscore_ops osiris_pm_syscore_ops = { .suspend = osiris_pm_suspend, .resume = osiris_pm_resume, }; -static struct sys_device osiris_pm_sysdev = { - .cls = &osiris_pm_sysclass, -}; -/* Link for DVS driver to TPS65011 */ static void osiris_tps_release (struct device *dev)
@@ -439,8 +432,7 @@ static void __init osiris_map_io(void)static void __init osiris_init (void ) { -sysdev_class_register (&osiris_pm_sysclass); -sysdev_register (&osiris_pm_sysdev); +register_syscore_ops (&osiris_pm_syscore_ops);s3c_i2c0_set_platdata (NULL );s3c_nand_set_platdata (&osiris_nand_info);
arch/arm/mach-s3c2412/mach-jive.c +6 -13
@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/i2c.h>
@@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive/* Jive power management device */ #ifdef CONFIG_PM -static int jive_pm_suspend (struct sys_device *sd,pm_message_t state) +static int jive_pm_suspend (void ) {/* Write the magic value u-boot uses to check for resume into * the INFORM0 register, and ensure INFORM1 is set to the
@@ -498,10 +498,9 @@ static int jive_pm_suspend(struct sys_de return 0; } -static int jive_pm_resume (struct sys_device *sd) +static void jive_pm_resume (void ) {__raw_writel (0x0 ,S3C2412_INFORM0 ); -return 0 ; }#else
@@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_dev#define jive_pm_resume NULL#endif -static struct sysdev_class jive_pm_sysclass = { - .name ="jive-pm" , +static struct syscore_ops jive_pm_syscore_ops = { .suspend = jive_pm_suspend, .resume = jive_pm_resume, }; -static struct sys_device jive_pm_sysdev = { - .cls = &jive_pm_sysclass, -}; -static void __init jive_map_io (void ) {s3c24xx_init_io (jive_iodesc,ARRAY_SIZE (jive_iodesc));
@@ -536,10 +530,9 @@ static void jive_power_off(void)static void __init jive_machine_init (void ) { -/* register system devices for managing low level suspend */ +/* register system core operations for managing low level suspend */ -sysdev_class_register (&jive_pm_sysclass); -sysdev_register (&jive_pm_sysdev); +register_syscore_ops (&jive_pm_syscore_ops);/* write our sleep configurations for the IO. Pull down all unused * IO, ensure that we have turned off all peripherals we do not
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 7/7 ARM: Select CONFIG_ARCH_NO_SYSDEV_OPS
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Make the ARM architecture select CONFIG_ARCH_NO_SYSDEV_OPS to indicate that sysdevs are not used for power management any more on this architecture.
--- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/Kconfig +1 -0
@@ -28,6 +28,7 @@ config ARM select HAVE_C_RECORDMCOUNT select HAVE_GENERIC_HARDIRQS select HAVE_SPARSE_IRQ + select ARCH_NO_SYSDEV_OPS help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and
PATCH 7/7 ARM: Select CONFIG_ARCH_NO_SYSDEV_OPS
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Make the ARM architecture select CONFIG_ARCH_NO_SYSDEV_OPS to indicate that sysdevs are not used for power management any more on this architecture.
--- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/Kconfig +1 -0
@@ -28,6 +28,7 @@ config ARM select HAVE_C_RECORDMCOUNT select HAVE_GENERIC_HARDIRQS select HAVE_SPARSE_IRQ + select ARCH_NO_SYSDEV_OPS help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and
cover Remove sysdev suspend/resume and shutdown operations
In reply to Rafael J. WysockiHi,
The following series of patches fixes bugs related to the introduction of struct syscore_ops later in this cycle, replaces sysdev suspend/resume operations in all of the architectures still using them with struct syscore_ops-based PM callbacks and finally removes the suspend/resume and shutdown operations from struct sysdev_class and struct sysdev_driver.
Patches [1/14] and [2/14] are important bug fixes targeted at 2.6.39. The remaining patches are regareded as 2.6.40 material, but I'd like to put them into linux-next shortly, if there are no objections, to catch problems that they may introduce before they hit the mainline. Again, if there are no objections I'd like to merge these patches through the suspend-2.6 tree.
[1/14] - Fix error code paths executed after failing syscore_suspend() [2/14] - Add missing syscore_suspend() and syscore_resume() calls to
subsystems that should use them in addition to sysdev calls.
[3/14] - Use struct syscore_ops for core PM (instead of sysdevs) in the
common ARM code.
[4/14] - Use struct syscore_ops for core PM (instead of sysdevs) in ARM OMAP
code.
[5/14] - Use struct syscore_ops for core PM (instead of sysdevs) in ARM
Integrator code.
[6/14] - Use struct syscore_ops for core PM (instead of sysdevs) in ARM SA1100
code.
[7/14] - Use struct syscore_ops for core PM (instead of sysdevs) in ARM PXA
code.
[8/14] - Use struct syscore_ops for core PM (instead of sysdevs) in ARM Samsung
code.
[9/14] - Use struct syscore_ops for core PM (instead of sysdevs) in Blackfin
arch code.
[10/14] - Use struct syscore_ops for core PM (instead of sysdevs) in MIPS
arch code.
[11/14] - Use struct syscore_ops for core PM (instead of sysdevs) in AVR32
arch code.
[12/14] - Use struct syscore_ops for core PM (instead of sysdevs) in Unicore32
arch code.
[13/14] - Use struct syscore_ops for core PM (instead of sysdevs) in PowerPC
arch code.
[14/14] - Remove sysdev suspend/resume and shutdown operations.
Thanks,
Rafael
PATCH 1/14 PM: Fix error code paths executed after failing syscore_suspend()
From: Rafael J. Wysocki <[email protected]>
If syscore_suspend() fails in suspend_enter(), create_image() or resume_target_kernel(), it is necessary to call sysdev_resume(), because sysdev_suspend() has been called already and succeeded and we are going to abort the transition.
--- kernel/power/hibernate.c | 10 ++++++++-- kernel/power/suspend.c | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-)
kernel/power/suspend.c +4 -1
@@ -164,8 +164,11 @@ static int suspend_enter(suspend_state_tBUG_ON (!irqs_disabled ()); error =sysdev_suspend (PMSG_SUSPEND ); -if (!error) +if (!error) { error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (!error) {if (!(suspend_test (TEST_CORE ) ||pm_wakeup_pending ())) { error = suspend_ops->enter (state);
kernel/power/hibernate.c +8 -2
@@ -273,8 +273,11 @@ static int create_image(int platform_modlocal_irq_disable (); error =sysdev_suspend (PMSG_FREEZE ); -if (!error) +if (!error) { error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (error) {printk (KERN_ERR "PM: Some system devices failed to power down, " "aborting hibernation\n" );
@@ -407,8 +410,11 @@ static int resume_target_kernel(bool plalocal_irq_disable (); error =sysdev_suspend (PMSG_QUIESCE ); -if (!error) +if (!error) { error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (error) goto Enable_irqs;
PATCH 1/14 PM: Fix error code paths executed after failing syscore_suspend()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
If syscore_suspend() fails in suspend_enter(), create_image() or resume_target_kernel(), it is necessary to call sysdev_resume(), because sysdev_suspend() has been called already and succeeded and we are going to abort the transition.
--- kernel/power/hibernate.c | 10 ++++++++-- kernel/power/suspend.c | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-)
kernel/power/suspend.c +4 -1
@@ -164,8 +164,11 @@ static int suspend_enter(suspend_state_tBUG_ON (!irqs_disabled ()); error =sysdev_suspend (PMSG_SUSPEND ); -if (!error) +if (!error) { error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (!error) {if (!(suspend_test (TEST_CORE ) ||pm_wakeup_pending ())) { error = suspend_ops->enter (state);
kernel/power/hibernate.c +8 -2
@@ -273,8 +273,11 @@ static int create_image(int platform_modlocal_irq_disable (); error =sysdev_suspend (PMSG_FREEZE ); -if (!error) +if (!error) { error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (error) {printk (KERN_ERR "PM: Some system devices failed to power down, " "aborting hibernation\n" );
@@ -407,8 +410,11 @@ static int resume_target_kernel(bool plalocal_irq_disable (); error =sysdev_suspend (PMSG_QUIESCE ); -if (!error) +if (!error) { error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (error) goto Enable_irqs;
PATCH 2/14 PM: Add missing syscore_suspend() and syscore_resume() calls
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Device suspend/resume infrastructure is used not only by the suspend and hibernate code in kernel/power, but also by , APM, Xen and the kexec jump feature. However, commit 40dc166cb5dddbd36aa4ad11c03915ea (PM / Core: Introduce struct syscore_ops for core subsystems PM) failed to add syscore_suspend() and syscore_resume() calls to that code, which generally leads to breakage when the features in question are used.
To fix this problem, add the missing syscore_suspend() and syscore_resume() calls to arch/x86/kernel/apm_32.c, kernel/kexec.c and drivers/xen/manage.c.
--- arch/x86/kernel/apm_32.c | 5 +++++ drivers/xen/manage.c | 9 ++++++++- kernel/kexec.c | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-)
kernel/kexec.c +7 -0
@@ -33,6 +33,7 @@#include <linux/vmalloc.h> #include <linux/swap.h> #include <linux/kmsg_dump.h> +#include <linux/syscore_ops.h> #include <asm/page.h> #include <asm/uaccess.h>
@@ -1532,6 +1533,11 @@ int kernel_kexec(void)local_irq_disable ();/* Suspend system devices */ error =sysdev_suspend (PMSG_FREEZE ); +if (!error) { + error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (error) goto Enable_irqs; }else
@@ -1546,6 +1552,7 @@ int kernel_kexec(void)#ifdef CONFIG_KEXEC_JUMP if (kexec_image->preserve_context) { +syscore_resume ();sysdev_resume (); Enable_irqs:local_irq_enable ();
drivers/xen/manage.c +8 -1
@@ -8,6 +8,7 @@#include <linux/sysrq.h> #include <linux/stop_machine.h> #include <linux/freezer.h> +#include <linux/syscore_ops.h> #include <xen/xen.h> #include <xen/xenbus.h>
@@ -70,8 +71,13 @@ static int xen_suspend(void *data)BUG_ON (!irqs_disabled ()); err =sysdev_suspend (PMSG_FREEZE ); +if (!err) { + err =syscore_suspend (); +if (err) +sysdev_resume (); + }if (err) { -printk (KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n" , +printk (KERN_ERR "xen_suspend: system core suspend failed: %d\n" , err);return err; }
@@ -95,6 +101,7 @@ static int xen_suspend(void *data)xen_timer_resume (); } +syscore_resume ();sysdev_resume ();return 0 ;
arch/x86/kernel/apm_32.c +5 -0
@@ -228,6 +228,7 @@#include <linux/kthread.h> #include <linux/jiffies.h> #include <linux/acpi.h> +#include <linux/syscore_ops.h> #include <asm/system.h> #include <asm/uaccess.h>
@@ -1238,6 +1239,7 @@ static int suspend(int vetoable)local_irq_disable ();sysdev_suspend (PMSG_SUSPEND ); +syscore_suspend ();local_irq_enable ();
@@ -1255,6 +1257,7 @@ static int suspend(int vetoable)apm_error ("suspend" , err); err = (err ==APM_SUCCESS ) ?0 : -EIO ; +syscore_resume ();sysdev_resume ();local_irq_enable ();
@@ -1280,6 +1283,7 @@ static void standby(void)local_irq_disable ();sysdev_suspend (PMSG_SUSPEND ); +syscore_suspend ();local_irq_enable (); err =set_system_power_state (APM_STATE_STANDBY );
@@ -1287,6 +1291,7 @@ static void standby(void)apm_error ("standby" , err);local_irq_disable (); +syscore_resume ();sysdev_resume ();local_irq_enable ();
Re: [PATCH 2/14] PM: Add missing syscore_suspend() and syscore_resume() calls
Quoted 10 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Device suspend/resume infrastructure is used not only by the suspend and hibernate code in kernel/power, but also by , APM, Xen and the kexec jump feature. However, commit
40dc166cb5dddbd36aa4ad11c03915ea(PM / Core: Introduce structsyscore_opsfor core subsystems PM) failed to addsyscore_suspend()andsyscore_resume()calls to that code, which generally leads to breakage when the features in question are used.
Quoted 3 lines
To fix this problem, add the missing
syscore_suspend()andsyscore_resume()calls toarch/x86/kernel/apm_32.c,kernel/kexec.canddrivers/xen/manage.c.
Xen bit looks ok to me:
Quoted 126 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- arch/x86/kernel/apm_32.c | 5 +++++ drivers/xen/manage.c | 9 ++++++++- kernel/kexec.c | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-)Index:
linux-2.6/kernel/kexec.c
===================================================================kernel/kexec.c +7
-0@@ -33,6 +33,7 @@#include <linux/vmalloc.h> #include <linux/swap.h> #include <linux/kmsg_dump.h> +#include <linux/syscore_ops.h> #include <asm/page.h> #include <asm/uaccess.h> @@ -1532,6 +1533,11 @@ int kernel_kexec(void)local_irq_disable ();/* Suspend system devices */ error =sysdev_suspend (PMSG_FREEZE ); +if (!error) { + error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (error) goto Enable_irqs; }else @@ -1546,6 +1552,7 @@ int kernel_kexec(void)#ifdef CONFIG_KEXEC_JUMP if (kexec_image->preserve_context) { +syscore_resume ();sysdev_resume (); Enable_irqs:local_irq_enable ();Index:
linux-2.6/drivers/xen/manage.c
===================================================================drivers/xen/manage.c +8
-1@@ -8,6 +8,7 @@#include <linux/sysrq.h> #include <linux/stop_machine.h> #include <linux/freezer.h> +#include <linux/syscore_ops.h> #include <xen/xen.h> #include <xen/xenbus.h> @@ -70,8 +71,13 @@ static int xen_suspend(void *data)BUG_ON (!irqs_disabled ()); err =sysdev_suspend (PMSG_FREEZE ); +if (!err) { + err =syscore_suspend (); +if (err) +sysdev_resume (); + }if (err) { -printk (KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n" , +printk (KERN_ERR "xen_suspend: system core suspend failed: %d\n" , err);return err; }@@ -95,6 +101,7 @@ static int xen_suspend(void *data)xen_timer_resume (); } +syscore_resume ();sysdev_resume ();return 0 ;Index:
linux-2.6/arch/x86/kernel/apm_32.c
===================================================================arch/x86/kernel/apm_32.c +5
-1@@ -228,6 +228,7 @@#include <linux/kthread.h> #include <linux/jiffies.h> #include <linux/acpi.h> +#include <linux/syscore_ops.h> #include <asm/system.h> #include <asm/uaccess.h> @@ -1238,6 +1239,7 @@ static int suspend(int vetoable)local_irq_disable ();sysdev_suspend (PMSG_SUSPEND ); +syscore_suspend ();local_irq_enable ();@@ -1255,6 +1257,7 @@ static int suspend(int vetoable)apm_error ("suspend" , err); err = (err ==APM_SUCCESS ) ?0 : -EIO ; +syscore_resume ();sysdev_resume ();local_irq_enable ();@@ -1280,6 +1283,7 @@ static void standby(void)local_irq_disable ();sysdev_suspend (PMSG_SUSPEND ); +syscore_suspend ();local_irq_enable (); err =set_system_power_state (APM_STATE_STANDBY );@@ -1287,6 +1291,7 @@ static void standby(void)apm_error ("standby" , err);local_irq_disable (); +syscore_resume ();sysdev_resume ();local_irq_enable (); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 4 lines
Ian Campbell Tact in audacity is knowing how far you can go without going too far. -- Jean Cocteau
Re: [PATCH 2/14] PM: Add missing syscore_suspend() and syscore_resume() calls
In reply to Rafael J. WysockiQuoted 10 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Device suspend/resume infrastructure is used not only by the suspend and hibernate code in kernel/power, but also by , APM, Xen and the kexec jump feature. However, commit
40dc166cb5dddbd36aa4ad11c03915ea(PM / Core: Introduce structsyscore_opsfor core subsystems PM) failed to addsyscore_suspend()andsyscore_resume()calls to that code, which generally leads to breakage when the features in question are used.
Quoted 3 lines
To fix this problem, add the missing
syscore_suspend()andsyscore_resume()calls toarch/x86/kernel/apm_32.c,kernel/kexec.canddrivers/xen/manage.c.
Xen bit looks ok to me:
Quoted 126 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- arch/x86/kernel/apm_32.c | 5 +++++ drivers/xen/manage.c | 9 ++++++++- kernel/kexec.c | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-)Index:
linux-2.6/kernel/kexec.c
===================================================================kernel/kexec.c +7
-0@@ -33,6 +33,7 @@#include <linux/vmalloc.h> #include <linux/swap.h> #include <linux/kmsg_dump.h> +#include <linux/syscore_ops.h> #include <asm/page.h> #include <asm/uaccess.h> @@ -1532,6 +1533,11 @@ int kernel_kexec(void)local_irq_disable ();/* Suspend system devices */ error =sysdev_suspend (PMSG_FREEZE ); +if (!error) { + error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (error) goto Enable_irqs; }else @@ -1546,6 +1552,7 @@ int kernel_kexec(void)#ifdef CONFIG_KEXEC_JUMP if (kexec_image->preserve_context) { +syscore_resume ();sysdev_resume (); Enable_irqs:local_irq_enable ();Index:
linux-2.6/drivers/xen/manage.c
===================================================================drivers/xen/manage.c +8
-1@@ -8,6 +8,7 @@#include <linux/sysrq.h> #include <linux/stop_machine.h> #include <linux/freezer.h> +#include <linux/syscore_ops.h> #include <xen/xen.h> #include <xen/xenbus.h> @@ -70,8 +71,13 @@ static int xen_suspend(void *data)BUG_ON (!irqs_disabled ()); err =sysdev_suspend (PMSG_FREEZE ); +if (!err) { + err =syscore_suspend (); +if (err) +sysdev_resume (); + }if (err) { -printk (KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n" , +printk (KERN_ERR "xen_suspend: system core suspend failed: %d\n" , err);return err; }@@ -95,6 +101,7 @@ static int xen_suspend(void *data)xen_timer_resume (); } +syscore_resume ();sysdev_resume ();return 0 ;Index:
linux-2.6/arch/x86/kernel/apm_32.c
===================================================================arch/x86/kernel/apm_32.c +5
-1@@ -228,6 +228,7 @@#include <linux/kthread.h> #include <linux/jiffies.h> #include <linux/acpi.h> +#include <linux/syscore_ops.h> #include <asm/system.h> #include <asm/uaccess.h> @@ -1238,6 +1239,7 @@ static int suspend(int vetoable)local_irq_disable ();sysdev_suspend (PMSG_SUSPEND ); +syscore_suspend ();local_irq_enable ();@@ -1255,6 +1257,7 @@ static int suspend(int vetoable)apm_error ("suspend" , err); err = (err ==APM_SUCCESS ) ?0 : -EIO ; +syscore_resume ();sysdev_resume ();local_irq_enable ();@@ -1280,6 +1283,7 @@ static void standby(void)local_irq_disable ();sysdev_suspend (PMSG_SUSPEND ); +syscore_suspend ();local_irq_enable (); err =set_system_power_state (APM_STATE_STANDBY );@@ -1287,6 +1291,7 @@ static void standby(void)apm_error ("standby" , err);local_irq_disable (); +syscore_resume ();sysdev_resume ();local_irq_enable (); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 4 lines
Ian Campbell Tact in audacity is knowing how far you can go without going too far. -- Jean Cocteau
PATCH 2/14 PM: Add missing syscore_suspend() and syscore_resume() calls
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Device suspend/resume infrastructure is used not only by the suspend and hibernate code in kernel/power, but also by , APM, Xen and the kexec jump feature. However, commit 40dc166cb5dddbd36aa4ad11c03915ea (PM / Core: Introduce struct syscore_ops for core subsystems PM) failed to add syscore_suspend() and syscore_resume() calls to that code, which generally leads to breakage when the features in question are used.
To fix this problem, add the missing syscore_suspend() and syscore_resume() calls to arch/x86/kernel/apm_32.c, kernel/kexec.c and drivers/xen/manage.c.
--- arch/x86/kernel/apm_32.c | 5 +++++ drivers/xen/manage.c | 9 ++++++++- kernel/kexec.c | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-)
kernel/kexec.c +7 -0
@@ -33,6 +33,7 @@#include <linux/vmalloc.h> #include <linux/swap.h> #include <linux/kmsg_dump.h> +#include <linux/syscore_ops.h> #include <asm/page.h> #include <asm/uaccess.h>
@@ -1532,6 +1533,11 @@ int kernel_kexec(void)local_irq_disable ();/* Suspend system devices */ error =sysdev_suspend (PMSG_FREEZE ); +if (!error) { + error =syscore_suspend (); +if (error) +sysdev_resume (); + }if (error) goto Enable_irqs; }else
@@ -1546,6 +1552,7 @@ int kernel_kexec(void)#ifdef CONFIG_KEXEC_JUMP if (kexec_image->preserve_context) { +syscore_resume ();sysdev_resume (); Enable_irqs:local_irq_enable ();
drivers/xen/manage.c +8 -1
@@ -8,6 +8,7 @@#include <linux/sysrq.h> #include <linux/stop_machine.h> #include <linux/freezer.h> +#include <linux/syscore_ops.h> #include <xen/xen.h> #include <xen/xenbus.h>
@@ -70,8 +71,13 @@ static int xen_suspend(void *data)BUG_ON (!irqs_disabled ()); err =sysdev_suspend (PMSG_FREEZE ); +if (!err) { + err =syscore_suspend (); +if (err) +sysdev_resume (); + }if (err) { -printk (KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n" , +printk (KERN_ERR "xen_suspend: system core suspend failed: %d\n" , err);return err; }
@@ -95,6 +101,7 @@ static int xen_suspend(void *data)xen_timer_resume (); } +syscore_resume ();sysdev_resume ();return 0 ;
arch/x86/kernel/apm_32.c +5 -0
@@ -228,6 +228,7 @@#include <linux/kthread.h> #include <linux/jiffies.h> #include <linux/acpi.h> +#include <linux/syscore_ops.h> #include <asm/system.h> #include <asm/uaccess.h>
@@ -1238,6 +1239,7 @@ static int suspend(int vetoable)local_irq_disable ();sysdev_suspend (PMSG_SUSPEND ); +syscore_suspend ();local_irq_enable ();
@@ -1255,6 +1257,7 @@ static int suspend(int vetoable)apm_error ("suspend" , err); err = (err ==APM_SUCCESS ) ?0 : -EIO ; +syscore_resume ();sysdev_resume ();local_irq_enable ();
@@ -1280,6 +1283,7 @@ static void standby(void)local_irq_disable ();sysdev_suspend (PMSG_SUSPEND ); +syscore_suspend ();local_irq_enable (); err =set_system_power_state (APM_STATE_STANDBY );
@@ -1287,6 +1291,7 @@ static void standby(void)apm_error ("standby" , err);local_irq_disable (); +syscore_resume ();sysdev_resume ();local_irq_enable ();
PATCH 3/14 ARM: Use struct syscore_ops instead of sysdevs for PM in common code
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Convert some ARM architecture's common 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.
--- arch/arm/common/vic.c | 69 ++++++++++++++------------------------- arch/arm/include/asm/mach/time.h | 1 arch/arm/kernel/leds.c | 28 +++++++++------ arch/arm/kernel/time.c | 35 ++++++------------- arch/arm/vfp/vfpmodule.c | 19 ++-------- 5 files changed, 58 insertions(+), 94 deletions(-)
arch/arm/kernel/time.c +12 -23
@@ -21,7 +21,7 @@#include <linux/timex.h> #include <linux/errno.h> #include <linux/profile.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/timer.h> #include <linux/irq.h>
@@ -115,48 +115,37 @@ void timer_tick(void)#endif #if defined(CONFIG_PM ) && !defined(CONFIG_GENERIC_CLOCKEVENTS ) -static int timer_suspend (struct sys_device *dev,pm_message_t state) +static int timer_suspend (void ) { - struct sys_timer *timer = container_of(dev, struct sys_timer, dev); - -if (timer->suspend !=NULL ) - timer->suspend (); +if (system_timer->suspend) + system_timer->suspend ();return 0 ; } -static int timer_resume (struct sys_device *dev) +static void timer_resume (void ) { - struct sys_timer *timer = container_of(dev, struct sys_timer, dev); - -if (timer->resume !=NULL ) - timer->resume (); - -return 0 ; +if (system_timer->resume) + system_timer->resume (); }#else #define timer_suspend NULL#define timer_resume NULL#endif -static struct sysdev_class timer_sysclass = { - .name ="timer" , +static struct syscore_ops timer_syscore_ops = { .suspend = timer_suspend, .resume = timer_resume, }; -static int __init timer_init_sysfs (void ) +static int __init timer_init_syscore_ops (void ) { -int ret =sysdev_class_register (&timer_sysclass); -if (ret ==0 ) { - system_timer->dev.cls = &timer_sysclass; - ret =sysdev_register (&system_timer->dev); - } +register_syscore_ops (&timer_syscore_ops); -return ret; +return 0 ; } -device_initcall (timer_init_sysfs); +device_initcall (timer_init_syscore_ops);void __init time_init (void ) {
arch/arm/include/asm/mach/time.h +0 -1
@@ -34,7 +34,6 @@* timer interrupt which may be pending. */ struct sys_timer { -struct sys_device dev;void (*init)(void );void (*suspend)(void );void (*resume)(void );
arch/arm/kernel/leds.c +16 -12
@@ -10,6 +10,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <asm/leds.h>
@@ -69,36 +70,37 @@ static ssize_t leds_store(struct sys_dev static SYSDEV_ATTR(event, 0200, NULL, leds_store); -static int leds_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_class leds_sysclass = { + .name ="leds" , +}; + +static struct sys_device leds_device = { + .id =0 , + .cls = &leds_sysclass, +}; + +static int leds_suspend (void ) {leds_event (led_stop);return 0 ; } -static int leds_resume (struct sys_device *dev) +static void leds_resume (void ) {leds_event (led_start); -return 0 ; } -static int leds_shutdown (struct sys_device *dev) +static void leds_shutdown (void ) {leds_event (led_halted); -return 0 ; } -static struct sysdev_class leds_sysclass = { - .name ="leds" , +static struct syscore_ops leds_syscore_ops = { .shutdown = leds_shutdown, .suspend = leds_suspend, .resume = leds_resume, }; -static struct sys_device leds_device = { - .id =0 , - .cls = &leds_sysclass, -}; -static int __init leds_init (void ) {int ret;
@@ -107,6 +109,8 @@ static int __init leds_init(void) ret =sysdev_register (&leds_device);if (ret ==0 ) ret =sysdev_create_file (&leds_device, &attr_event); +if (ret ==0 ) +register_syscore_ops (&leds_syscore_ops);return ret; }
arch/arm/common/vic.c +25 -44
128 lines not on this page · raw message
arch/arm/vfp/vfpmodule.c +5 -14
@@ -398,9 +398,9 @@ static void vfp_enable(void *unused) }#ifdef CONFIG_PM -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> -static int vfp_pm_suspend (struct sys_device *dev,pm_message_t state) +static int vfp_pm_suspend (void ) {struct thread_info *ti =current_thread_info ();u32 fpexc =fmrx (FPEXC );
@@ -420,34 +420,25 @@ static int vfp_pm_suspend(struct sys_dev return 0; } -static int vfp_pm_resume (struct sys_device *dev) +static void vfp_pm_resume (void ) {/* ensure we have access to the vfp */ vfp_enable (NULL );/* and disable it to ensure the next usage restores the state */ fmxr (FPEXC ,fmrx (FPEXC ) & ~FPEXC_EN ); - -return 0 ; } -static struct sysdev_class vfp_pm_sysclass = { - .name ="vfp" , +static struct syscore_ops vfp_pm_syscore_ops = { .suspend = vfp_pm_suspend, .resume = vfp_pm_resume, }; -static struct sys_device vfp_pm_sysdev = { - .cls = &vfp_pm_sysclass, -}; -static void vfp_pm_init (void ) { -sysdev_class_register (&vfp_pm_sysclass); -sysdev_register (&vfp_pm_sysdev); +register_syscore_ops (&vfp_pm_syscore_ops); } -#else static inline void vfp_pm_init (void ) { }#endif /* CONFIG_PM */
PATCH 3/14 ARM: Use struct syscore_ops instead of sysdevs for PM in common code
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Convert some ARM architecture's common 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.
--- arch/arm/common/vic.c | 69 ++++++++++++++------------------------- arch/arm/include/asm/mach/time.h | 1 arch/arm/kernel/leds.c | 28 +++++++++------ arch/arm/kernel/time.c | 35 ++++++------------- arch/arm/vfp/vfpmodule.c | 19 ++-------- 5 files changed, 58 insertions(+), 94 deletions(-)
arch/arm/kernel/time.c +12 -23
@@ -21,7 +21,7 @@#include <linux/timex.h> #include <linux/errno.h> #include <linux/profile.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/timer.h> #include <linux/irq.h>
@@ -115,48 +115,37 @@ void timer_tick(void)#endif #if defined(CONFIG_PM ) && !defined(CONFIG_GENERIC_CLOCKEVENTS ) -static int timer_suspend (struct sys_device *dev,pm_message_t state) +static int timer_suspend (void ) { - struct sys_timer *timer = container_of(dev, struct sys_timer, dev); - -if (timer->suspend !=NULL ) - timer->suspend (); +if (system_timer->suspend) + system_timer->suspend ();return 0 ; } -static int timer_resume (struct sys_device *dev) +static void timer_resume (void ) { - struct sys_timer *timer = container_of(dev, struct sys_timer, dev); - -if (timer->resume !=NULL ) - timer->resume (); - -return 0 ; +if (system_timer->resume) + system_timer->resume (); }#else #define timer_suspend NULL#define timer_resume NULL#endif -static struct sysdev_class timer_sysclass = { - .name ="timer" , +static struct syscore_ops timer_syscore_ops = { .suspend = timer_suspend, .resume = timer_resume, }; -static int __init timer_init_sysfs (void ) +static int __init timer_init_syscore_ops (void ) { -int ret =sysdev_class_register (&timer_sysclass); -if (ret ==0 ) { - system_timer->dev.cls = &timer_sysclass; - ret =sysdev_register (&system_timer->dev); - } +register_syscore_ops (&timer_syscore_ops); -return ret; +return 0 ; } -device_initcall (timer_init_sysfs); +device_initcall (timer_init_syscore_ops);void __init time_init (void ) {
arch/arm/include/asm/mach/time.h +0 -1
@@ -34,7 +34,6 @@* timer interrupt which may be pending. */ struct sys_timer { -struct sys_device dev;void (*init)(void );void (*suspend)(void );void (*resume)(void );
arch/arm/kernel/leds.c +16 -12
@@ -10,6 +10,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <asm/leds.h>
@@ -69,36 +70,37 @@ static ssize_t leds_store(struct sys_dev static SYSDEV_ATTR(event, 0200, NULL, leds_store); -static int leds_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_class leds_sysclass = { + .name ="leds" , +}; + +static struct sys_device leds_device = { + .id =0 , + .cls = &leds_sysclass, +}; + +static int leds_suspend (void ) {leds_event (led_stop);return 0 ; } -static int leds_resume (struct sys_device *dev) +static void leds_resume (void ) {leds_event (led_start); -return 0 ; } -static int leds_shutdown (struct sys_device *dev) +static void leds_shutdown (void ) {leds_event (led_halted); -return 0 ; } -static struct sysdev_class leds_sysclass = { - .name ="leds" , +static struct syscore_ops leds_syscore_ops = { .shutdown = leds_shutdown, .suspend = leds_suspend, .resume = leds_resume, }; -static struct sys_device leds_device = { - .id =0 , - .cls = &leds_sysclass, -}; -static int __init leds_init (void ) {int ret;
@@ -107,6 +109,8 @@ static int __init leds_init(void) ret =sysdev_register (&leds_device);if (ret ==0 ) ret =sysdev_create_file (&leds_device, &attr_event); +if (ret ==0 ) +register_syscore_ops (&leds_syscore_ops);return ret; }
arch/arm/common/vic.c +25 -44
128 lines not on this page · raw message
arch/arm/vfp/vfpmodule.c +5 -14
@@ -398,9 +398,9 @@ static void vfp_enable(void *unused) }#ifdef CONFIG_PM -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> -static int vfp_pm_suspend (struct sys_device *dev,pm_message_t state) +static int vfp_pm_suspend (void ) {struct thread_info *ti =current_thread_info ();u32 fpexc =fmrx (FPEXC );
@@ -420,34 +420,25 @@ static int vfp_pm_suspend(struct sys_dev return 0; } -static int vfp_pm_resume (struct sys_device *dev) +static void vfp_pm_resume (void ) {/* ensure we have access to the vfp */ vfp_enable (NULL );/* and disable it to ensure the next usage restores the state */ fmxr (FPEXC ,fmrx (FPEXC ) & ~FPEXC_EN ); - -return 0 ; } -static struct sysdev_class vfp_pm_sysclass = { - .name ="vfp" , +static struct syscore_ops vfp_pm_syscore_ops = { .suspend = vfp_pm_suspend, .resume = vfp_pm_resume, }; -static struct sys_device vfp_pm_sysdev = { - .cls = &vfp_pm_sysclass, -}; -static void vfp_pm_init (void ) { -sysdev_class_register (&vfp_pm_sysclass); -sysdev_register (&vfp_pm_sysdev); +register_syscore_ops (&vfp_pm_syscore_ops); } -#else static inline void vfp_pm_init (void ) { }#endif /* CONFIG_PM */
PATCH 4/14 ARM / OMAP: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management in the OMAP's GPIO code with a struct syscore_ops object which is simpler.
--- arch/arm/plat-omap/gpio.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-)
arch/arm/plat-omap/gpio.c +9 -26
@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h>
@@ -1372,9 +1372,7 @@ static const struct dev_pm_ops omap_mpui .resume_noirq = omap_mpuio_resume_noirq, }; -/* use platform_driver for this, now that there's no longer any -* point to sys_device (other than not disturbing old code). -*/ +/* use platform_driver for this. */ static struct platform_driver omap_mpuio_driver = { .driver = { .name ="mpuio" ,
@@ -1745,7 +1743,7 @@ static int __devinit omap_gpio_probe(str }#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -static int omap_gpio_suspend (struct sys_device *dev,pm_message_t mesg) +static int omap_gpio_suspend (void ) {int i;
@@ -1795,12 +1793,12 @@ static int omap_gpio_suspend(struct sys_return 0 ; } -static int omap_gpio_resume (struct sys_device *dev) +static void omap_gpio_resume (void ) {int i;if (!cpu_class_is_omap2 () && !cpu_is_omap16xx ()) -return 0 ; +return ;for (i =0 ; i < gpio_bank_count; i++) {struct gpio_bank *bank = &gpio_bank[i];
@@ -1836,21 +1834,13 @@ static int omap_gpio_resume(struct sys_d__raw_writel (bank->saved_wakeup, wake_set); spin_unlock_irqrestore(&bank->lock, flags); } - -return 0 ; } -static struct sysdev_class omap_gpio_sysclass = { - .name ="gpio" , +static struct syscore_ops omap_gpio_syscore_ops = { .suspend = omap_gpio_suspend, .resume = omap_gpio_resume, }; -static struct sys_device omap_gpio_device = { - .id =0 , - .cls = &omap_gpio_sysclass, -}; -#endif #ifdef CONFIG_ARCH_OMAP2PLUS
@@ -2108,21 +2098,14 @@ postcore_initcall(omap_gpio_drv_reg);static int __init omap_gpio_sysinit (void ) { -int ret =0 ; -mpuio_init ();#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) { -if (ret ==0 ) { - ret =sysdev_class_register (&omap_gpio_sysclass); -if (ret ==0 ) - ret =sysdev_register (&omap_gpio_device); - } - } +if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) +register_syscore_ops (&omap_gpio_syscore_ops);#endif -return ret; +return 0 ; }arch_initcall (omap_gpio_sysinit);
PATCH 4/14 ARM / OMAP: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management in the OMAP's GPIO code with a struct syscore_ops object which is simpler.
--- arch/arm/plat-omap/gpio.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-)
arch/arm/plat-omap/gpio.c +9 -26
@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h>
@@ -1372,9 +1372,7 @@ static const struct dev_pm_ops omap_mpui .resume_noirq = omap_mpuio_resume_noirq, }; -/* use platform_driver for this, now that there's no longer any -* point to sys_device (other than not disturbing old code). -*/ +/* use platform_driver for this. */ static struct platform_driver omap_mpuio_driver = { .driver = { .name ="mpuio" ,
@@ -1745,7 +1743,7 @@ static int __devinit omap_gpio_probe(str }#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -static int omap_gpio_suspend (struct sys_device *dev,pm_message_t mesg) +static int omap_gpio_suspend (void ) {int i;
@@ -1795,12 +1793,12 @@ static int omap_gpio_suspend(struct sys_return 0 ; } -static int omap_gpio_resume (struct sys_device *dev) +static void omap_gpio_resume (void ) {int i;if (!cpu_class_is_omap2 () && !cpu_is_omap16xx ()) -return 0 ; +return ;for (i =0 ; i < gpio_bank_count; i++) {struct gpio_bank *bank = &gpio_bank[i];
@@ -1836,21 +1834,13 @@ static int omap_gpio_resume(struct sys_d__raw_writel (bank->saved_wakeup, wake_set); spin_unlock_irqrestore(&bank->lock, flags); } - -return 0 ; } -static struct sysdev_class omap_gpio_sysclass = { - .name ="gpio" , +static struct syscore_ops omap_gpio_syscore_ops = { .suspend = omap_gpio_suspend, .resume = omap_gpio_resume, }; -static struct sys_device omap_gpio_device = { - .id =0 , - .cls = &omap_gpio_sysclass, -}; -#endif #ifdef CONFIG_ARCH_OMAP2PLUS
@@ -2108,21 +2098,14 @@ postcore_initcall(omap_gpio_drv_reg);static int __init omap_gpio_sysinit (void ) { -int ret =0 ; -mpuio_init ();#if defined(CONFIG_ARCH_OMAP16XX ) || defined(CONFIG_ARCH_OMAP2PLUS ) -if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) { -if (ret ==0 ) { - ret =sysdev_class_register (&omap_gpio_sysclass); -if (ret ==0 ) - ret =sysdev_register (&omap_gpio_device); - } - } +if (cpu_is_omap16xx () ||cpu_class_is_omap2 ()) +register_syscore_ops (&omap_gpio_syscore_ops);#endif -return ret; +return 0 ; }arch_initcall (omap_gpio_sysinit);
PATCH 5/14 ARM / Integrator: Use struct syscore_ops for core PM
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management by the Integrator interrupt-handling code with a struct syscore_ops object which is simpler.
--- arch/arm/mach-integrator/integrator_ap.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
arch/arm/mach-integrator/integrator_ap.c +9 -17
@@ -24,7 +24,7 @@#include <linux/platform_device.h> #include <linux/slab.h> #include <linux/string.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/amba/bus.h> #include <linux/amba/kmi.h> #include <linux/clocksource.h>
@@ -180,13 +180,13 @@ static void __init ap_init_irq(void)#ifdef CONFIG_PM static unsigned long ic_irq_enable; -static int irq_suspend (struct sys_device *dev,pm_message_t state) +static int irq_suspend (void ) { ic_irq_enable =readl (VA_IC_BASE +IRQ_ENABLE );return 0 ; } -static int irq_resume (struct sys_device *dev) +static void irq_resume (void ) {/* disable all irq sources */ writel (-1 ,VA_CMIC_BASE +IRQ_ENABLE_CLEAR );
@@ -194,33 +194,25 @@ static int irq_resume(struct sys_devicewritel (-1 ,VA_IC_BASE +FIQ_ENABLE_CLEAR ); writel(ic_irq_enable, VA_IC_BASE + IRQ_ENABLE_SET); - return 0; }#else #define irq_suspend NULL#define irq_resume NULL#endif -static struct sysdev_class irq_class = { - .name ="irq" , +static struct syscore_ops irq_syscore_ops = { .suspend = irq_suspend, .resume = irq_resume, }; -static struct sys_device irq_device = { - .id =0 , - .cls = &irq_class, -}; - -static int __init irq_init_sysfs (void ) +static int __init irq_syscore_init (void ) { -int ret =sysdev_class_register (&irq_class); -if (ret ==0 ) - ret =sysdev_register (&irq_device); -return ret; +register_syscore_ops (&irq_syscore_ops); + +return 0 ; } -device_initcall (irq_init_sysfs); +device_initcall (irq_syscore_init);/* * Flash handling.
PATCH 5/14 ARM / Integrator: Use struct syscore_ops for core PM
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management by the Integrator interrupt-handling code with a struct syscore_ops object which is simpler.
--- arch/arm/mach-integrator/integrator_ap.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
arch/arm/mach-integrator/integrator_ap.c +9 -17
@@ -24,7 +24,7 @@#include <linux/platform_device.h> #include <linux/slab.h> #include <linux/string.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/amba/bus.h> #include <linux/amba/kmi.h> #include <linux/clocksource.h>
@@ -180,13 +180,13 @@ static void __init ap_init_irq(void)#ifdef CONFIG_PM static unsigned long ic_irq_enable; -static int irq_suspend (struct sys_device *dev,pm_message_t state) +static int irq_suspend (void ) { ic_irq_enable =readl (VA_IC_BASE +IRQ_ENABLE );return 0 ; } -static int irq_resume (struct sys_device *dev) +static void irq_resume (void ) {/* disable all irq sources */ writel (-1 ,VA_CMIC_BASE +IRQ_ENABLE_CLEAR );
@@ -194,33 +194,25 @@ static int irq_resume(struct sys_devicewritel (-1 ,VA_IC_BASE +FIQ_ENABLE_CLEAR ); writel(ic_irq_enable, VA_IC_BASE + IRQ_ENABLE_SET); - return 0; }#else #define irq_suspend NULL#define irq_resume NULL#endif -static struct sysdev_class irq_class = { - .name ="irq" , +static struct syscore_ops irq_syscore_ops = { .suspend = irq_suspend, .resume = irq_resume, }; -static struct sys_device irq_device = { - .id =0 , - .cls = &irq_class, -}; - -static int __init irq_init_sysfs (void ) +static int __init irq_syscore_init (void ) { -int ret =sysdev_class_register (&irq_class); -if (ret ==0 ) - ret =sysdev_register (&irq_device); -return ret; +register_syscore_ops (&irq_syscore_ops); + +return 0 ; } -device_initcall (irq_init_sysfs); +device_initcall (irq_syscore_init);/* * Flash handling.
PATCH 6/14 ARM / SA1100: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management by the SA1100 interrupt-handling code with a struct syscore_ops object which is simpler.
--- arch/arm/mach-sa1100/irq.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
arch/arm/mach-sa1100/irq.c +6 -13
@@ -14,7 +14,7 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <asm/mach/irq.h>
@@ -234,7 +234,7 @@ static struct sa1100irq_state {unsigned int iccr; } sa1100irq_state; -static int sa1100irq_suspend (struct sys_device *dev,pm_message_t state) +static int sa1100irq_suspend (void ) {struct sa1100irq_state *st = &sa1100irq_state;
@@ -264,7 +264,7 @@ static int sa1100irq_suspend(struct sys_return 0 ; } -static int sa1100irq_resume (struct sys_device *dev) +static void sa1100irq_resume (void ) {struct sa1100irq_state *st = &sa1100irq_state;
@@ -277,24 +277,17 @@ static int sa1100irq_resume(struct sys_dICMR = st->icmr; } -return 0 ; } -static struct sysdev_class sa1100irq_sysclass = { - .name ="sa11x0-irq" , +static struct syscore_ops sa1100irq_syscore_ops = { .suspend = sa1100irq_suspend, .resume = sa1100irq_resume, }; -static struct sys_device sa1100irq_device = { - .id =0 , - .cls = &sa1100irq_sysclass, -}; -static int __init sa1100irq_init_devicefs (void ) { -sysdev_class_register (&sa1100irq_sysclass); -return sysdev_register (&sa1100irq_device); +register_syscore_ops (&sa1100irq_syscore_ops); +return 0 ; }device_initcall (sa1100irq_init_devicefs);
PATCH 6/14 ARM / SA1100: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace the sysdev class and struct sys_device used for power management by the SA1100 interrupt-handling code with a struct syscore_ops object which is simpler.
--- arch/arm/mach-sa1100/irq.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
arch/arm/mach-sa1100/irq.c +6 -13
@@ -14,7 +14,7 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <asm/mach/irq.h>
@@ -234,7 +234,7 @@ static struct sa1100irq_state {unsigned int iccr; } sa1100irq_state; -static int sa1100irq_suspend (struct sys_device *dev,pm_message_t state) +static int sa1100irq_suspend (void ) {struct sa1100irq_state *st = &sa1100irq_state;
@@ -264,7 +264,7 @@ static int sa1100irq_suspend(struct sys_return 0 ; } -static int sa1100irq_resume (struct sys_device *dev) +static void sa1100irq_resume (void ) {struct sa1100irq_state *st = &sa1100irq_state;
@@ -277,24 +277,17 @@ static int sa1100irq_resume(struct sys_dICMR = st->icmr; } -return 0 ; } -static struct sysdev_class sa1100irq_sysclass = { - .name ="sa11x0-irq" , +static struct syscore_ops sa1100irq_syscore_ops = { .suspend = sa1100irq_suspend, .resume = sa1100irq_resume, }; -static struct sys_device sa1100irq_device = { - .id =0 , - .cls = &sa1100irq_sysclass, -}; -static int __init sa1100irq_init_devicefs (void ) { -sysdev_class_register (&sa1100irq_sysclass); -return sysdev_register (&sa1100irq_device); +register_syscore_ops (&sa1100irq_syscore_ops); +return 0 ; }device_initcall (sa1100irq_init_devicefs);
PATCH 7/14 ARM / PXA: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct sys_device objects used for "core" power management by the PXA platform code with struct syscore_ops objects that are simpler.
This reduces the code size and the kernel memory footprint. It also is necessary for removing sysdevs entirely from the kernel in the future.
--- arch/arm/mach-pxa/balloon3.c | 1 arch/arm/mach-pxa/clock-pxa2xx.c | 18 ++---------- arch/arm/mach-pxa/clock-pxa3xx.c | 17 ++--------- arch/arm/mach-pxa/clock.h | 7 ++-- arch/arm/mach-pxa/cm-x270.c | 1 arch/arm/mach-pxa/cm-x2xx.c | 23 ++++------------ arch/arm/mach-pxa/colibri-evalboard.c | 1 arch/arm/mach-pxa/colibri-pxa270-income.c | 1 arch/arm/mach-pxa/colibri-pxa270.c | 1 arch/arm/mach-pxa/generic.h | 8 ++--- arch/arm/mach-pxa/irq.c | 17 ++--------- arch/arm/mach-pxa/lpd270.c | 20 ++++--------- arch/arm/mach-pxa/lubbock.c | 21 ++++---------- arch/arm/mach-pxa/mainstone.c | 22 ++++----------- arch/arm/mach-pxa/mfp-pxa2xx.c | 12 +++----- arch/arm/mach-pxa/mfp-pxa3xx.c | 21 +++----------- arch/arm/mach-pxa/mioa701.c | 43 +++++------------------------- arch/arm/mach-pxa/palmld.c | 1 arch/arm/mach-pxa/palmtreo.c | 1 arch/arm/mach-pxa/palmz72.c | 24 +++++----------- arch/arm/mach-pxa/pxa25x.c | 25 ++++------------- arch/arm/mach-pxa/pxa27x.c | 25 ++++------------- arch/arm/mach-pxa/pxa3xx.c | 25 ++++------------- arch/arm/mach-pxa/pxa95x.c | 20 ++----------- arch/arm/mach-pxa/raumfeld.c | 1 arch/arm/mach-pxa/smemc.c | 29 ++++---------------- arch/arm/mach-pxa/trizeps4.c | 1 arch/arm/mach-pxa/viper.c | 12 ++++---- arch/arm/mach-pxa/vpac270.c | 1 arch/arm/plat-pxa/gpio.c | 17 ++--------- arch/arm/plat-pxa/mfp.c | 1 31 files changed, 110 insertions(+), 307 deletions(-)
arch/arm/plat-pxa/gpio.c +4 -13
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/slab.h> #include <mach/gpio.h>
@@ -295,7 +295,7 @@ void __init pxa_init_gpio(int mux_irq, i }#ifdef CONFIG_PM -static int pxa_gpio_suspend (struct sys_device *dev,pm_message_t state) +static int pxa_gpio_suspend (void ) {struct pxa_gpio_chip *c;int gpio;
@@ -312,7 +312,7 @@ static int pxa_gpio_suspend(struct sys_dreturn 0 ; } -static int pxa_gpio_resume (struct sys_device *dev) +static void pxa_gpio_resume (void ) {struct pxa_gpio_chip *c;int gpio;
@@ -326,22 +326,13 @@ static int pxa_gpio_resume(struct sys_de__raw_writel (c->saved_gfer, c->regbase +GFER_OFFSET ); __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET); } -return 0 ; }#else #define pxa_gpio_suspend NULL#define pxa_gpio_resume NULL#endif -struct sysdev_class pxa_gpio_sysclass = { - .name ="gpio" , +struct syscore_ops pxa_gpio_syscore_ops = { .suspend = pxa_gpio_suspend, .resume = pxa_gpio_resume, }; - -static int __init pxa_gpio_init (void ) -{ -return sysdev_class_register (&pxa_gpio_sysclass); -} - -core_initcall (pxa_gpio_init);
arch/arm/mach-pxa/generic.h +4 -4
@@ -61,10 +61,10 @@ extern unsigned pxa3xx_get_clk_frequency#define pxa3xx_get_clk_frequency_khz (x) (0)#endif -extern struct sysdev_class pxa_irq_sysclass; -extern struct sysdev_class pxa_gpio_sysclass; -extern struct sysdev_class pxa2xx_mfp_sysclass; -extern struct sysdev_class pxa3xx_mfp_sysclass; +extern struct syscore_ops pxa_irq_syscore_ops; +extern struct syscore_ops pxa_gpio_syscore_ops; +extern struct syscore_ops pxa2xx_mfp_syscore_ops; +extern struct syscore_ops pxa3xx_mfp_syscore_ops;void __init pxa_set_ffuart_info (void *info);void __init pxa_set_btuart_info (void *info);
arch/arm/mach-pxa/pxa95x.c +4 -16
@@ -18,7 +18,7 @@#include <linux/i2c/pxa-i2c.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/gpio.h>
@@ -260,16 +260,6 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa95x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa3xx_clock_sysclass, - } -}; -static int __init pxa95x_init (void ) {int ret =0 , i;
@@ -293,11 +283,9 @@ static int __init pxa95x_init(void)if ((ret =pxa_init_dma (IRQ_DMA ,32 )))return ret; -for (i =0 ; i <ARRAY_SIZE (pxa95x_sysdev); i++) { - ret =sysdev_register (&pxa95x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa3xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/clock-pxa3xx.c +4 -13
@@ -10,6 +10,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/syscore_ops.h> #include <mach/smemc.h> #include <mach/pxa3xx-regs.h>
@@ -182,7 +183,7 @@ const struct clkops clk_pxa3xx_pout_opsstatic uint32_t cken[2 ];static uint32_t accr; -static int pxa3xx_clock_suspend (struct sys_device *d,pm_message_t state) +static int pxa3xx_clock_suspend (void ) { cken[0 ] =CKENA ; cken[1 ] =CKENB ;
@@ -190,28 +191,18 @@ static int pxa3xx_clock_suspend(struct s return 0; } -static int pxa3xx_clock_resume (struct sys_device *d) +static void pxa3xx_clock_resume (void ) {ACCR = accr;CKENA = cken[0 ];CKENB = cken[1 ]; -return 0 ; }#else #define pxa3xx_clock_suspend NULL#define pxa3xx_clock_resume NULL#endif -struct sysdev_class pxa3xx_clock_sysclass = { - .name ="pxa3xx-clock" , +struct syscore_ops pxa3xx_clock_syscore_ops = { .suspend = pxa3xx_clock_suspend, .resume = pxa3xx_clock_resume, }; - -static int __init pxa3xx_clock_init (void ) -{ -if (cpu_is_pxa3xx () ||cpu_is_pxa95x ()) -return sysdev_class_register (&pxa3xx_clock_sysclass); -return 0 ; -} -postcore_initcall (pxa3xx_clock_init);
arch/arm/mach-pxa/clock.h +4 -3
@@ -1,5 +1,5 @@#include <linux/clkdev.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> struct clkops {void (*enable)(struct clk *);
@@ -54,7 +54,7 @@ extern const struct clkops clk_pxa2xx_ckvoid clk_pxa2xx_cken_enable (struct clk *clk);void clk_pxa2xx_cken_disable (struct clk *clk); -extern struct sysdev_class pxa2xx_clock_sysclass; +extern struct syscore_ops pxa2xx_clock_syscore_ops;#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)#define DEFINE_PXA3_CKEN (_name, _cken, _rate, _delay) \
@@ -74,5 +74,6 @@ extern const struct clkops clk_pxa3xx_smextern void clk_pxa3xx_cken_enable (struct clk *);extern void clk_pxa3xx_cken_disable (struct clk *); -extern struct sysdev_class pxa3xx_clock_sysclass; +extern struct syscore_ops pxa3xx_clock_syscore_ops; +#endif
arch/arm/mach-pxa/irq.c +4 -13
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <linux/irq.h>
@@ -183,7 +183,7 @@ void __init pxa_init_irq(int irq_nr, setstatic unsigned long saved_icmr[MAX_INTERNAL_IRQS /32 ];static unsigned long saved_ipr[MAX_INTERNAL_IRQS ]; -static int pxa_irq_suspend (struct sys_device *dev,pm_message_t state) +static int pxa_irq_suspend (void ) {int i;
@@ -202,7 +202,7 @@ static int pxa_irq_suspend(struct sys_dereturn 0 ; } -static int pxa_irq_resume (struct sys_device *dev) +static void pxa_irq_resume (void ) {int i;
@@ -218,22 +218,13 @@ static int pxa_irq_resume(struct sys_dev__raw_writel (saved_ipr[i],IRQ_BASE +IPR (i)); __raw_writel(1, IRQ_BASE + ICCR); - return 0; }#else #define pxa_irq_suspend NULL#define pxa_irq_resume NULL#endif -struct sysdev_class pxa_irq_sysclass = { - .name ="irq" , +struct syscore_ops pxa_irq_syscore_ops = { .suspend = pxa_irq_suspend, .resume = pxa_irq_resume, }; - -static int __init pxa_irq_init (void ) -{ -return sysdev_class_register (&pxa_irq_sysclass); -} - -core_initcall (pxa_irq_init);
arch/arm/mach-pxa/clock-pxa2xx.c +4 -14
@@ -9,7 +9,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/pxa2xx-regs.h>
@@ -33,32 +33,22 @@ const struct clkops clk_pxa2xx_cken_ops#ifdef CONFIG_PM static uint32_t saved_cken; -static int pxa2xx_clock_suspend (struct sys_device *d,pm_message_t state) +static int pxa2xx_clock_suspend (void ) { saved_cken =CKEN ;return 0 ; } -static int pxa2xx_clock_resume (struct sys_device *d) +static void pxa2xx_clock_resume (void ) {CKEN = saved_cken; -return 0 ; }#else #define pxa2xx_clock_suspend NULL#define pxa2xx_clock_resume NULL#endif -struct sysdev_class pxa2xx_clock_sysclass = { - .name ="pxa2xx-clock" , +struct syscore_ops pxa2xx_clock_syscore_ops = { .suspend = pxa2xx_clock_suspend, .resume = pxa2xx_clock_resume, }; - -static int __init pxa2xx_clock_init (void ) -{ -if (cpu_is_pxa2xx ()) -return sysdev_class_register (&pxa2xx_clock_sysclass); -return 0 ; -} -postcore_initcall (pxa2xx_clock_init);
arch/arm/mach-pxa/mfp-pxa3xx.c +5 -16
@@ -17,7 +17,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/mfp-pxa3xx.h>
@@ -31,13 +31,13 @@* a pull-down mode if they're an active low chip select, and we're * just entering standby. */ -static int pxa3xx_mfp_suspend (struct sys_device *d,pm_message_t state) +static int pxa3xx_mfp_suspend (void ) {mfp_config_lpm ();return 0 ; } -static int pxa3xx_mfp_resume (struct sys_device *d) +static void pxa3xx_mfp_resume (void ) {mfp_config_run ();
@@ -47,24 +47,13 @@ static int pxa3xx_mfp_resume(struct sys_* preserve them here in case they will be referenced later */ ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); - return 0; }#else #define pxa3xx_mfp_suspend NULL#define pxa3xx_mfp_resume NULL#endif -struct sysdev_class pxa3xx_mfp_sysclass = { - .name ="mfp" , +struct syscore_ops pxa3xx_mfp_syscore_ops = { .suspend = pxa3xx_mfp_suspend, - .resume = pxa3xx_mfp_resume, + .resume = pxa3xx_mfp_resume, }; - -static int __init mfp_init_devicefs (void ) -{ -if (cpu_is_pxa3xx ()) -return sysdev_class_register (&pxa3xx_mfp_sysclass); - -return 0 ; -} -postcore_initcall (mfp_init_devicefs);
arch/arm/mach-pxa/pxa3xx.c +6 -19
@@ -20,7 +20,7 @@#include <linux/platform_device.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/i2c/pxa-i2c.h> #include <asm/mach/map.h>
@@ -427,21 +427,9 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa3xx_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa3xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa3xx_clock_sysclass, - } -}; -static int __init pxa3xx_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa3xx ()) {
@@ -462,11 +450,10 @@ static int __init pxa3xx_init(void)pxa3xx_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa3xx_sysdev); i++) { - ret =sysdev_register (&pxa3xx_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa3xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa3xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/mfp-pxa2xx.c +5 -7
@@ -16,7 +16,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/gpio.h> #include <mach/pxa2xx-regs.h>
@@ -338,7 +338,7 @@ static unsigned long saved_gafr[2][4];static unsigned long saved_gpdr[4 ];static unsigned long saved_pgsr[4 ]; -static int pxa2xx_mfp_suspend (struct sys_device *d,pm_message_t state) +static int pxa2xx_mfp_suspend (void ) {int i;
@@ -365,7 +365,7 @@ static int pxa2xx_mfp_suspend(struct sysreturn 0 ; } -static int pxa2xx_mfp_resume (struct sys_device *d) +static void pxa2xx_mfp_resume (void ) {int i;
@@ -376,15 +376,13 @@ static int pxa2xx_mfp_resume(struct sys_ PGSR(i) = saved_pgsr[i]; }PSSR =PSSR_RDH |PSSR_PH ; -return 0 ; }#else #define pxa2xx_mfp_suspend NULL#define pxa2xx_mfp_resume NULL#endif -struct sysdev_class pxa2xx_mfp_sysclass = { - .name ="mfp" , +struct syscore_ops pxa2xx_mfp_syscore_ops = { .suspend = pxa2xx_mfp_suspend, .resume = pxa2xx_mfp_resume, };
@@ -409,6 +407,6 @@ static int __init pxa2xx_mfp_init(void)for (i =0 ; i <=gpio_to_bank (pxa_last_gpio); i++) gpdr_lpm[i] =GPDR (i *32 ); -return sysdev_class_register (&pxa2xx_mfp_sysclass); +return 0 ; }postcore_initcall (pxa2xx_mfp_init);
arch/arm/mach-pxa/pxa25x.c +6 -19
@@ -21,7 +21,7 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/suspend.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <asm/mach/map.h>
@@ -350,21 +350,9 @@ static struct platform_device *pxa25x_de &pxa_device_asoc_platform, }; -static struct sys_device pxa25x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa2xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa2xx_clock_sysclass, - } -}; -static int __init pxa25x_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa25x ()) {
@@ -377,11 +365,10 @@ static int __init pxa25x_init(void)pxa25x_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa25x_sysdev); i++) { - ret =sysdev_register (&pxa25x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa2xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa2xx_clock_syscore_ops); ret =platform_add_devices (pxa25x_devices,ARRAY_SIZE (pxa25x_devices));
arch/arm/mach-pxa/pxa27x.c +6 -19
@@ -16,7 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <linux/irq.h> #include <linux/i2c/pxa-i2c.h>
@@ -428,21 +428,9 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa27x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa2xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa2xx_clock_sysclass, - } -}; -static int __init pxa27x_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa27x ()) {
@@ -455,11 +443,10 @@ static int __init pxa27x_init(void)pxa27x_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa27x_sysdev); i++) { - ret =sysdev_register (&pxa27x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa2xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa2xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/mioa701.c +8 -35
81 lines not on this page · raw message
arch/arm/mach-pxa/mainstone.c +6 -16
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
@@ -185,31 +185,21 @@ static void __init mainstone_init_irq(vo#ifdef CONFIG_PM -static int mainstone_irq_resume (struct sys_device *dev) +static void mainstone_irq_resume (void ) {MST_INTMSKENA = mainstone_irq_enabled; -return 0 ; } -static struct sysdev_class mainstone_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops mainstone_irq_syscore_ops = { .resume = mainstone_irq_resume, }; -static struct sys_device mainstone_irq_device = { - .cls = &mainstone_irq_sysclass, -}; -static int __init mainstone_irq_device_init (void ) { -int ret = -ENODEV ; +if (machine_is_mainstone ()) +register_syscore_ops (&mainstone_irq_syscore_ops); -if (machine_is_mainstone ()) { - ret =sysdev_class_register (&mainstone_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&mainstone_irq_device); - } -return ret; +return 0 ; }device_initcall (mainstone_irq_device_init);
arch/arm/mach-pxa/cm-x2xx.c +7 -16
@@ -10,7 +10,7 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <linux/gpio.h>
@@ -388,7 +388,7 @@ static inline void cmx2xx_init_display(v#ifdef CONFIG_PM static unsigned long sleep_save_msc[10 ]; -static int cmx2xx_suspend (struct sys_device *dev,pm_message_t state) +static int cmx2xx_suspend (void ) {cmx2xx_pci_suspend ();
@@ -412,7 +412,7 @@ static int cmx2xx_suspend(struct sys_devreturn 0 ; } -static int cmx2xx_resume (struct sys_device *dev) +static void cmx2xx_resume (void ) {cmx2xx_pci_resume ();
@@ -420,27 +420,18 @@ static int cmx2xx_resume(struct sys_devi__raw_writel (sleep_save_msc[0 ],MSC0 );__raw_writel (sleep_save_msc[1 ],MSC1 ); __raw_writel(sleep_save_msc[2], MSC2); - - return 0; } -static struct sysdev_class cmx2xx_pm_sysclass = { - .name ="pm" , +static struct syscore_ops cmx2xx_pm_syscore_ops = { .resume = cmx2xx_resume, .suspend = cmx2xx_suspend, }; -static struct sys_device cmx2xx_pm_device = { - .cls = &cmx2xx_pm_sysclass, -}; -static int __init cmx2xx_pm_init (void ) { -int error; - error =sysdev_class_register (&cmx2xx_pm_sysclass); -if (error ==0 ) - error =sysdev_register (&cmx2xx_pm_device); -return error; +register_syscore_ops (&cmx2xx_pm_syscore_ops); + +return 0 ; }#else static int __init cmx2xx_pm_init (void ) {return 0 ; }
arch/arm/mach-pxa/lpd270.c +6 -14
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
@@ -159,30 +159,22 @@ static void __init lpd270_init_irq(void)#ifdef CONFIG_PM -static int lpd270_irq_resume (struct sys_device *dev) +static void lpd270_irq_resume (void ) {__raw_writew (lpd270_irq_enabled,LPD270_INT_MASK ); -return 0 ; } -static struct sysdev_class lpd270_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops lpd270_irq_syscore_ops = { .resume = lpd270_irq_resume, }; -static struct sys_device lpd270_irq_device = { - .cls = &lpd270_irq_sysclass, -}; -static int __init lpd270_irq_device_init (void ) { -int ret = -ENODEV ;if (machine_is_logicpd_pxa270 ()) { - ret =sysdev_class_register (&lpd270_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&lpd270_irq_device); +register_syscore_ops (&lpd270_irq_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (lpd270_irq_device_init);
arch/arm/mach-pxa/lubbock.c +6 -15
@@ -15,7 +15,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/major.h> #include <linux/fb.h> #include <linux/interrupt.h>
@@ -176,31 +176,22 @@ static void __init lubbock_init_irq(void#ifdef CONFIG_PM -static int lubbock_irq_resume (struct sys_device *dev) +static void lubbock_irq_resume (void ) {LUB_IRQ_MASK_EN = lubbock_irq_enabled; -return 0 ; } -static struct sysdev_class lubbock_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops lubbock_irq_syscore_ops = { .resume = lubbock_irq_resume, }; -static struct sys_device lubbock_irq_device = { - .cls = &lubbock_irq_sysclass, -}; -static int __init lubbock_irq_device_init (void ) { -int ret = -ENODEV ; -if (machine_is_lubbock ()) { - ret =sysdev_class_register (&lubbock_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&lubbock_irq_device); +register_syscore_ops (&lubbock_irq_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (lubbock_irq_device_init);
arch/arm/mach-pxa/viper.c +6 -6
@@ -44,6 +44,7 @@#include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> +#include <linux/syscore_ops.h> #include <mach/pxa25x.h> #include <mach/audio.h>
@@ -130,20 +131,19 @@ static u8 viper_hw_version(void)return v1; } -/* CPU sysdev */ -static int viper_cpu_suspend (struct sys_device *sysdev,pm_message_t state) +/* CPU system core operations. */ +static int viper_cpu_suspend (void ) {viper_icr_set_bit (VIPER_ICR_R_DIS );return 0 ; } -static int viper_cpu_resume (struct sys_device *sysdev) +static void viper_cpu_resume (void ) {viper_icr_clear_bit (VIPER_ICR_R_DIS ); -return 0 ; } -static struct sysdev_driver viper_cpu_sysdev_driver = { +static struct syscore_ops viper_cpu_syscore_ops = { .suspend = viper_cpu_suspend, .resume = viper_cpu_resume, };
@@ -945,7 +945,7 @@ static void __init viper_init(void)viper_init_vcore_gpios ();viper_init_cpufreq (); -sysdev_driver_register (&cpu_sysdev_class, &viper_cpu_sysdev_driver); +register_syscore_ops (&viper_cpu_syscore_ops);if (version) { pr_info("viper: hardware v%di%d detected. "
arch/arm/mach-pxa/palmz72.c +8 -16
@@ -19,7 +19,7 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/delay.h> #include <linux/irq.h> #include <linux/gpio_keys.h>
@@ -233,9 +233,9 @@ static struct palmz72_resume_info palmz7static unsigned long store_ptr; -/* sys_device for Palm Zire 72 PM */ +/* syscore_ops for Palm Zire 72 PM */ -static int palmz72_pm_suspend (struct sys_device *dev,pm_message_t msg) +static int palmz72_pm_suspend (void ) {/* setup the resume_info struct for the original bootloader */ palmz72_resume_info.resume_addr = (u32 ) cpu_resume;
@@ -249,31 +249,23 @@ static int palmz72_pm_suspend(struct sysreturn 0 ; } -static int palmz72_pm_resume (struct sys_device *dev) +static void palmz72_pm_resume (void ) { *PALMZ72_SAVE_DWORD = store_ptr; -return 0 ; } -static struct sysdev_class palmz72_pm_sysclass = { - .name ="palmz72_pm" , +static struct syscore_ops palmz72_pm_syscore_ops = { .suspend = palmz72_pm_suspend, .resume = palmz72_pm_resume, }; -static struct sys_device palmz72_pm_device = { - .cls = &palmz72_pm_sysclass, -}; -static int __init palmz72_pm_init (void ) { -int ret = -ENODEV ;if (machine_is_palmz72 ()) { - ret =sysdev_class_register (&palmz72_pm_sysclass); -if (ret ==0 ) - ret =sysdev_register (&palmz72_pm_device); +register_syscore_ops (&palmz72_pm_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (palmz72_pm_init);
arch/arm/mach-pxa/smemc.c +7 -22
@@ -6,7 +6,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/smemc.h>
@@ -16,7 +16,7 @@ static unsigned long msc[2];static unsigned long sxcnfg, memclkcfg;static unsigned long csadrcfg[4 ]; -static int pxa3xx_smemc_suspend (struct sys_device *dev,pm_message_t state) +static int pxa3xx_smemc_suspend (void ) { msc[0 ] =__raw_readl (MSC0 ); msc[1 ] =__raw_readl (MSC1 );
@@ -30,7 +30,7 @@ static int pxa3xx_smemc_suspend(struct sreturn 0 ; } -static int pxa3xx_smemc_resume (struct sys_device *dev) +static void pxa3xx_smemc_resume (void ) {__raw_writel (msc[0 ],MSC0 );__raw_writel (msc[1 ],MSC1 );
@@ -40,34 +40,19 @@ static int pxa3xx_smemc_resume(struct sy__raw_writel (csadrcfg[1 ],CSADRCFG1 );__raw_writel (csadrcfg[2 ],CSADRCFG2 ); __raw_writel(csadrcfg[3], CSADRCFG3); - - return 0; } -static struct sysdev_class smemc_sysclass = { - .name ="smemc" , +static struct syscore_ops smemc_syscore_ops = { .suspend = pxa3xx_smemc_suspend, .resume = pxa3xx_smemc_resume, }; -static struct sys_device smemc_sysdev = { - .id =0 , - .cls = &smemc_sysclass, -}; -static int __init smemc_init (void ) { -int ret =0 ; +if (cpu_is_pxa3xx ()) +register_syscore_ops (&smemc_syscore_ops); -if (cpu_is_pxa3xx ()) { - ret =sysdev_class_register (&smemc_sysclass); -if (ret) -return ret; - - ret =sysdev_register (&smemc_sysdev); - } - -return ret; +return 0 ; }subsys_initcall (smemc_init);#endif
arch/arm/mach-pxa/palmtreo.c +0 -1
@@ -25,7 +25,6 @@#include <linux/pwm_backlight.h> #include <linux/gpio.h> #include <linux/power_supply.h> -#include <linux/sysdev.h> #include <linux/w1-gpio.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/palmld.c +0 -1
@@ -24,7 +24,6 @@#include <linux/gpio.h> #include <linux/wm97xx.h> #include <linux/power_supply.h> -#include <linux/sysdev.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h>
arch/arm/mach-pxa/colibri-pxa270.c +0 -1
@@ -17,7 +17,6 @@#include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/ucb1400.h> #include <asm/mach/arch.h>
arch/arm/mach-pxa/raumfeld.c +0 -1
@@ -18,7 +18,6 @@#include <linux/init.h> #include <linux/kernel.h> -#include <linux/sysdev.h> #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/gpio.h>
arch/arm/mach-pxa/cm-x270.c +0 -1
@@ -10,7 +10,6 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <linux/gpio.h> #include <linux/delay.h>
arch/arm/mach-pxa/trizeps4.c +0 -1
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
arch/arm/mach-pxa/colibri-evalboard.c +0 -1
@@ -13,7 +13,6 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/gpio.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/vpac270.c +0 -1
@@ -16,7 +16,6 @@#include <linux/gpio_keys.h> #include <linux/input.h> #include <linux/gpio.h> -#include <linux/sysdev.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h>
arch/arm/mach-pxa/colibri-pxa270-income.c +0 -1
@@ -22,7 +22,6 @@#include <linux/platform_device.h> #include <linux/pwm_backlight.h> #include <linux/i2c/pxa-i2c.h> -#include <linux/sysdev.h> #include <asm/irq.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/balloon3.c +0 -1
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
arch/arm/plat-pxa/mfp.c +0 -1
@@ -17,7 +17,6 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> #include <plat/mfp.h>
PATCH 7/14 ARM / PXA: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct sys_device objects used for "core" power management by the PXA platform code with struct syscore_ops objects that are simpler.
This reduces the code size and the kernel memory footprint. It also is necessary for removing sysdevs entirely from the kernel in the future.
--- arch/arm/mach-pxa/balloon3.c | 1 arch/arm/mach-pxa/clock-pxa2xx.c | 18 ++---------- arch/arm/mach-pxa/clock-pxa3xx.c | 17 ++--------- arch/arm/mach-pxa/clock.h | 7 ++-- arch/arm/mach-pxa/cm-x270.c | 1 arch/arm/mach-pxa/cm-x2xx.c | 23 ++++------------ arch/arm/mach-pxa/colibri-evalboard.c | 1 arch/arm/mach-pxa/colibri-pxa270-income.c | 1 arch/arm/mach-pxa/colibri-pxa270.c | 1 arch/arm/mach-pxa/generic.h | 8 ++--- arch/arm/mach-pxa/irq.c | 17 ++--------- arch/arm/mach-pxa/lpd270.c | 20 ++++--------- arch/arm/mach-pxa/lubbock.c | 21 ++++---------- arch/arm/mach-pxa/mainstone.c | 22 ++++----------- arch/arm/mach-pxa/mfp-pxa2xx.c | 12 +++----- arch/arm/mach-pxa/mfp-pxa3xx.c | 21 +++----------- arch/arm/mach-pxa/mioa701.c | 43 +++++------------------------- arch/arm/mach-pxa/palmld.c | 1 arch/arm/mach-pxa/palmtreo.c | 1 arch/arm/mach-pxa/palmz72.c | 24 +++++----------- arch/arm/mach-pxa/pxa25x.c | 25 ++++------------- arch/arm/mach-pxa/pxa27x.c | 25 ++++------------- arch/arm/mach-pxa/pxa3xx.c | 25 ++++------------- arch/arm/mach-pxa/pxa95x.c | 20 ++----------- arch/arm/mach-pxa/raumfeld.c | 1 arch/arm/mach-pxa/smemc.c | 29 ++++---------------- arch/arm/mach-pxa/trizeps4.c | 1 arch/arm/mach-pxa/viper.c | 12 ++++---- arch/arm/mach-pxa/vpac270.c | 1 arch/arm/plat-pxa/gpio.c | 17 ++--------- arch/arm/plat-pxa/mfp.c | 1 31 files changed, 110 insertions(+), 307 deletions(-)
arch/arm/plat-pxa/gpio.c +4 -13
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/slab.h> #include <mach/gpio.h>
@@ -295,7 +295,7 @@ void __init pxa_init_gpio(int mux_irq, i }#ifdef CONFIG_PM -static int pxa_gpio_suspend (struct sys_device *dev,pm_message_t state) +static int pxa_gpio_suspend (void ) {struct pxa_gpio_chip *c;int gpio;
@@ -312,7 +312,7 @@ static int pxa_gpio_suspend(struct sys_dreturn 0 ; } -static int pxa_gpio_resume (struct sys_device *dev) +static void pxa_gpio_resume (void ) {struct pxa_gpio_chip *c;int gpio;
@@ -326,22 +326,13 @@ static int pxa_gpio_resume(struct sys_de__raw_writel (c->saved_gfer, c->regbase +GFER_OFFSET ); __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET); } -return 0 ; }#else #define pxa_gpio_suspend NULL#define pxa_gpio_resume NULL#endif -struct sysdev_class pxa_gpio_sysclass = { - .name ="gpio" , +struct syscore_ops pxa_gpio_syscore_ops = { .suspend = pxa_gpio_suspend, .resume = pxa_gpio_resume, }; - -static int __init pxa_gpio_init (void ) -{ -return sysdev_class_register (&pxa_gpio_sysclass); -} - -core_initcall (pxa_gpio_init);
arch/arm/mach-pxa/generic.h +4 -4
@@ -61,10 +61,10 @@ extern unsigned pxa3xx_get_clk_frequency#define pxa3xx_get_clk_frequency_khz (x) (0)#endif -extern struct sysdev_class pxa_irq_sysclass; -extern struct sysdev_class pxa_gpio_sysclass; -extern struct sysdev_class pxa2xx_mfp_sysclass; -extern struct sysdev_class pxa3xx_mfp_sysclass; +extern struct syscore_ops pxa_irq_syscore_ops; +extern struct syscore_ops pxa_gpio_syscore_ops; +extern struct syscore_ops pxa2xx_mfp_syscore_ops; +extern struct syscore_ops pxa3xx_mfp_syscore_ops;void __init pxa_set_ffuart_info (void *info);void __init pxa_set_btuart_info (void *info);
arch/arm/mach-pxa/pxa95x.c +4 -16
@@ -18,7 +18,7 @@#include <linux/i2c/pxa-i2c.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/gpio.h>
@@ -260,16 +260,6 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa95x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa3xx_clock_sysclass, - } -}; -static int __init pxa95x_init (void ) {int ret =0 , i;
@@ -293,11 +283,9 @@ static int __init pxa95x_init(void)if ((ret =pxa_init_dma (IRQ_DMA ,32 )))return ret; -for (i =0 ; i <ARRAY_SIZE (pxa95x_sysdev); i++) { - ret =sysdev_register (&pxa95x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa3xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/clock-pxa3xx.c +4 -13
@@ -10,6 +10,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/syscore_ops.h> #include <mach/smemc.h> #include <mach/pxa3xx-regs.h>
@@ -182,7 +183,7 @@ const struct clkops clk_pxa3xx_pout_opsstatic uint32_t cken[2 ];static uint32_t accr; -static int pxa3xx_clock_suspend (struct sys_device *d,pm_message_t state) +static int pxa3xx_clock_suspend (void ) { cken[0 ] =CKENA ; cken[1 ] =CKENB ;
@@ -190,28 +191,18 @@ static int pxa3xx_clock_suspend(struct s return 0; } -static int pxa3xx_clock_resume (struct sys_device *d) +static void pxa3xx_clock_resume (void ) {ACCR = accr;CKENA = cken[0 ];CKENB = cken[1 ]; -return 0 ; }#else #define pxa3xx_clock_suspend NULL#define pxa3xx_clock_resume NULL#endif -struct sysdev_class pxa3xx_clock_sysclass = { - .name ="pxa3xx-clock" , +struct syscore_ops pxa3xx_clock_syscore_ops = { .suspend = pxa3xx_clock_suspend, .resume = pxa3xx_clock_resume, }; - -static int __init pxa3xx_clock_init (void ) -{ -if (cpu_is_pxa3xx () ||cpu_is_pxa95x ()) -return sysdev_class_register (&pxa3xx_clock_sysclass); -return 0 ; -} -postcore_initcall (pxa3xx_clock_init);
arch/arm/mach-pxa/clock.h +4 -3
@@ -1,5 +1,5 @@#include <linux/clkdev.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> struct clkops {void (*enable)(struct clk *);
@@ -54,7 +54,7 @@ extern const struct clkops clk_pxa2xx_ckvoid clk_pxa2xx_cken_enable (struct clk *clk);void clk_pxa2xx_cken_disable (struct clk *clk); -extern struct sysdev_class pxa2xx_clock_sysclass; +extern struct syscore_ops pxa2xx_clock_syscore_ops;#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)#define DEFINE_PXA3_CKEN (_name, _cken, _rate, _delay) \
@@ -74,5 +74,6 @@ extern const struct clkops clk_pxa3xx_smextern void clk_pxa3xx_cken_enable (struct clk *);extern void clk_pxa3xx_cken_disable (struct clk *); -extern struct sysdev_class pxa3xx_clock_sysclass; +extern struct syscore_ops pxa3xx_clock_syscore_ops; +#endif
arch/arm/mach-pxa/irq.c +4 -13
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <linux/irq.h>
@@ -183,7 +183,7 @@ void __init pxa_init_irq(int irq_nr, setstatic unsigned long saved_icmr[MAX_INTERNAL_IRQS /32 ];static unsigned long saved_ipr[MAX_INTERNAL_IRQS ]; -static int pxa_irq_suspend (struct sys_device *dev,pm_message_t state) +static int pxa_irq_suspend (void ) {int i;
@@ -202,7 +202,7 @@ static int pxa_irq_suspend(struct sys_dereturn 0 ; } -static int pxa_irq_resume (struct sys_device *dev) +static void pxa_irq_resume (void ) {int i;
@@ -218,22 +218,13 @@ static int pxa_irq_resume(struct sys_dev__raw_writel (saved_ipr[i],IRQ_BASE +IPR (i)); __raw_writel(1, IRQ_BASE + ICCR); - return 0; }#else #define pxa_irq_suspend NULL#define pxa_irq_resume NULL#endif -struct sysdev_class pxa_irq_sysclass = { - .name ="irq" , +struct syscore_ops pxa_irq_syscore_ops = { .suspend = pxa_irq_suspend, .resume = pxa_irq_resume, }; - -static int __init pxa_irq_init (void ) -{ -return sysdev_class_register (&pxa_irq_sysclass); -} - -core_initcall (pxa_irq_init);
arch/arm/mach-pxa/clock-pxa2xx.c +4 -14
@@ -9,7 +9,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/pxa2xx-regs.h>
@@ -33,32 +33,22 @@ const struct clkops clk_pxa2xx_cken_ops#ifdef CONFIG_PM static uint32_t saved_cken; -static int pxa2xx_clock_suspend (struct sys_device *d,pm_message_t state) +static int pxa2xx_clock_suspend (void ) { saved_cken =CKEN ;return 0 ; } -static int pxa2xx_clock_resume (struct sys_device *d) +static void pxa2xx_clock_resume (void ) {CKEN = saved_cken; -return 0 ; }#else #define pxa2xx_clock_suspend NULL#define pxa2xx_clock_resume NULL#endif -struct sysdev_class pxa2xx_clock_sysclass = { - .name ="pxa2xx-clock" , +struct syscore_ops pxa2xx_clock_syscore_ops = { .suspend = pxa2xx_clock_suspend, .resume = pxa2xx_clock_resume, }; - -static int __init pxa2xx_clock_init (void ) -{ -if (cpu_is_pxa2xx ()) -return sysdev_class_register (&pxa2xx_clock_sysclass); -return 0 ; -} -postcore_initcall (pxa2xx_clock_init);
arch/arm/mach-pxa/mfp-pxa3xx.c +5 -16
@@ -17,7 +17,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/mfp-pxa3xx.h>
@@ -31,13 +31,13 @@* a pull-down mode if they're an active low chip select, and we're * just entering standby. */ -static int pxa3xx_mfp_suspend (struct sys_device *d,pm_message_t state) +static int pxa3xx_mfp_suspend (void ) {mfp_config_lpm ();return 0 ; } -static int pxa3xx_mfp_resume (struct sys_device *d) +static void pxa3xx_mfp_resume (void ) {mfp_config_run ();
@@ -47,24 +47,13 @@ static int pxa3xx_mfp_resume(struct sys_* preserve them here in case they will be referenced later */ ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); - return 0; }#else #define pxa3xx_mfp_suspend NULL#define pxa3xx_mfp_resume NULL#endif -struct sysdev_class pxa3xx_mfp_sysclass = { - .name ="mfp" , +struct syscore_ops pxa3xx_mfp_syscore_ops = { .suspend = pxa3xx_mfp_suspend, - .resume = pxa3xx_mfp_resume, + .resume = pxa3xx_mfp_resume, }; - -static int __init mfp_init_devicefs (void ) -{ -if (cpu_is_pxa3xx ()) -return sysdev_class_register (&pxa3xx_mfp_sysclass); - -return 0 ; -} -postcore_initcall (mfp_init_devicefs);
arch/arm/mach-pxa/pxa3xx.c +6 -19
@@ -20,7 +20,7 @@#include <linux/platform_device.h> #include <linux/irq.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/i2c/pxa-i2c.h> #include <asm/mach/map.h>
@@ -427,21 +427,9 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa3xx_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa3xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa3xx_clock_sysclass, - } -}; -static int __init pxa3xx_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa3xx ()) {
@@ -462,11 +450,10 @@ static int __init pxa3xx_init(void)pxa3xx_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa3xx_sysdev); i++) { - ret =sysdev_register (&pxa3xx_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa3xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa3xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/mfp-pxa2xx.c +5 -7
@@ -16,7 +16,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/gpio.h> #include <mach/pxa2xx-regs.h>
@@ -338,7 +338,7 @@ static unsigned long saved_gafr[2][4];static unsigned long saved_gpdr[4 ];static unsigned long saved_pgsr[4 ]; -static int pxa2xx_mfp_suspend (struct sys_device *d,pm_message_t state) +static int pxa2xx_mfp_suspend (void ) {int i;
@@ -365,7 +365,7 @@ static int pxa2xx_mfp_suspend(struct sysreturn 0 ; } -static int pxa2xx_mfp_resume (struct sys_device *d) +static void pxa2xx_mfp_resume (void ) {int i;
@@ -376,15 +376,13 @@ static int pxa2xx_mfp_resume(struct sys_ PGSR(i) = saved_pgsr[i]; }PSSR =PSSR_RDH |PSSR_PH ; -return 0 ; }#else #define pxa2xx_mfp_suspend NULL#define pxa2xx_mfp_resume NULL#endif -struct sysdev_class pxa2xx_mfp_sysclass = { - .name ="mfp" , +struct syscore_ops pxa2xx_mfp_syscore_ops = { .suspend = pxa2xx_mfp_suspend, .resume = pxa2xx_mfp_resume, };
@@ -409,6 +407,6 @@ static int __init pxa2xx_mfp_init(void)for (i =0 ; i <=gpio_to_bank (pxa_last_gpio); i++) gpdr_lpm[i] =GPDR (i *32 ); -return sysdev_class_register (&pxa2xx_mfp_sysclass); +return 0 ; }postcore_initcall (pxa2xx_mfp_init);
arch/arm/mach-pxa/pxa25x.c +6 -19
@@ -21,7 +21,7 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/suspend.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <asm/mach/map.h>
@@ -350,21 +350,9 @@ static struct platform_device *pxa25x_de &pxa_device_asoc_platform, }; -static struct sys_device pxa25x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa2xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa2xx_clock_sysclass, - } -}; -static int __init pxa25x_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa25x ()) {
@@ -377,11 +365,10 @@ static int __init pxa25x_init(void)pxa25x_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa25x_sysdev); i++) { - ret =sysdev_register (&pxa25x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa2xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa2xx_clock_syscore_ops); ret =platform_add_devices (pxa25x_devices,ARRAY_SIZE (pxa25x_devices));
arch/arm/mach-pxa/pxa27x.c +6 -19
@@ -16,7 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <linux/irq.h> #include <linux/i2c/pxa-i2c.h>
@@ -428,21 +428,9 @@ static struct platform_device *devices[] &pxa27x_device_pwm1, }; -static struct sys_device pxa27x_sysdev[] = { - { - .cls = &pxa_irq_sysclass, - }, { - .cls = &pxa2xx_mfp_sysclass, - }, { - .cls = &pxa_gpio_sysclass, - }, { - .cls = &pxa2xx_clock_sysclass, - } -}; -static int __init pxa27x_init (void ) { -int i, ret =0 ; +int ret =0 ;if (cpu_is_pxa27x ()) {
@@ -455,11 +443,10 @@ static int __init pxa27x_init(void)pxa27x_init_pm (); -for (i =0 ; i <ARRAY_SIZE (pxa27x_sysdev); i++) { - ret =sysdev_register (&pxa27x_sysdev[i]); -if (ret) -pr_err ("failed to register sysdev[%d]\n" , i); - } +register_syscore_ops (&pxa_irq_syscore_ops); +register_syscore_ops (&pxa2xx_mfp_syscore_ops); +register_syscore_ops (&pxa_gpio_syscore_ops); +register_syscore_ops (&pxa2xx_clock_syscore_ops); ret =platform_add_devices (devices,ARRAY_SIZE (devices)); }
arch/arm/mach-pxa/mioa701.c +8 -35
81 lines not on this page · raw message
arch/arm/mach-pxa/mainstone.c +6 -16
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
@@ -185,31 +185,21 @@ static void __init mainstone_init_irq(vo#ifdef CONFIG_PM -static int mainstone_irq_resume (struct sys_device *dev) +static void mainstone_irq_resume (void ) {MST_INTMSKENA = mainstone_irq_enabled; -return 0 ; } -static struct sysdev_class mainstone_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops mainstone_irq_syscore_ops = { .resume = mainstone_irq_resume, }; -static struct sys_device mainstone_irq_device = { - .cls = &mainstone_irq_sysclass, -}; -static int __init mainstone_irq_device_init (void ) { -int ret = -ENODEV ; +if (machine_is_mainstone ()) +register_syscore_ops (&mainstone_irq_syscore_ops); -if (machine_is_mainstone ()) { - ret =sysdev_class_register (&mainstone_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&mainstone_irq_device); - } -return ret; +return 0 ; }device_initcall (mainstone_irq_device_init);
arch/arm/mach-pxa/cm-x2xx.c +7 -16
@@ -10,7 +10,7 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <linux/gpio.h>
@@ -388,7 +388,7 @@ static inline void cmx2xx_init_display(v#ifdef CONFIG_PM static unsigned long sleep_save_msc[10 ]; -static int cmx2xx_suspend (struct sys_device *dev,pm_message_t state) +static int cmx2xx_suspend (void ) {cmx2xx_pci_suspend ();
@@ -412,7 +412,7 @@ static int cmx2xx_suspend(struct sys_devreturn 0 ; } -static int cmx2xx_resume (struct sys_device *dev) +static void cmx2xx_resume (void ) {cmx2xx_pci_resume ();
@@ -420,27 +420,18 @@ static int cmx2xx_resume(struct sys_devi__raw_writel (sleep_save_msc[0 ],MSC0 );__raw_writel (sleep_save_msc[1 ],MSC1 ); __raw_writel(sleep_save_msc[2], MSC2); - - return 0; } -static struct sysdev_class cmx2xx_pm_sysclass = { - .name ="pm" , +static struct syscore_ops cmx2xx_pm_syscore_ops = { .resume = cmx2xx_resume, .suspend = cmx2xx_suspend, }; -static struct sys_device cmx2xx_pm_device = { - .cls = &cmx2xx_pm_sysclass, -}; -static int __init cmx2xx_pm_init (void ) { -int error; - error =sysdev_class_register (&cmx2xx_pm_sysclass); -if (error ==0 ) - error =sysdev_register (&cmx2xx_pm_device); -return error; +register_syscore_ops (&cmx2xx_pm_syscore_ops); + +return 0 ; }#else static int __init cmx2xx_pm_init (void ) {return 0 ; }
arch/arm/mach-pxa/lpd270.c +6 -14
@@ -15,7 +15,7 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
@@ -159,30 +159,22 @@ static void __init lpd270_init_irq(void)#ifdef CONFIG_PM -static int lpd270_irq_resume (struct sys_device *dev) +static void lpd270_irq_resume (void ) {__raw_writew (lpd270_irq_enabled,LPD270_INT_MASK ); -return 0 ; } -static struct sysdev_class lpd270_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops lpd270_irq_syscore_ops = { .resume = lpd270_irq_resume, }; -static struct sys_device lpd270_irq_device = { - .cls = &lpd270_irq_sysclass, -}; -static int __init lpd270_irq_device_init (void ) { -int ret = -ENODEV ;if (machine_is_logicpd_pxa270 ()) { - ret =sysdev_class_register (&lpd270_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&lpd270_irq_device); +register_syscore_ops (&lpd270_irq_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (lpd270_irq_device_init);
arch/arm/mach-pxa/lubbock.c +6 -15
@@ -15,7 +15,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/major.h> #include <linux/fb.h> #include <linux/interrupt.h>
@@ -176,31 +176,22 @@ static void __init lubbock_init_irq(void#ifdef CONFIG_PM -static int lubbock_irq_resume (struct sys_device *dev) +static void lubbock_irq_resume (void ) {LUB_IRQ_MASK_EN = lubbock_irq_enabled; -return 0 ; } -static struct sysdev_class lubbock_irq_sysclass = { - .name ="cpld_irq" , +static struct syscore_ops lubbock_irq_syscore_ops = { .resume = lubbock_irq_resume, }; -static struct sys_device lubbock_irq_device = { - .cls = &lubbock_irq_sysclass, -}; -static int __init lubbock_irq_device_init (void ) { -int ret = -ENODEV ; -if (machine_is_lubbock ()) { - ret =sysdev_class_register (&lubbock_irq_sysclass); -if (ret ==0 ) - ret =sysdev_register (&lubbock_irq_device); +register_syscore_ops (&lubbock_irq_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (lubbock_irq_device_init);
arch/arm/mach-pxa/viper.c +6 -6
@@ -44,6 +44,7 @@#include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> +#include <linux/syscore_ops.h> #include <mach/pxa25x.h> #include <mach/audio.h>
@@ -130,20 +131,19 @@ static u8 viper_hw_version(void)return v1; } -/* CPU sysdev */ -static int viper_cpu_suspend (struct sys_device *sysdev,pm_message_t state) +/* CPU system core operations. */ +static int viper_cpu_suspend (void ) {viper_icr_set_bit (VIPER_ICR_R_DIS );return 0 ; } -static int viper_cpu_resume (struct sys_device *sysdev) +static void viper_cpu_resume (void ) {viper_icr_clear_bit (VIPER_ICR_R_DIS ); -return 0 ; } -static struct sysdev_driver viper_cpu_sysdev_driver = { +static struct syscore_ops viper_cpu_syscore_ops = { .suspend = viper_cpu_suspend, .resume = viper_cpu_resume, };
@@ -945,7 +945,7 @@ static void __init viper_init(void)viper_init_vcore_gpios ();viper_init_cpufreq (); -sysdev_driver_register (&cpu_sysdev_class, &viper_cpu_sysdev_driver); +register_syscore_ops (&viper_cpu_syscore_ops);if (version) { pr_info("viper: hardware v%di%d detected. "
arch/arm/mach-pxa/palmz72.c +8 -16
@@ -19,7 +19,7 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/delay.h> #include <linux/irq.h> #include <linux/gpio_keys.h>
@@ -233,9 +233,9 @@ static struct palmz72_resume_info palmz7static unsigned long store_ptr; -/* sys_device for Palm Zire 72 PM */ +/* syscore_ops for Palm Zire 72 PM */ -static int palmz72_pm_suspend (struct sys_device *dev,pm_message_t msg) +static int palmz72_pm_suspend (void ) {/* setup the resume_info struct for the original bootloader */ palmz72_resume_info.resume_addr = (u32 ) cpu_resume;
@@ -249,31 +249,23 @@ static int palmz72_pm_suspend(struct sysreturn 0 ; } -static int palmz72_pm_resume (struct sys_device *dev) +static void palmz72_pm_resume (void ) { *PALMZ72_SAVE_DWORD = store_ptr; -return 0 ; } -static struct sysdev_class palmz72_pm_sysclass = { - .name ="palmz72_pm" , +static struct syscore_ops palmz72_pm_syscore_ops = { .suspend = palmz72_pm_suspend, .resume = palmz72_pm_resume, }; -static struct sys_device palmz72_pm_device = { - .cls = &palmz72_pm_sysclass, -}; -static int __init palmz72_pm_init (void ) { -int ret = -ENODEV ;if (machine_is_palmz72 ()) { - ret =sysdev_class_register (&palmz72_pm_sysclass); -if (ret ==0 ) - ret =sysdev_register (&palmz72_pm_device); +register_syscore_ops (&palmz72_pm_syscore_ops); +return 0 ; } -return ret; +return -ENODEV ; }device_initcall (palmz72_pm_init);
arch/arm/mach-pxa/smemc.c +7 -22
@@ -6,7 +6,7 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <mach/hardware.h> #include <mach/smemc.h>
@@ -16,7 +16,7 @@ static unsigned long msc[2];static unsigned long sxcnfg, memclkcfg;static unsigned long csadrcfg[4 ]; -static int pxa3xx_smemc_suspend (struct sys_device *dev,pm_message_t state) +static int pxa3xx_smemc_suspend (void ) { msc[0 ] =__raw_readl (MSC0 ); msc[1 ] =__raw_readl (MSC1 );
@@ -30,7 +30,7 @@ static int pxa3xx_smemc_suspend(struct sreturn 0 ; } -static int pxa3xx_smemc_resume (struct sys_device *dev) +static void pxa3xx_smemc_resume (void ) {__raw_writel (msc[0 ],MSC0 );__raw_writel (msc[1 ],MSC1 );
@@ -40,34 +40,19 @@ static int pxa3xx_smemc_resume(struct sy__raw_writel (csadrcfg[1 ],CSADRCFG1 );__raw_writel (csadrcfg[2 ],CSADRCFG2 ); __raw_writel(csadrcfg[3], CSADRCFG3); - - return 0; } -static struct sysdev_class smemc_sysclass = { - .name ="smemc" , +static struct syscore_ops smemc_syscore_ops = { .suspend = pxa3xx_smemc_suspend, .resume = pxa3xx_smemc_resume, }; -static struct sys_device smemc_sysdev = { - .id =0 , - .cls = &smemc_sysclass, -}; -static int __init smemc_init (void ) { -int ret =0 ; +if (cpu_is_pxa3xx ()) +register_syscore_ops (&smemc_syscore_ops); -if (cpu_is_pxa3xx ()) { - ret =sysdev_class_register (&smemc_sysclass); -if (ret) -return ret; - - ret =sysdev_register (&smemc_sysdev); - } - -return ret; +return 0 ; }subsys_initcall (smemc_init);#endif
arch/arm/mach-pxa/palmtreo.c +0 -1
@@ -25,7 +25,6 @@#include <linux/pwm_backlight.h> #include <linux/gpio.h> #include <linux/power_supply.h> -#include <linux/sysdev.h> #include <linux/w1-gpio.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/palmld.c +0 -1
@@ -24,7 +24,6 @@#include <linux/gpio.h> #include <linux/wm97xx.h> #include <linux/power_supply.h> -#include <linux/sysdev.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h>
arch/arm/mach-pxa/colibri-pxa270.c +0 -1
@@ -17,7 +17,6 @@#include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/ucb1400.h> #include <asm/mach/arch.h>
arch/arm/mach-pxa/raumfeld.c +0 -1
@@ -18,7 +18,6 @@#include <linux/init.h> #include <linux/kernel.h> -#include <linux/sysdev.h> #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/gpio.h>
arch/arm/mach-pxa/cm-x270.c +0 -1
@@ -10,7 +10,6 @@*/ #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <linux/gpio.h> #include <linux/delay.h>
arch/arm/mach-pxa/trizeps4.c +0 -1
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
arch/arm/mach-pxa/colibri-evalboard.c +0 -1
@@ -13,7 +13,6 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/gpio.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/vpac270.c +0 -1
@@ -16,7 +16,6 @@#include <linux/gpio_keys.h> #include <linux/input.h> #include <linux/gpio.h> -#include <linux/sysdev.h> #include <linux/usb/gpio_vbus.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h>
arch/arm/mach-pxa/colibri-pxa270-income.c +0 -1
@@ -22,7 +22,6 @@#include <linux/platform_device.h> #include <linux/pwm_backlight.h> #include <linux/i2c/pxa-i2c.h> -#include <linux/sysdev.h> #include <asm/irq.h> #include <asm/mach-types.h>
arch/arm/mach-pxa/balloon3.c +0 -1
@@ -15,7 +15,6 @@#include <linux/init.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/sched.h> #include <linux/bitops.h>
arch/arm/plat-pxa/mfp.c +0 -1
@@ -17,7 +17,6 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/sysdev.h> #include <plat/mfp.h>
PATCH 8/14 ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 + arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62 ++++++++++++++-------------- arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68 +++++++++++-------------------- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)
arch/arm/plat-samsung/include/plat/pm.h +4 -2
@@ -103,14 +103,16 @@ extern void s3c_pm_do_restore_core(struc#ifdef CONFIG_PM extern int s3c_irqext_wake (struct irq_data *data,unsigned int state); -extern int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state); -extern int s3c24xx_irq_resume (struct sys_device *dev); +extern int s3c24xx_irq_suspend (void ); +extern void s3c24xx_irq_resume (void );#else #define s3c_irqext_wake NULL#define s3c24xx_irq_suspend NULL#define s3c24xx_irq_resume NULL#endif +extern struct syscore_ops s3c24xx_irq_syscore_ops; +/* PM debug functions */ #ifdef CONFIG_SAMSUNG_PM_DEBUG
arch/arm/plat-s5p/irq-pm.c +2 -5
@@ -16,7 +16,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <plat/cpu.h> #include <plat/irqs.h>
@@ -77,17 +76,15 @@ static struct sleep_save eint_save[] = { SAVE_ITEM(S5P_EINT_MASK(3)), }; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {s3c_pm_do_save (eint_save,ARRAY_SIZE (eint_save));return 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {s3c_pm_do_restore (eint_save,ARRAY_SIZE (eint_save)); - -return 0 ; }
arch/arm/plat-s3c24xx/irq-pm.c +2 -5
@@ -14,7 +14,6 @@#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> -#include <linux/sysdev.h> #include <linux/irq.h> #include <plat/cpu.h>
@@ -65,7 +64,7 @@ static unsigned long save_extint[3];static unsigned long save_eintflt[4 ];static unsigned long save_eintmask; -int s3c24xx_irq_suspend (struct sys_device *dev,pm_message_t state) +int s3c24xx_irq_suspend (void ) {unsigned int i;
@@ -81,7 +80,7 @@ int s3c24xx_irq_suspend(struct sys_devicreturn 0 ; } -int s3c24xx_irq_resume (struct sys_device *dev) +void s3c24xx_irq_resume (void ) {unsigned int i;
@@ -93,6 +92,4 @@ int s3c24xx_irq_resume(struct sys_devices3c_pm_do_restore (irq_save,ARRAY_SIZE (irq_save));__raw_writel (save_eintmask,S3C24XX_EINTMASK ); - -return 0 ; }
arch/arm/mach-s3c2410/irq.c +2 -28
@@ -23,38 +23,12 @@#include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <plat/cpu.h> #include <plat/pm.h> -static int s3c2410_irq_add (struct sys_device *sysdev) -{ -return 0 ; -} - -static struct sysdev_driver s3c2410_irq_driver = { - .add = s3c2410_irq_add, +struct syscore_ops s3c24xx_irq_syscore_ops = { .suspend = s3c24xx_irq_suspend, .resume = s3c24xx_irq_resume, }; - -static int __init s3c2410_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410_sysclass, &s3c2410_irq_driver); -} - -arch_initcall (s3c2410_irq_init); - -static struct sysdev_driver s3c2410a_irq_driver = { - .add = s3c2410_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, -}; - -static int __init s3c2410a_irq_init (void ) -{ -return sysdev_driver_register (&s3c2410a_sysclass, &s3c2410a_irq_driver); -} - -arch_initcall (s3c2410a_irq_init);
arch/arm/mach-s3c2410/pm.c +6 -7
@@ -25,6 +25,7 @@#include <linux/errno.h> #include <linux/time.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/io.h>
@@ -92,7 +93,7 @@ static void s3c2410_pm_prepare(void) } } -static int s3c2410_pm_resume (struct sys_device *dev) +static void s3c2410_pm_resume (void ) {unsigned long tmp;
@@ -104,10 +105,12 @@ static int s3c2410_pm_resume(struct sys_if (machine_is_aml_m5900 () )s3c2410_gpio_setpin (S3C2410_GPF (2 ),0 ); - -return 0 ; } +struct syscore_ops s3c2410_pm_syscore_ops = { + .resume = s3c2410_pm_resume, +}; +static int s3c2410_pm_add (struct sys_device *dev) { pm_cpu_prep = s3c2410_pm_prepare;
@@ -119,7 +122,6 @@ static int s3c2410_pm_add(struct sys_dev#if defined(CONFIG_CPU_S3C2410 )static struct sysdev_driver s3c2410_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };/* register ourselves */
@@ -133,7 +135,6 @@ arch_initcall(s3c2410_pm_drvinit);static struct sysdev_driver s3c2410a_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2410a_pm_drvinit (void )
@@ -147,7 +148,6 @@ arch_initcall(s3c2410a_pm_drvinit);#if defined(CONFIG_CPU_S3C2440 )static struct sysdev_driver s3c2440_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2440_pm_drvinit (void )
@@ -161,7 +161,6 @@ arch_initcall(s3c2440_pm_drvinit);#if defined(CONFIG_CPU_S3C2442 )static struct sysdev_driver s3c2442_pm_driver = { .add = s3c2410_pm_add, - .resume = s3c2410_pm_resume, };static int __init s3c2442_pm_drvinit (void )
arch/arm/plat-samsung/include/plat/cpu.h +6 -0
@@ -68,6 +68,12 @@ extern void s3c24xx_init_uartdevs(char *struct sys_timer ;extern struct sys_timer s3c24xx_timer; +extern struct syscore_ops s3c2410_pm_syscore_ops; +extern struct syscore_ops s3c2412_pm_syscore_ops; +extern struct syscore_ops s3c2416_pm_syscore_ops; +extern struct syscore_ops s3c244x_pm_syscore_ops; +extern struct syscore_ops s3c64xx_irq_syscore_ops; +/* system device classes */ extern struct sysdev_class s3c2410_sysclass;
arch/arm/mach-s3c2410/s3c2410.c +5 -0
@@ -19,6 +19,7 @@#include <linux/gpio.h> #include <linux/clk.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -40,6 +41,7 @@#include <plat/devs.h> #include <plat/clock.h> #include <plat/pll.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -168,6 +170,9 @@ int __init s3c2410_init(void) {printk ("S3C2410: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2410_sysdev); }
arch/arm/mach-s3c2412/irq.c +0 -2
@@ -202,8 +202,6 @@ static int s3c2412_irq_add(struct sys_destatic struct sysdev_driver s3c2412_irq_driver = { .add = s3c2412_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2412_irq_init (void )
arch/arm/mach-s3c2412/pm.c +15 -12
@@ -17,6 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -86,13 +87,24 @@ static struct sleep_save s3c2412_sleep[] SAVE_ITEM(S3C2413_GPJSLPCON), }; -static int s3c2412_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2412_pm_driver = { + .add = s3c2412_pm_add, +}; + +static __init int s3c2412_pm_init (void ) +{ +return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); +} + +arch_initcall (s3c2412_pm_init); + +static int s3c2412_pm_suspend (void ) {s3c_pm_do_save (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep));return 0 ; } -static int s3c2412_pm_resume (struct sys_device *dev) +static void s3c2412_pm_resume (void ) {unsigned long tmp;
@@ -102,18 +114,9 @@ static int s3c2412_pm_resume(struct sys___raw_writel (tmp,S3C2412_PWRCFG );s3c_pm_do_restore (s3c2412_sleep,ARRAY_SIZE (s3c2412_sleep)); -return 0 ; } -static struct sysdev_driver s3c2412_pm_driver = { - .add = s3c2412_pm_add, +struct syscore_ops s3c2412_pm_syscore_ops = { .suspend = s3c2412_pm_suspend, .resume = s3c2412_pm_resume, }; - -static __init int s3c2412_pm_init (void ) -{ -return sysdev_driver_register (&s3c2412_sysclass, &s3c2412_pm_driver); -} - -arch_initcall (s3c2412_pm_init);
arch/arm/mach-s3c2412/s3c2412.c +4 -0
@@ -19,6 +19,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -244,5 +245,8 @@ int __init s3c2412_init(void) {printk ("S3C2412: Initialising architecture\n" ); +register_syscore_ops (&s3c2412_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2412_sysdev); }
arch/arm/mach-s3c2416/irq.c +0 -2
@@ -236,8 +236,6 @@ static int __init s3c2416_irq_add(structstatic struct sysdev_driver s3c2416_irq_driver = { .add = s3c2416_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int __init s3c2416_irq_init (void )
arch/arm/mach-s3c2416/pm.c +12 -15
@@ -11,6 +11,7 @@*/ #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <asm/cacheflush.h>
@@ -55,30 +56,26 @@ static int s3c2416_pm_add(struct sys_devreturn 0 ; } -static int s3c2416_pm_suspend (struct sys_device *dev,pm_message_t state) +static struct sysdev_driver s3c2416_pm_driver = { + .add = s3c2416_pm_add, +}; + +static __init int s3c2416_pm_init (void ) { -return 0 ; +return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); } -static int s3c2416_pm_resume (struct sys_device *dev) +arch_initcall (s3c2416_pm_init); + + +static void s3c2416_pm_resume (void ) {/* unset the return-from-sleep amd inform flags */ __raw_writel (0x0 ,S3C2443_PWRMODE );__raw_writel (0x0 ,S3C2412_INFORM0 );__raw_writel (0x0 ,S3C2412_INFORM1 ); - -return 0 ; } -static struct sysdev_driver s3c2416_pm_driver = { - .add = s3c2416_pm_add, - .suspend = s3c2416_pm_suspend, +struct syscore_ops s3c2416_pm_syscore_ops = { .resume = s3c2416_pm_resume, }; - -static __init int s3c2416_pm_init (void ) -{ -return sysdev_driver_register (&s3c2416_sysclass, &s3c2416_pm_driver); -} - -arch_initcall (s3c2416_pm_init);
arch/arm/mach-s3c2416/s3c2416.c +5 -0
@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h>
@@ -54,6 +55,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/sdhci.h> +#include <plat/pm.h> #include <plat/iic-core.h> #include <plat/fb-core.h>
@@ -95,6 +97,9 @@ int __init s3c2416_init(void)s3c_fb_setname ("s3c2443-fb" ); +register_syscore_ops (&s3c2416_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2416_sysdev); }
arch/arm/mach-s3c2440/s3c244x-irq.c +0 -4
@@ -116,8 +116,6 @@ static int s3c244x_irq_add(struct sys_destatic struct sysdev_driver s3c2440_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };static int s3c2440_irq_init (void )
@@ -129,8 +127,6 @@ arch_initcall(s3c2440_irq_init);static struct sysdev_driver s3c2442_irq_driver = { .add = s3c244x_irq_add, - .suspend = s3c24xx_irq_suspend, - .resume = s3c24xx_irq_resume, };
arch/arm/mach-s3c2440/s3c244x.c +31 -31
85 lines not on this page · raw message
arch/arm/mach-s3c2440/s3c2440.c +8 -0
@@ -19,6 +19,7 @@#include <linux/platform_device.h> #include <linux/serial_core.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h>
@@ -33,6 +34,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -51,6 +53,12 @@ int __init s3c2440_init(void) s3c_device_wdt.resource[1 ].start =IRQ_S3C2440_WDT ; s3c_device_wdt.resource[1 ].end =IRQ_S3C2440_WDT ; +/* register suspend/resume handlers */ + +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +/* register our system device for everything else */ return sysdev_register (&s3c2440_sysdev);
arch/arm/mach-s3c2440/s3c2442.c +6 -0
@@ -29,6 +29,7 @@#include <linux/err.h> #include <linux/device.h> #include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/mutex.h>
@@ -45,6 +46,7 @@#include <plat/clock.h> #include <plat/cpu.h> #include <plat/s3c244x.h> +#include <plat/pm.h> #include <plat/gpio-core.h> #include <plat/gpio-cfg.h>
@@ -167,6 +169,10 @@ int __init s3c2442_init(void) {printk ("S3C2442: Initialising architecture\n" ); +register_syscore_ops (&s3c2410_pm_syscore_ops); +register_syscore_ops (&s3c244x_pm_syscore_ops); +register_syscore_ops (&s3c24xx_irq_syscore_ops); +return sysdev_register (&s3c2442_sysdev); }
arch/arm/mach-s3c64xx/irq-pm.c +9 -9
@@ -13,7 +13,7 @@*/ #include <linux/kernel.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/interrupt.h> #include <linux/serial_core.h> #include <linux/irq.h>
@@ -54,7 +54,7 @@ static struct irq_grp_save {static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS ]; -static int s3c64xx_irq_pm_suspend (struct sys_device *dev,pm_message_t state) +static int s3c64xx_irq_pm_suspend (void ) {struct irq_grp_save *grp = eint_grp_save;int i;
@@ -75,7 +75,7 @@ static int s3c64xx_irq_pm_suspend(structreturn 0 ; } -static int s3c64xx_irq_pm_resume (struct sys_device *dev) +static void s3c64xx_irq_pm_resume (void ) {struct irq_grp_save *grp = eint_grp_save;int i;
@@ -94,18 +94,18 @@ static int s3c64xx_irq_pm_resume(struct }S3C_PMDBG ("%s: IRQ configuration restored\n" , __func__); -return 0 ; } -static struct sysdev_driver s3c64xx_irq_driver = { +struct syscore_ops s3c64xx_irq_syscore_ops = { .suspend = s3c64xx_irq_pm_suspend, .resume = s3c64xx_irq_pm_resume, }; -static int __init s3c64xx_irq_pm_init (void ) +static __init int s3c64xx_syscore_init (void ) { -return sysdev_driver_register (&s3c64xx_sysclass, &s3c64xx_irq_driver); -} +register_syscore_ops (&s3c64xx_irq_syscore_ops); -arch_initcall (s3c64xx_irq_pm_init); +return 0 ; +} +core_initcall (s3c64xx_syscore_init);
arch/arm/mach-s5pv210/pm.c +17 -8
@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/suspend.h> +#include <linux/syscore_ops.h> #include <linux/io.h> #include <plat/cpu.h>
@@ -140,7 +141,17 @@ static int s5pv210_pm_add(struct sys_devreturn 0 ; } -static int s5pv210_pm_resume (struct sys_device *dev) +static struct sysdev_driver s5pv210_pm_driver = { + .add = s5pv210_pm_add, +}; + +static __init int s5pv210_pm_drvinit (void ) +{ +return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +} +arch_initcall (s5pv210_pm_drvinit); + +static void s5pv210_pm_resume (void ) {u32 tmp;
@@ -150,17 +161,15 @@ static int s5pv210_pm_resume(struct sys___raw_writel (tmp ,S5P_OTHERS );s3c_pm_do_restore_core (s5pv210_core_save,ARRAY_SIZE (s5pv210_core_save)); - -return 0 ; } -static struct sysdev_driver s5pv210_pm_driver = { - .add = s5pv210_pm_add, +static struct syscore_ops s5pv210_pm_syscore_ops = { .resume = s5pv210_pm_resume, }; -static __init int s5pv210_pm_drvinit (void ) +static __init int s5pv210_pm_syscore_init (void ) { -return sysdev_driver_register (&s5pv210_sysclass, &s5pv210_pm_driver); +register_syscore_ops (&s5pv210_pm_syscore_ops); +return 0 ; } -arch_initcall (s5pv210_pm_drvinit); +arch_initcall (s5pv210_pm_syscore_init);
arch/arm/mach-exynos4/pm.c +27 -18
67 lines not on this page · raw message
arch/arm/mach-s3c2410/mach-bast.c +5 -12
@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/dm9000.h>
@@ -214,17 +214,16 @@ static struct s3c2410_uartcfg bast_uartc/* NAND Flash on BAST board */ #ifdef CONFIG_PM -static int bast_pm_suspend (struct sys_device *sd,pm_message_t state) +static int bast_pm_suspend (void ) {/* ensure that an nRESET is not generated on resume. */ gpio_direction_output (S3C2410_GPA (21 ),1 );return 0 ; } -static int bast_pm_resume (struct sys_device *sd) +static void bast_pm_resume (void ) {s3c_gpio_cfgpin (S3C2410_GPA (21 ), S3C2410_GPA21_nRSTOUT); -return 0 ; }#else
@@ -232,16 +231,11 @@ static int bast_pm_resume(struct sys_dev#define bast_pm_resume NULL#endif -static struct sysdev_class bast_pm_sysclass = { - .name ="mach-bast" , +static struct syscore_ops bast_pm_syscore_ops = { .suspend = bast_pm_suspend, .resume = bast_pm_resume, }; -static struct sys_device bast_pm_sysdev = { - .cls = &bast_pm_sysclass, -}; -static int smartmedia_map[] = {0 };static int chip0_map[] = {1 };static int chip1_map[] = {2 };
@@ -642,8 +636,7 @@ static void __init bast_map_io(void)static void __init bast_init (void ) { -sysdev_class_register (&bast_pm_sysclass); -sysdev_register (&bast_pm_sysdev); +register_syscore_ops (&bast_pm_syscore_ops);s3c_i2c0_set_platdata (&bast_i2c_info);s3c_nand_set_platdata (&bast_nand_info);
arch/arm/plat-s3c24xx/dma.c +26 -42
117 lines not on this page · raw message
arch/arm/mach-s3c2440/mach-osiris.c +5 -13
@@ -17,7 +17,7 @@#include <linux/init.h> #include <linux/gpio.h> #include <linux/device.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/clk.h> #include <linux/i2c.h>
@@ -284,7 +284,7 @@ static struct platform_device osiris_pcm#ifdef CONFIG_PM static unsigned char pm_osiris_ctrl0; -static int osiris_pm_suspend (struct sys_device *sd,pm_message_t state) +static int osiris_pm_suspend (void ) {unsigned int tmp;
@@ -304,7 +304,7 @@ static int osiris_pm_suspend(struct sys_return 0 ; } -static int osiris_pm_resume (struct sys_device *sd) +static void osiris_pm_resume (void ) {if (pm_osiris_ctrl0 &OSIRIS_CTRL0_FIX8 )__raw_writeb (OSIRIS_CTRL1_FIX8 ,OSIRIS_VA_CTRL1 );
@@ -312,8 +312,6 @@ static int osiris_pm_resume(struct sys_d__raw_writeb (pm_osiris_ctrl0,OSIRIS_VA_CTRL0 ); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); - - return 0; }#else
@@ -321,16 +319,11 @@ static int osiris_pm_resume(struct sys_d#define osiris_pm_resume NULL#endif -static struct sysdev_class osiris_pm_sysclass = { - .name ="mach-osiris" , +static struct syscore_ops osiris_pm_syscore_ops = { .suspend = osiris_pm_suspend, .resume = osiris_pm_resume, }; -static struct sys_device osiris_pm_sysdev = { - .cls = &osiris_pm_sysclass, -}; -/* Link for DVS driver to TPS65011 */ static void osiris_tps_release (struct device *dev)
@@ -439,8 +432,7 @@ static void __init osiris_map_io(void)static void __init osiris_init (void ) { -sysdev_class_register (&osiris_pm_sysclass); -sysdev_register (&osiris_pm_sysdev); +register_syscore_ops (&osiris_pm_syscore_ops);s3c_i2c0_set_platdata (NULL );s3c_nand_set_platdata (&osiris_nand_info);
arch/arm/mach-s3c2412/mach-jive.c +6 -13
@@ -17,7 +17,7 @@#include <linux/timer.h> #include <linux/init.h> #include <linux/gpio.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/i2c.h>
@@ -486,7 +486,7 @@ static struct s3c2410_udc_mach_info jive/* Jive power management device */ #ifdef CONFIG_PM -static int jive_pm_suspend (struct sys_device *sd,pm_message_t state) +static int jive_pm_suspend (void ) {/* Write the magic value u-boot uses to check for resume into * the INFORM0 register, and ensure INFORM1 is set to the
@@ -498,10 +498,9 @@ static int jive_pm_suspend(struct sys_de return 0; } -static int jive_pm_resume (struct sys_device *sd) +static void jive_pm_resume (void ) {__raw_writel (0x0 ,S3C2412_INFORM0 ); -return 0 ; }#else
@@ -509,16 +508,11 @@ static int jive_pm_resume(struct sys_dev#define jive_pm_resume NULL#endif -static struct sysdev_class jive_pm_sysclass = { - .name ="jive-pm" , +static struct syscore_ops jive_pm_syscore_ops = { .suspend = jive_pm_suspend, .resume = jive_pm_resume, }; -static struct sys_device jive_pm_sysdev = { - .cls = &jive_pm_sysclass, -}; -static void __init jive_map_io (void ) {s3c24xx_init_io (jive_iodesc,ARRAY_SIZE (jive_iodesc));
@@ -536,10 +530,9 @@ static void jive_power_off(void)static void __init jive_machine_init (void ) { -/* register system devices for managing low level suspend */ +/* register system core operations for managing low level suspend */ -sysdev_class_register (&jive_pm_sysclass); -sysdev_register (&jive_pm_sysdev); +register_syscore_ops (&jive_pm_syscore_ops);/* write our sleep configurations for the IO. Pull down all unused * IO, ensure that we have turned off all peripherals we do not
RE: [PATCH 8/14] ARM / Samsung: Use struct syscore_ops for "core" power management
Quoted 7 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects that are simpler.
Quoted 5 lines
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 <[email protected]>
Quoted 10 lines
--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 +
Quoted 8 lines
arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62
++++++++++++++--------------
Quoted 3 lines
arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68
+++++++++++-----------------
Quoted 7 lines
--- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
Re: [PATCH 8/14] ARM / Samsung: Use struct syscore_ops for "core" power management
In reply to Rafael J. WysockiQuoted 7 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Replace sysdev classes and struct
sys_deviceobjects used for "core" power management by Samsung platforms with structsyscore_opsobjects that are simpler.
Quoted 5 lines
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 <[email protected]>
Quoted 10 lines
--- arch/arm/mach-exynos4/pm.c | 45 ++++++++++++-------- arch/arm/mach-s3c2410/irq.c | 30 ------------- arch/arm/mach-s3c2410/mach-bast.c | 17 ++----- arch/arm/mach-s3c2410/pm.c | 13 ++--- arch/arm/mach-s3c2410/s3c2410.c | 5 ++ arch/arm/mach-s3c2412/irq.c | 2 arch/arm/mach-s3c2412/mach-jive.c | 19 ++------ arch/arm/mach-s3c2412/pm.c | 27 ++++++------ arch/arm/mach-s3c2412/s3c2412.c | 4 +
Quoted 8 lines
arch/arm/mach-s3c2416/irq.c | 2 arch/arm/mach-s3c2416/pm.c | 27 +++++------- arch/arm/mach-s3c2416/s3c2416.c | 5 ++ arch/arm/mach-s3c2440/mach-osiris.c | 18 ++------ arch/arm/mach-s3c2440/s3c2440.c | 8 +++ arch/arm/mach-s3c2440/s3c2442.c | 6 ++ arch/arm/mach-s3c2440/s3c244x-irq.c | 4 - arch/arm/mach-s3c2440/s3c244x.c | 62
++++++++++++++--------------
Quoted 3 lines
arch/arm/mach-s3c64xx/irq-pm.c | 18 ++++---- arch/arm/mach-s5pv210/pm.c | 25 +++++++---- arch/arm/plat-s3c24xx/dma.c | 68
+++++++++++-----------------
Quoted 7 lines
--- arch/arm/plat-s3c24xx/irq-pm.c | 7 --- arch/arm/plat-s5p/irq-pm.c | 7 --- arch/arm/plat-samsung/include/plat/cpu.h | 6 ++ arch/arm/plat-samsung/include/plat/pm.h | 6 +- 24 files changed, 203 insertions(+), 228 deletions(-)
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.