Skip to content

Commit a56fdd8

Browse files
t-8chrafaeljw
authored andcommitted
ACPI: battery: use DEFINE_SIMPLE_DEV_PM_OPS
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>
1 parent 0710c1c commit a56fdd8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/acpi/battery.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,6 @@ static void acpi_battery_remove(struct acpi_device *device)
12771277
sysfs_remove_battery(battery);
12781278
}
12791279

1280-
#ifdef CONFIG_PM_SLEEP
12811280
/* this is needed to learn about changes made in suspended state */
12821281
static int acpi_battery_resume(struct device *dev)
12831282
{
@@ -1294,11 +1293,8 @@ static int acpi_battery_resume(struct device *dev)
12941293
acpi_battery_update(battery, true);
12951294
return 0;
12961295
}
1297-
#else
1298-
#define acpi_battery_resume NULL
1299-
#endif
13001296

1301-
static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
1297+
static DEFINE_SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
13021298

13031299
static struct acpi_driver acpi_battery_driver = {
13041300
.name = "battery",
@@ -1308,7 +1304,7 @@ static struct acpi_driver acpi_battery_driver = {
13081304
.add = acpi_battery_add,
13091305
.remove = acpi_battery_remove,
13101306
},
1311-
.drv.pm = &acpi_battery_pm,
1307+
.drv.pm = pm_sleep_ptr(&acpi_battery_pm),
13121308
.drv.probe_type = PROBE_PREFER_ASYNCHRONOUS,
13131309
};
13141310

0 commit comments

Comments
 (0)