Skip to contentSkip to conversation

ACPI: AC: use DEFINE_SIMPLE_DEV_PM_OPS

PATCH In review Triet Hoang 2 participants 3 messages Aug 20 – Sep 9 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: AC: use DEFINE_SIMPLE_DEV_PM_OPS

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.

---
 drivers/acpi/ac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/acpi/ac.c +2 -4
index f19d6dd43473..eef0c8e32d73 100644
@@ -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),
 	},
 };
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 25 lines · Triet Hoang

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.

---
 drivers/acpi/ac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/acpi/ac.c +0 -1
index f19d6dd43473..eef0c8e32d73 100644
@@ -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);

drivers/acpi/ac.c static int acpi_ac_resume(struct device *dev) · line 256

Quoted 4 lines
drivers/acpi/ac.c +0 -1
@@ -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.

Quoted 17 lines
drivers/acpi/ac.c +2 -3
-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

#2 lore raw
Quoted 28 lines · Rafael J. Wysocki (Intel)
Quoted 26 lines · Triet Hoang

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.

---
 drivers/acpi/ac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/acpi/ac.c +0 -1
index f19d6dd43473..eef0c8e32d73 100644
@@ -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)
 
Quoted 6 lines

drivers/acpi/ac.c static int acpi_ac_resume(struct device *dev) · line 256

Quoted 3 lines
drivers/acpi/ac.c +0 -1
        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.

Quoted 17 lines
Quoted 17 lines
drivers/acpi/ac.c +2 -3
-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