mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ACPI: AC: use DEFINE_SIMPLE_DEV_PM_OPS
@ 2026-08-20  3:12 Triet Hoang
  2026-09-09 14:44 ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 3+ messages in thread
From: Triet Hoang @ 2026-08-20  3:12 UTC (permalink / raw)
  To: rafael; +Cc: lenb, linux-acpi, linux-kernel, triet.hoang.dev

Convert the deprecated SIMPLE_DEV_PM_OPS
to DEFINE_SIMPLE_DEV_PM_OPS

Also use pm_sleep_ptr() when assigning the ops to the driver.
This allows the removal of the ifdef CONFIG_PM_SLEEP.

Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
 drivers/acpi/ac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index f19d6dd43473..eef0c8e32d73 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -239,7 +239,6 @@ static int acpi_ac_probe(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int acpi_ac_resume(struct device *dev)
 {
 	struct acpi_ac *ac = dev_get_drvdata(dev);
@@ -253,9 +252,8 @@ static int acpi_ac_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
 
 static void acpi_ac_remove(struct platform_device *pdev)
 {
@@ -270,7 +268,7 @@ static struct platform_driver acpi_ac_driver = {
 	.driver = {
 		.name = "ac",
 		.acpi_match_table = ac_device_ids,
-		.pm = &acpi_ac_pm,
+		.pm = pm_sleep_ptr(&acpi_ac_pm),
 	},
 };
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: AC: use DEFINE_SIMPLE_DEV_PM_OPS
  2026-08-20  3:12 [PATCH] ACPI: AC: use DEFINE_SIMPLE_DEV_PM_OPS Triet Hoang
@ 2026-09-09 14:44 ` Rafael J. Wysocki (Intel)
  2026-09-09 14:57   ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-09-09 14:44 UTC (permalink / raw)
  To: Triet Hoang; +Cc: linux-acpi, linux-kernel

On Thu, Aug 20, 2026 at 5:12 AM Triet Hoang <triet.hoang.dev@gmail.com> wrote:
>
> Convert the deprecated SIMPLE_DEV_PM_OPS
> to DEFINE_SIMPLE_DEV_PM_OPS
>
> Also use pm_sleep_ptr() when assigning the ops to the driver.
> This allows the removal of the ifdef CONFIG_PM_SLEEP.
>
> Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
> ---
>  drivers/acpi/ac.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
> index f19d6dd43473..eef0c8e32d73 100644
> --- a/drivers/acpi/ac.c
> +++ b/drivers/acpi/ac.c
> @@ -239,7 +239,6 @@ static int acpi_ac_probe(struct platform_device *pdev)
>         return 0;
>  }
>
> -#ifdef CONFIG_PM_SLEEP
>  static int acpi_ac_resume(struct device *dev)
>  {
>         struct acpi_ac *ac = dev_get_drvdata(dev);
> @@ -253,9 +252,8 @@ static int acpi_ac_resume(struct device *dev)
>
>         return 0;
>  }
> -#endif

And the function above is going to be unused when CONFIG_PM_SLEEP is
unset, causing the compiler to complain AFAICS.

> -static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
>
>  static void acpi_ac_remove(struct platform_device *pdev)
>  {
> @@ -270,7 +268,7 @@ static struct platform_driver acpi_ac_driver = {
>         .driver = {
>                 .name = "ac",
>                 .acpi_match_table = ac_device_ids,
> -               .pm = &acpi_ac_pm,
> +               .pm = pm_sleep_ptr(&acpi_ac_pm),
>         },
>  };
>
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: AC: use DEFINE_SIMPLE_DEV_PM_OPS
  2026-09-09 14:44 ` Rafael J. Wysocki (Intel)
@ 2026-09-09 14:57   ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-09-09 14:57 UTC (permalink / raw)
  To: Triet Hoang; +Cc: linux-acpi, linux-kernel

On Wed, Sep 9, 2026 at 4:44 PM Rafael J. Wysocki (Intel)
<rafael@kernel.org> wrote:
>
> On Thu, Aug 20, 2026 at 5:12 AM Triet Hoang <triet.hoang.dev@gmail.com> wrote:
> >
> > Convert the deprecated SIMPLE_DEV_PM_OPS
> > to DEFINE_SIMPLE_DEV_PM_OPS
> >
> > Also use pm_sleep_ptr() when assigning the ops to the driver.
> > This allows the removal of the ifdef CONFIG_PM_SLEEP.
> >
> > Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
> > ---
> >  drivers/acpi/ac.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
> > index f19d6dd43473..eef0c8e32d73 100644
> > --- a/drivers/acpi/ac.c
> > +++ b/drivers/acpi/ac.c
> > @@ -239,7 +239,6 @@ static int acpi_ac_probe(struct platform_device *pdev)
> >         return 0;
> >  }
> >
> > -#ifdef CONFIG_PM_SLEEP
> >  static int acpi_ac_resume(struct device *dev)
> >  {
> >         struct acpi_ac *ac = dev_get_drvdata(dev);
> > @@ -253,9 +252,8 @@ static int acpi_ac_resume(struct device *dev)
> >
> >         return 0;
> >  }
> > -#endif
>
> And the function above is going to be unused when CONFIG_PM_SLEEP is
> unset, causing the compiler to complain AFAICS.

Scratch this, but you should mention in the changelog that the file is
going to contain dead code for CONFIG_PM_SLEEP after this change.

And I'm not really sure if I like that.

> > -static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
> > +static DEFINE_SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
> >
> >  static void acpi_ac_remove(struct platform_device *pdev)
> >  {
> > @@ -270,7 +268,7 @@ static struct platform_driver acpi_ac_driver = {
> >         .driver = {
> >                 .name = "ac",
> >                 .acpi_match_table = ac_device_ids,
> > -               .pm = &acpi_ac_pm,
> > +               .pm = pm_sleep_ptr(&acpi_ac_pm),
> >         },
> >  };
> >
> > --
> > 2.53.0
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-09 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-20  3:12 [PATCH] ACPI: AC: use DEFINE_SIMPLE_DEV_PM_OPS Triet Hoang
2026-09-09 14:44 ` Rafael J. Wysocki (Intel)
2026-09-09 14:57   ` Rafael J. Wysocki (Intel)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®