aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pnx4008
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/arm/mach-pnx4008
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/arm/mach-pnx4008')
-rw-r--r--arch/arm/mach-pnx4008/pm.c39
1 files changed, 4 insertions, 35 deletions
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)