Re: [PATCH] power: supply: olpc_battery: remove unnecessary CONFIG_PM_SLEEP

From: Hans de Goede
Date: Thu Oct 29 2020 - 06:04:45 EST


Hi,

On 10/29/20 8:41 AM, Coiby Xu wrote:
> SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

No it does not, when CONFIG_PM_SLEEP is not set then the
SET_SYSTEM_SLEEP_PM_OPS macro which SIMPLE_DEV_PM_OPS uses
is a no-op, so nothing will reference xo15_sci_resume leading to
a compiler warning when CONFIG_PM_SLEEP is not set.

You could drop the ifdef and add __maybe_unused to the definition
of xo15_sci_resume, but that feels like needless churn, best to
just keep this as is IMHO.

Also s/CONFIG_PM_CONFIG/CONFIG_PM_SLEEP/ in the commit message.

Regards,

Hans


>
> Signed-off-by: Coiby Xu <coiby.xu@xxxxxxxxx>
> ---
> arch/x86/platform/olpc/olpc-xo15-sci.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
> index 85f4638764d6..716eefd735a4 100644
> --- a/arch/x86/platform/olpc/olpc-xo15-sci.c
> +++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
> @@ -192,7 +192,6 @@ static int xo15_sci_remove(struct acpi_device *device)
> return 0;
> }
>
> -#ifdef CONFIG_PM_SLEEP
> static int xo15_sci_resume(struct device *dev)
> {
> /* Enable all EC events */
> @@ -204,7 +203,6 @@ static int xo15_sci_resume(struct device *dev)
>
> return 0;
> }
> -#endif
>
> static SIMPLE_DEV_PM_OPS(xo15_sci_pm, NULL, xo15_sci_resume);
>
>