From e6c5eb9541f2197a3ffab90b1c7a3250a9b51bf6 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Thu, 18 Oct 2007 03:04:41 -0700 Subject: PM: Rework struct platform_suspend_ops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Pavel Machek Cc: Len Brown Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/powerpc/platforms/52xx/lite5200_pm.c | 34 ++++++++++++++++++++----------- arch/powerpc/platforms/52xx/mpc52xx_pm.c | 9 ++------ 2 files changed, 24 insertions(+), 19 deletions(-) (limited to 'arch/powerpc') 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 @@ #include -#include +#include #include #include #include @@ -18,6 +18,8 @@ static void __iomem *sram; static const int sram_size = 0x4000; /* 16 kBytes */ static void __iomem *mbar; +static suspend_state_t lite5200_pm_target_state; + static int lite5200_pm_valid(suspend_state_t state) { switch (state) { @@ -29,13 +31,22 @@ static int lite5200_pm_valid(suspend_state_t state) } } -static int lite5200_pm_prepare(suspend_state_t state) +static int lite5200_pm_set_target(suspend_state_t state) +{ + if (lite5200_pm_valid(state)) { + lite5200_pm_target_state = state; + return 0; + } + return -EINVAL; +} + +static int lite5200_pm_prepare(void) { /* deep sleep? let mpc52xx code handle that */ - if (state == PM_SUSPEND_STANDBY) - return mpc52xx_pm_prepare(state); + if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) + return mpc52xx_pm_prepare(); - if (state != PM_SUSPEND_MEM) + if (lite5200_pm_target_state != PM_SUSPEND_MEM) return -EINVAL; /* map registers */ @@ -190,17 +201,16 @@ static int lite5200_pm_enter(suspend_state_t state) return 0; } -static int lite5200_pm_finish(suspend_state_t state) +static void lite5200_pm_finish(void) { /* deep sleep? let mpc52xx code handle that */ - if (state == PM_SUSPEND_STANDBY) { - return mpc52xx_pm_finish(state); - } - return 0; + if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) + mpc52xx_pm_finish(); } -static struct pm_ops lite5200_pm_ops = { +static struct platform_suspend_ops lite5200_pm_ops = { .valid = lite5200_pm_valid, + .set_target = lite5200_pm_set_target, .prepare = lite5200_pm_prepare, .enter = lite5200_pm_enter, .finish = lite5200_pm_finish, @@ -208,6 +218,6 @@ static struct pm_ops lite5200_pm_ops = { int __init lite5200_pm_init(void) { - pm_set_ops(&lite5200_pm_ops); + suspend_set_ops(&lite5200_pm_ops); return 0; } 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) return 0; } -int mpc52xx_pm_prepare(suspend_state_t state) +int mpc52xx_pm_prepare(void) { - if (state != PM_SUSPEND_STANDBY) - return -EINVAL; - /* map the whole register space */ mbar = mpc52xx_find_and_map("mpc5200"); if (!mbar) { @@ -166,15 +163,13 @@ int mpc52xx_pm_enter(suspend_state_t state) return 0; } -int mpc52xx_pm_finish(suspend_state_t state) +void mpc52xx_pm_finish(void) { /* call board resume code */ if (mpc52xx_suspend.board_resume_finish) mpc52xx_suspend.board_resume_finish(mbar); iounmap(mbar); - - return 0; } static struct platform_suspend_ops mpc52xx_pm_ops = { -- cgit v1.2.2