aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-04-30 18:09:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-30 19:40:40 -0400
commite8c9c502690efd24b7055bf608e7a3c34216848b (patch)
tree1583f34ec9cac07ddfdcb24de66e49718b107436 /arch
parent11d77d0c01b80e44c7aceb21928508dafce774f9 (diff)
power management: implement pm_ops.valid for everybody
Almost all users of pm_ops only support mem sleep, don't check in .valid and don't reject any others in .prepare so users can be confused if they check /sys/power/state, especially when new states are added (these would then result in s-t-r although they're supposed to be something different). This patch implements a generic pm_valid_only_mem function that is then exported for users and puts it to use in almost all existing pm_ops. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: David Brownell <david-b@pacbell.net> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: linux-pm@lists.linux-foundation.org Cc: Len Brown <lenb@kernel.org> Acked-by: Russell King <rmk@arm.linux.org.uk> Cc: Greg KH <greg@kroah.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/common/sharpsl_pm.c1
-rw-r--r--arch/arm/mach-omap1/pm.c1
-rw-r--r--arch/arm/mach-omap2/pm.c1
-rw-r--r--arch/arm/mach-pnx4008/pm.c39
-rw-r--r--arch/arm/mach-pxa/pm.c1
-rw-r--r--arch/arm/mach-sa1100/pm.c1
-rw-r--r--arch/arm/plat-s3c24xx/pm.c19
-rw-r--r--arch/sh/boards/hp6xx/pm.c1
8 files changed, 11 insertions, 53 deletions
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index 4cb895d4ae5b..5972df2b9af4 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -769,6 +769,7 @@ static struct pm_ops sharpsl_pm_ops = {
769 .prepare = pxa_pm_prepare, 769 .prepare = pxa_pm_prepare,
770 .enter = corgi_pxa_pm_enter, 770 .enter = corgi_pxa_pm_enter,
771 .finish = pxa_pm_finish, 771 .finish = pxa_pm_finish,
772 .valid = pm_valid_only_mem,
772}; 773};
773 774
774static int __init sharpsl_pm_probe(struct platform_device *pdev) 775static int __init sharpsl_pm_probe(struct platform_device *pdev)
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 4248117e5e3f..0383ab334270 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -701,6 +701,7 @@ static struct pm_ops omap_pm_ops ={
701 .prepare = omap_pm_prepare, 701 .prepare = omap_pm_prepare,
702 .enter = omap_pm_enter, 702 .enter = omap_pm_enter,
703 .finish = omap_pm_finish, 703 .finish = omap_pm_finish,
704 .valid = pm_valid_only_mem,
704}; 705};
705 706
706static int __init omap_pm_init(void) 707static int __init omap_pm_init(void)
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 3e9a128feea1..6f4a5436d0ce 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -373,6 +373,7 @@ static struct pm_ops omap_pm_ops = {
373 .prepare = omap2_pm_prepare, 373 .prepare = omap2_pm_prepare,
374 .enter = omap2_pm_enter, 374 .enter = omap2_pm_enter,
375 .finish = omap2_pm_finish, 375 .finish = omap2_pm_finish,
376 .valid = pm_valid_only_mem,
376}; 377};
377 378
378int __init omap2_pm_init(void) 379int __init omap2_pm_init(void)
diff --git a/arch/arm/mach-pnx4008/pm.c b/arch/arm/mach-pnx4008/pm.c
index 3649cd3dfc9a..2a137f33f752 100644
--- a/arch/arm/mach-pnx4008/pm.c
+++ b/arch/arm/mach-pnx4008/pm.c
@@ -107,50 +107,19 @@ static int pnx4008_pm_enter(suspend_state_t state)
107 case PM_SUSPEND_MEM: 107 case PM_SUSPEND_MEM:
108 pnx4008_suspend(); 108 pnx4008_suspend();
109 break; 109 break;
110 case PM_SUSPEND_DISK:
111 return -ENOTSUPP;
112 default:
113 return -EINVAL;
114 } 110 }
115 return 0; 111 return 0;
116} 112}
117 113
118/* 114static int pnx4008_pm_valid(suspend_state_t state)
119 * Called after processes are frozen, but before we shut down devices.
120 */
121static int pnx4008_pm_prepare(suspend_state_t state)
122{
123 switch (state) {
124 case PM_SUSPEND_STANDBY:
125 case PM_SUSPEND_MEM:
126 break;
127
128 case PM_SUSPEND_DISK:
129 return -ENOTSUPP;
130 break;
131
132 default:
133 return -EINVAL;
134 break;
135 }
136 return 0;
137}
138
139/*
140 * Called after devices are re-setup, but before processes are thawed.
141 */
142static int pnx4008_pm_finish(suspend_state_t state)
143{ 115{
144 return 0; 116 return (state == PM_SUSPEND_STANDBY) ||
117 (state == PM_SUSPEND_MEM);
145} 118}
146 119
147/*
148 * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
149 */
150static struct pm_ops pnx4008_pm_ops = { 120static struct pm_ops pnx4008_pm_ops = {
151 .prepare = pnx4008_pm_prepare,
152 .enter = pnx4008_pm_enter, 121 .enter = pnx4008_pm_enter,
153 .finish = pnx4008_pm_finish, 122 .valid = pnx4008_pm_valid,
154}; 123};
155 124
156static int __init pnx4008_pm_init(void) 125static int __init pnx4008_pm_init(void)
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index 0a99ef43b36f..6bf15ae73848 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -227,6 +227,7 @@ static struct pm_ops pxa_pm_ops = {
227 .prepare = pxa_pm_prepare, 227 .prepare = pxa_pm_prepare,
228 .enter = pxa_pm_enter, 228 .enter = pxa_pm_enter,
229 .finish = pxa_pm_finish, 229 .finish = pxa_pm_finish,
230 .valid = pm_valid_only_mem,
230}; 231};
231 232
232static int __init pxa_pm_init(void) 233static int __init pxa_pm_init(void)
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index b0837113b2aa..d674cf343156 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -133,6 +133,7 @@ unsigned long sleep_phys_sp(void *sp)
133 133
134static struct pm_ops sa11x0_pm_ops = { 134static struct pm_ops sa11x0_pm_ops = {
135 .enter = sa11x0_pm_enter, 135 .enter = sa11x0_pm_enter,
136 .valid = pm_valid_only_mem,
136}; 137};
137 138
138static int __init sa11x0_pm_init(void) 139static int __init sa11x0_pm_init(void)
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index d6af3082af30..c6b03f8ab260 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -612,26 +612,9 @@ static int s3c2410_pm_enter(suspend_state_t state)
612 return 0; 612 return 0;
613} 613}
614 614
615/*
616 * Called after processes are frozen, but before we shut down devices.
617 */
618static int s3c2410_pm_prepare(suspend_state_t state)
619{
620 return 0;
621}
622
623/*
624 * Called after devices are re-setup, but before processes are thawed.
625 */
626static int s3c2410_pm_finish(suspend_state_t state)
627{
628 return 0;
629}
630
631static struct pm_ops s3c2410_pm_ops = { 615static struct pm_ops s3c2410_pm_ops = {
632 .prepare = s3c2410_pm_prepare,
633 .enter = s3c2410_pm_enter, 616 .enter = s3c2410_pm_enter,
634 .finish = s3c2410_pm_finish, 617 .valid = pm_valid_only_mem,
635}; 618};
636 619
637/* s3c2410_pm_init 620/* s3c2410_pm_init
diff --git a/arch/sh/boards/hp6xx/pm.c b/arch/sh/boards/hp6xx/pm.c
index 4b2f29a4bde9..8143d1b948e7 100644
--- a/arch/sh/boards/hp6xx/pm.c
+++ b/arch/sh/boards/hp6xx/pm.c
@@ -69,6 +69,7 @@ static int hp6x0_pm_enter(suspend_state_t state)
69 69
70static struct pm_ops hp6x0_pm_ops = { 70static struct pm_ops hp6x0_pm_ops = {
71 .enter = hp6x0_pm_enter, 71 .enter = hp6x0_pm_enter,
72 .valid = pm_valid_only_mem,
72}; 73};
73 74
74static int __init hp6x0_pm_init(void) 75static int __init hp6x0_pm_init(void)