* [PATCH] ACPI: button: use DEFINE_SIMPLE_DEV_PM_OPS
@ 2026-08-20 3:36 Triet Hoang
0 siblings, 0 replies; only message in thread
From: Triet Hoang @ 2026-08-20 3:36 UTC (permalink / raw)
To: rafael; +Cc: lenb, linux-acpi, linux-kernel, 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
and unnecessary forward declarations of 4 functions.
No intentional functional impact.
Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
drivers/acpi/button.c | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 3836ee75dd66..d4cb942b754f 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -147,28 +147,6 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
{}
};
-static int acpi_button_probe(struct platform_device *pdev);
-static void acpi_button_remove(struct platform_device *pdev);
-
-#ifdef CONFIG_PM_SLEEP
-static int acpi_button_suspend(struct device *dev);
-static int acpi_button_resume(struct device *dev);
-#else
-#define acpi_button_suspend NULL
-#define acpi_button_resume NULL
-#endif
-static SIMPLE_DEV_PM_OPS(acpi_button_pm, acpi_button_suspend, acpi_button_resume);
-
-static struct platform_driver acpi_button_driver = {
- .probe = acpi_button_probe,
- .remove = acpi_button_remove,
- .driver = {
- .name = "acpi-button",
- .acpi_match_table = button_device_ids,
- .pm = &acpi_button_pm,
- },
-};
-
struct acpi_button {
struct acpi_device *adev;
struct device *dev; /* physical button device */
@@ -491,7 +469,6 @@ static u32 acpi_button_event(void *data)
return ACPI_INTERRUPT_HANDLED;
}
-#ifdef CONFIG_PM_SLEEP
static int acpi_button_suspend(struct device *dev)
{
struct acpi_button *button = dev_get_drvdata(dev);
@@ -521,7 +498,6 @@ static int acpi_button_resume(struct device *dev)
}
return 0;
}
-#endif
static int acpi_lid_input_open(struct input_dev *input)
{
@@ -753,6 +729,18 @@ static void acpi_button_remove(struct platform_device *pdev)
acpi_lid_forget(button->adev);
}
+static DEFINE_SIMPLE_DEV_PM_OPS(acpi_button_pm, acpi_button_suspend, acpi_button_resume);
+
+static struct platform_driver acpi_button_driver = {
+ .probe = acpi_button_probe,
+ .remove = acpi_button_remove,
+ .driver = {
+ .name = "acpi-button",
+ .acpi_match_table = button_device_ids,
+ .pm = pm_sleep_ptr(&acpi_button_pm),
+ },
+};
+
static int param_set_lid_init_state(const char *val,
const struct kernel_param *kp)
{
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-20 3:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 3:36 [PATCH] ACPI: button: use DEFINE_SIMPLE_DEV_PM_OPS Triet Hoang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox