lkml.org 
[lkml]   [2009]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] acerhdf: convert to dev_pm_ops
On Thu, Jul 23, 2009 at 02:53:17PM +0200, Borislav Petkov wrote:
> > Dmitry's right, suspend() and resume() are used only for S2R. Since
> > the only thing we do when suspending/hibernating is set fan speed to
> > auto, we might just as well replicate those functions to .freeze() and
> > .thaw().
>
> here's a fix:
>
> --
> From: Borislav Petkov <petkovbb@gmail.com>
> Date: Wed, 15 Jul 2009 17:33:32 +0200
> Subject: [PATCH] acerhdf: convert to dev_pm_ops
>
> v 1.1:
> Add .freeze/.thaw func ptrs to support
> suspend-to-disk, as suggested by Dmitry Torokhov.
>
> Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
> ---
> drivers/platform/x86/acerhdf.c | 16 +++++++++++-----
> 1 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> index aa298d6..8cd7a7b 100644
> --- a/drivers/platform/x86/acerhdf.c
> +++ b/drivers/platform/x86/acerhdf.c
> @@ -435,7 +435,7 @@ struct thermal_cooling_device_ops acerhdf_cooling_ops = {
> };
>
> /* suspend / resume functionality */
> -static int acerhdf_suspend(struct platform_device *dev, pm_message_t state)
> +static int acerhdf_suspend(struct device *dev)
> {
> if (kernelmode)
> acerhdf_change_fanstate(ACERHDF_FAN_AUTO);
> @@ -446,7 +446,7 @@ static int acerhdf_suspend(struct platform_device
> *dev, pm_message_t state)
> return 0;
> }
>
> -static int acerhdf_resume(struct platform_device *device)
> +static int acerhdf_resume(struct device *dev)
> {
> if (verbose)
> pr_notice("resuming\n");
> @@ -464,15 +464,21 @@ static int acerhdf_remove(struct platform_device *device)
> return 0;
> }
>
> +static struct dev_pm_ops acerhdf_pm_ops = {
> + .suspend = acerhdf_suspend,
> + .resume = acerhdf_resume,
> + .freeze = acerhdf_suspend,
> + .thaw = acerhdf_resume,
> +};
> +

Hmm, looking at the driver I think the only function that actually is
needed is poweroff() that would turn the fan in automatic mode before
shutting down. The driver does not perform any actions when resuming so
why bother?

BTW, I wasn't entirely correct, for S2D if you need freeze() and thaw()
you also need restore() because that's the one that is called after
restoring hibernation image.

--
Dmitry


\
 
 \ /
  Last update: 2009-07-27 17:59    [W:0.096 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site