ACPI: button: Call device_init_wakeup() earlier during probe
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 8 Feb 2026 14:13:26 +0000 (15:13 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 11 Feb 2026 20:23:32 +0000 (21:23 +0100)
commite91f8c5305b92b63c8bac315f95c535d5c1e8fec
tree6f9d22bee79742f2518e429a3e86cfac2b280197
parentd84e173311c4f0b0300755e6445f3224d252eeed
ACPI: button: Call device_init_wakeup() earlier during probe

Calling device_init_wakeup() after installing a notify handler in which
wakeup events are signaled may cause a wakeup event to be missed if the
device is probed right before a system suspend.

To avoid this, move the device_init_wakeup() call in acpi_button_probe()
before the notify handler installation and add a corresponding cleanup
to the error path.

Also carry out wakeup cleanup for the button in acpi_button_remove()
because after that point the notify handler will not run for it and
wakeup events coming from it will not be signaled.

Fixes: 0d51157dfaac ("ACPI: button: Eliminate the driver notify callback")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/12854922.O9o76ZdvQC@rafael.j.wysocki
drivers/acpi/button.c