diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2007-10-18 06:04:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:18 -0400 |
commit | e6c5eb9541f2197a3ffab90b1c7a3250a9b51bf6 (patch) | |
tree | ac227415da22d4345f8e72a6a8e781757b6ce85a /arch/powerpc | |
parent | 26398a70ea35f153feb799fa850c71685667712b (diff) |
PM: Rework struct platform_suspend_ops
There is no reason why the .prepare() and .finish() methods in 'struct
platform_suspend_ops' should take any arguments, since architectures don't use
these methods' argument in any practically meaningful way (ie. either the
target system sleep state is conveyed to the platform by .set_target(), or
there is only one suspend state supported and it is indicated to the PM core
by .valid(), or .prepare() and .finish() aren't defined at all). There also
is no reason why .finish() should return any result.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Len Brown <lenb@kernel.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/52xx/lite5200_pm.c | 34 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/mpc52xx_pm.c | 9 |
2 files changed, 24 insertions, 19 deletions
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c index f26afcd41757..ffa14aff5248 100644 --- a/arch/powerpc/platforms/52xx/lite5200_pm.c +++ b/arch/powerpc/platforms/52xx/lite5200_pm.c | |||
@@ -1,5 +1,5 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/pm.h> | 2 | #include <linux/suspend.h> |
3 | #include <asm/io.h> | 3 | #include <asm/io.h> |
4 | #include <asm/time.h> | 4 | #include <asm/time.h> |
5 | #include <asm/mpc52xx.h> | 5 | #include <asm/mpc52xx.h> |
@@ -18,6 +18,8 @@ static void __iomem *sram; | |||
18 | static const int sram_size = 0x4000; /* 16 kBytes */ | 18 | static const int sram_size = 0x4000; /* 16 kBytes */ |
19 | static void __iomem *mbar; | 19 | static void __iomem *mbar; |
20 | 20 | ||
21 | static suspend_state_t lite5200_pm_target_state; | ||
22 | |||
21 | static int lite5200_pm_valid(suspend_state_t state) | 23 | static int lite5200_pm_valid(suspend_state_t state) |
22 | { | 24 | { |
23 | switch (state) { | 25 | switch (state) { |
@@ -29,13 +31,22 @@ static int lite5200_pm_valid(suspend_state_t state) | |||
29 | } | 31 | } |
30 | } | 32 | } |
31 | 33 | ||
32 | static int lite5200_pm_prepare(suspend_state_t state) | 34 | static int lite5200_pm_set_target(suspend_state_t state) |
35 | { | ||
36 | if (lite5200_pm_valid(state)) { | ||
37 | lite5200_pm_target_state = state; | ||
38 | return 0; | ||
39 | } | ||
40 | return -EINVAL; | ||
41 | } | ||
42 | |||
43 | static int lite5200_pm_prepare(void) | ||
33 | { | 44 | { |
34 | /* deep sleep? let mpc52xx code handle that */ | 45 | /* deep sleep? let mpc52xx code handle that */ |
35 | if (state == PM_SUSPEND_STANDBY) | 46 | if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) |
36 | return mpc52xx_pm_prepare(state); | 47 | return mpc52xx_pm_prepare(); |
37 | 48 | ||
38 | if (state != PM_SUSPEND_MEM) | 49 | if (lite5200_pm_target_state != PM_SUSPEND_MEM) |
39 | return -EINVAL; | 50 | return -EINVAL; |
40 | 51 | ||
41 | /* map registers */ | 52 | /* map registers */ |
@@ -190,17 +201,16 @@ static int lite5200_pm_enter(suspend_state_t state) | |||
190 | return 0; | 201 | return 0; |
191 | } | 202 | } |
192 | 203 | ||
193 | static int lite5200_pm_finish(suspend_state_t state) | 204 | static void lite5200_pm_finish(void) |
194 | { | 205 | { |
195 | /* deep sleep? let mpc52xx code handle that */ | 206 | /* deep sleep? let mpc52xx code handle that */ |
196 | if (state == PM_SUSPEND_STANDBY) { | 207 | if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) |
197 | return mpc52xx_pm_finish(state); | 208 | mpc52xx_pm_finish(); |
198 | } | ||
199 | return 0; | ||
200 | } | 209 | } |
201 | 210 | ||
202 | static struct pm_ops lite5200_pm_ops = { | 211 | static struct platform_suspend_ops lite5200_pm_ops = { |
203 | .valid = lite5200_pm_valid, | 212 | .valid = lite5200_pm_valid, |
213 | .set_target = lite5200_pm_set_target, | ||
204 | .prepare = lite5200_pm_prepare, | 214 | .prepare = lite5200_pm_prepare, |
205 | .enter = lite5200_pm_enter, | 215 | .enter = lite5200_pm_enter, |
206 | .finish = lite5200_pm_finish, | 216 | .finish = lite5200_pm_finish, |
@@ -208,6 +218,6 @@ static struct pm_ops lite5200_pm_ops = { | |||
208 | 218 | ||
209 | int __init lite5200_pm_init(void) | 219 | int __init lite5200_pm_init(void) |
210 | { | 220 | { |
211 | pm_set_ops(&lite5200_pm_ops); | 221 | suspend_set_ops(&lite5200_pm_ops); |
212 | return 0; | 222 | return 0; |
213 | } | 223 | } |
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pm.c b/arch/powerpc/platforms/52xx/mpc52xx_pm.c index 44fb064c7a16..7ffa7babf254 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pm.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pm.c | |||
@@ -57,11 +57,8 @@ int mpc52xx_set_wakeup_gpio(u8 pin, u8 level) | |||
57 | return 0; | 57 | return 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | int mpc52xx_pm_prepare(suspend_state_t state) | 60 | int mpc52xx_pm_prepare(void) |
61 | { | 61 | { |
62 | if (state != PM_SUSPEND_STANDBY) | ||
63 | return -EINVAL; | ||
64 | |||
65 | /* map the whole register space */ | 62 | /* map the whole register space */ |
66 | mbar = mpc52xx_find_and_map("mpc5200"); | 63 | mbar = mpc52xx_find_and_map("mpc5200"); |
67 | if (!mbar) { | 64 | if (!mbar) { |
@@ -166,15 +163,13 @@ int mpc52xx_pm_enter(suspend_state_t state) | |||
166 | return 0; | 163 | return 0; |
167 | } | 164 | } |
168 | 165 | ||
169 | int mpc52xx_pm_finish(suspend_state_t state) | 166 | void mpc52xx_pm_finish(void) |
170 | { | 167 | { |
171 | /* call board resume code */ | 168 | /* call board resume code */ |
172 | if (mpc52xx_suspend.board_resume_finish) | 169 | if (mpc52xx_suspend.board_resume_finish) |
173 | mpc52xx_suspend.board_resume_finish(mbar); | 170 | mpc52xx_suspend.board_resume_finish(mbar); |
174 | 171 | ||
175 | iounmap(mbar); | 172 | iounmap(mbar); |
176 | |||
177 | return 0; | ||
178 | } | 173 | } |
179 | 174 | ||
180 | static struct platform_suspend_ops mpc52xx_pm_ops = { | 175 | static struct platform_suspend_ops mpc52xx_pm_ops = { |