]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: battery: use DEFINE_SIMPLE_DEV_PM_OPS
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 4 Sep 2024 07:12:55 +0000 (09:12 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 7 Oct 2024 16:45:18 +0000 (18:45 +0200)
Use the recommended macro to define the 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: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240904-acpi-battery-cleanups-v1-4-a3bf74f22d40@weissschuh.net
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/battery.c

index 940276d90dfc766dfcf3066b3aedca8781c394be..d4dc4d19a2fd892bdfb1a809efa2b611b68e3717 100644 (file)
@@ -1277,7 +1277,6 @@ static void acpi_battery_remove(struct acpi_device *device)
        sysfs_remove_battery(battery);
 }
 
-#ifdef CONFIG_PM_SLEEP
 /* this is needed to learn about changes made in suspended state */
 static int acpi_battery_resume(struct device *dev)
 {
@@ -1294,11 +1293,8 @@ static int acpi_battery_resume(struct device *dev)
        acpi_battery_update(battery, true);
        return 0;
 }
-#else
-#define acpi_battery_resume NULL
-#endif
 
-static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
 
 static struct acpi_driver acpi_battery_driver = {
        .name = "battery",
@@ -1308,7 +1304,7 @@ static struct acpi_driver acpi_battery_driver = {
                .add = acpi_battery_add,
                .remove = acpi_battery_remove,
                },
-       .drv.pm = &acpi_battery_pm,
+       .drv.pm = pm_sleep_ptr(&acpi_battery_pm),
        .drv.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 };