Skip to contentSkip to conversation

ACPI: SBS: use DEFINE_SIMPLE_DEV_PM_OPS

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: SBS: 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/sbs.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/acpi/sbs.c +2 -6
index 86b7c7975852..543ca5f0defa 100644
@@ -692,17 +692,13 @@ static void acpi_sbs_remove(struct platform_device *pdev)
 	kfree(sbs);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int acpi_sbs_resume(struct device *dev)
 {
 	acpi_sbs_callback(dev_get_drvdata(dev));
 	return 0;
 }
-#else
-#define acpi_sbs_resume NULL
-#endif
 
-static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
 
 static struct platform_driver acpi_sbs_driver = {
 	.probe = acpi_sbs_probe,
@@ -710,7 +706,7 @@ static struct platform_driver acpi_sbs_driver = {
 	.driver = {
 		.name = "acpi-sbs",
 		.acpi_match_table = sbs_device_ids,
-		.pm = &acpi_sbs_pm,
+		.pm = pm_sleep_ptr(&acpi_sbs_pm),
 	},
 };
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 19 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/sbs.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/acpi/sbs.c +0 -0
index 86b7c7975852..543ca5f0defa 100644
@@ -692,17 +692,13 @@ static void acpi_sbs_remove(struct platform_device *pdev)
        kfree(sbs);
 }

drivers/acpi/sbs.c static void acpi_sbs_remove(struct platform_device *pdev) · line 703

Quoted 10 lines
drivers/acpi/sbs.c +0 -4
 
-#ifdef CONFIG_PM_SLEEP
 static int acpi_sbs_resume(struct device *dev)
 {
        acpi_sbs_callback(dev_get_drvdata(dev));
        return 0;
 }
-#else
-#define acpi_sbs_resume NULL
-#endif

So the function above is going to be unused when CONFIG_PM_SLEEP is unset if I'm not mistaken.

Is this really an improvement?

Quoted 17 lines
drivers/acpi/sbs.c +2 -3
-static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
 
 static struct platform_driver acpi_sbs_driver = {
        .probe = acpi_sbs_probe,
@@ -710,7 +706,7 @@ static struct platform_driver acpi_sbs_driver = {
        .driver = {
                .name = "acpi-sbs",
                .acpi_match_table = sbs_device_ids,
-               .pm = &acpi_sbs_pm,
+               .pm = pm_sleep_ptr(&acpi_sbs_pm),
        },
 };
 
--

2.53.0