ACPI: button: Fixes related to GPE handling and probe error path
Subsystems (2)
Rafael J. Wysocki
maintainerv2 cover ACPI: button: Fixes related to GPE handling and probe error path
Hi All,
This is an update of
https://lore.kernel.org/linux-acpi/[email protected]/
sent to address sashiko.dev feedback on patch [2/3]:
Quoted 7 lines
Quoted 7 lines
(quoted diff) +0
-0@@ -106,8 +109,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device,u32
gpe_number)> >(quoted diff) +0
-0*/ gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (gpe_event_info) {
Quoted 11 lines
Quoted 4 lines
(quoted diff) +1
-2- if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) != - ACPI_GPE_DISPATCH_NONE) { + if (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags) & dispatch_type_mask){
Does this incorrectly treat sequential enumeration values as bit flags?
ACPI_GPE_DISPATCH_METHODis defined as 1, andACPI_GPE_DISPATCH_NOTIFYis 3. Sincedispatch_type_maskis passed asACPI_GPE_DISPATCH_METHOD(1) fromacpi_button_probe(), this bitwise AND evaluates to true for both METHOD (1 & 1 == 1) and NOTIFY (3 & 1 == 1).
Could this unintentionally enable GPEs for NOTIFY handlers?
The original series description below still applies.
This series fix three issues related to the ACPI button driver, one introduced during the 6.15 development cycle, one from the 7.0 cycle, and one that has been there for a long time, but has been omitted by mistake by a recent commit.
Thanks!
Rafael J. Wysocki
maintainerPATCH v2 1/3 ACPI: button: Fix ACPI GPE handler leak during removal
From: Rafael J. Wysocki <[email protected]>
Commit a7e23ec17fee ("ACPI: button: Install notifier for system events as well") changed the ACPI notify handler type for ACPI buttons to ACPI_ALL_NOTIFY, but it forgot to update acpi_button_remove() to reflect that change. This leads to leaking the notify handler past driver removal, which may cause a kernel crash to occur if ACPI notify on the given device is triggered after removing the driver, and causes a subsequent probe of the given device with the same driver to fail.
Address this by updating the acpi_remove_notify_handler() call in acpi_button_remove() as appropriate.
---
v1 -> v2:
* Add R-by from Mario
* No other changes
--- drivers/acpi/button.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/button.c +1 -1
@@ -689,7 +689,7 @@ static void acpi_button_remove(struct pl acpi_button_event);break ;default : -acpi_remove_notify_handler (adev->handle,ACPI_DEVICE_NOTIFY , +acpi_remove_notify_handler (adev->handle,ACPI_ALL_NOTIFY , button->type ==ACPI_BUTTON_TYPE_LID ? acpi_lid_notify : acpi_button_notify);
Rafael J. Wysocki
maintainerPATCH v2 2/3 ACPI: button: Enable wakeup GPEs for ACPI buttons at probe time
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Prior to commit 57c31e6d620f ("ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons"), ACPI button wakeup GPEs having handler methods remained enabled after acpi_wakeup_gpe_init(), but currently they are not enabled because acpi_setup_gpe_for_wake() disables them.
That causes function keys to stop working on some systems [1] and there may be other related issues elsewhere.
To address that, make the ACPI button driver enable wakeup GPEs for ACPI buttons so long as they have handler methods. While this does not restore the old behavior exactly (the ACPI button driver needs to be bound to the button devices for the GPEs to be enabled), it should be sufficient to restore the missing functionality.
For this purpose, introduce acpi_enable_gpe_cond() that enables a GPE if its dispatch type matches the supplied one and modify acpi_button_probe() to use that function for enabling the GPEs in question.
---
v1 -> v2:
* Change the acpi_enable_gpe_cond() third parameter to a dispatch type (or "any type" value) and modify checks in it accordingly to address a problem pointed out by sashiko.dev
* Adjust comments in acpi_enable_gpe_cond() and acpi_enable_gpe()
* Update the changelog
@Nick, It would be good to test this version of the patch on your system because it is a bit different from the previous one (which was not entirely correct). I'm not expecting it to behave differently, but additional testing would be welcome.
Thanks!
--- drivers/acpi/acpica/evxfgpe.c | 50 ++++++++++++++++++++++++++++++++++-------- drivers/acpi/button.c | 22 ++++++++++++++++++ include/acpi/acpixf.h | 5 ++++ 3 files changed, 68 insertions(+), 9 deletions(-)
drivers/acpi/acpica/evxfgpe.c +41 -9
@@ -78,18 +78,22 @@ ACPI_EXPORT_SYMBOL(acpi_update_all_gpes)/******************************************************************************* * -* FUNCTION: acpi_enable_gpe +* FUNCTION: acpi_enable_gpe_cond * * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 * gpe_number - GPE level within the GPE block +* dispatch_type - GPE dispatch type to match * * RETURN: Status * -* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is -* hardware-enabled. +* DESCRIPTION: Add a reference to a GPE so long as its dispatch type matches +* the supplied one, or it is different from ACPI_GPE_DISPATCH_NONE +* if the supplied one is ACPI_GPE_DISPATCH_MASK. On the first +* reference, the GPE is hardware-enabled. * ******************************************************************************/ -acpi_status acpi_enable_gpe (acpi_handle gpe_device,u32 gpe_number) +acpi_status acpi_enable_gpe_cond (acpi_handle gpe_device,u32 gpe_number, +u8 dispatch_type) {acpi_status status =AE_BAD_PARAMETER ;struct acpi_gpe_event_info *gpe_event_info;
@@ -100,14 +104,18 @@ acpi_status acpi_enable_gpe(acpi_handle flags =acpi_os_acquire_lock (acpi_gbl_gpe_lock);/* -* Ensure that we have a valid GPE number and that there is some way -* of handling the GPE (handler or a GPE method). In other words, we -* won't allow a valid GPE to be enabled if there is no way to handle it. +* Ensure that we have a valid GPE number and that the dispatch type of +* the GPE matches the supplied one (or it is not ACPI_GPE_DISPATCH_NONE +* if the supplied one is ACPI_GPE_DISPATCH_MASK). */ gpe_event_info =acpi_ev_get_gpe_event_info (gpe_device, gpe_number);if (gpe_event_info) { -if (ACPI_GPE_DISPATCH_TYPE (gpe_event_info->flags) != -ACPI_GPE_DISPATCH_NONE ) { +if (dispatch_type ==ACPI_GPE_DISPATCH_MASK ) + dispatch_type =ACPI_GPE_DISPATCH_TYPE (gpe_event_info->flags); +else if (dispatch_type !=ACPI_GPE_DISPATCH_TYPE (gpe_event_info->flags)) + dispatch_type =ACPI_GPE_DISPATCH_NONE ; + +if (dispatch_type !=ACPI_GPE_DISPATCH_NONE ) { status =acpi_ev_add_gpe_reference (gpe_event_info, TRUE);if (ACPI_SUCCESS (status) &&ACPI_GPE_IS_POLLING_NEEDED (gpe_event_info)) {
@@ -128,6 +136,30 @@ acpi_status acpi_enable_gpe(acpi_handleacpi_os_release_lock (acpi_gbl_gpe_lock, flags);return_ACPI_STATUS (status); } +ACPI_EXPORT_SYMBOL (acpi_enable_gpe_cond) + +/******************************************************************************* +* +* FUNCTION: acpi_enable_gpe +* +* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 +* gpe_number - GPE level within the GPE block +* +* RETURN: Status +* +* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is +* hardware-enabled. +* +******************************************************************************/ +acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) +{ +/* +* Ensure that there is some way of handling the GPE (handler or a GPE +* method). In other words, we won't allow a valid GPE to be enabled if +* there is no way to handle it. +*/ +return acpi_enable_gpe_cond (gpe_device, gpe_number,ACPI_GPE_DISPATCH_MASK ); +}ACPI_EXPORT_SYMBOL (acpi_enable_gpe)/*******************************************************************************
drivers/acpi/button.c +22 -0
@@ -179,6 +179,7 @@ struct acpi_button {ktime_t last_time;bool suspended;bool lid_state_initialized; +bool gpe_enabled; };static struct acpi_device *lid_device;
@@ -646,6 +647,21 @@ static int acpi_button_probe(struct plat status =acpi_install_notify_handler (device->handle,ACPI_ALL_NOTIFY , handler, button); +if (ACPI_SUCCESS (status) && device->wakeup.flags.valid) { +acpi_status st; + +/* +* If the wakeup GPE has a handler method, enable it in +* case it is also used for signaling runtime events. +*/ + st =acpi_enable_gpe_cond (device->wakeup.gpe_device, + device->wakeup.gpe_number, +ACPI_GPE_DISPATCH_METHOD ); + button->gpe_enabled =ACPI_SUCCESS (st); +if (button->gpe_enabled) +dev_dbg (button->dev,"Enabled ACPI GPE%02llx\n" , + device->wakeup.gpe_number); + }break ; }if (ACPI_FAILURE (status)) {
@@ -689,6 +705,12 @@ static void acpi_button_remove(struct pl acpi_button_event);break ;default : +if (button->gpe_enabled) { +dev_dbg (button->dev,"Disabling ACPI GPE%02llx\n" , + adev->wakeup.gpe_number); +acpi_disable_gpe (adev->wakeup.gpe_device, + adev->wakeup.gpe_number); + } acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY, button->type == ACPI_BUTTON_TYPE_LID ? acpi_lid_notify :
include/acpi/acpixf.h +5 -0
@@ -726,6 +726,11 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_sta ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_update_all_gpes(void)) ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status + acpi_enable_gpe_cond(acpi_handle gpe_device, + u32 gpe_number, + u8 dispatch_type)) + +ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number))
Re: [PATCH v2 2/3] ACPI: button: Enable wakeup GPEs for ACPI buttons at probe time
Quoted 35 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Prior to commit
57c31e6d620f("ACPI: scan: Useacpi_setup_gpe_for_wake()for buttons"), ACPI button wakeup GPEs having handler methods remained enabled afteracpi_wakeup_gpe_init(), but currently they are not enabled becauseacpi_setup_gpe_for_wake()disables them.That causes function keys to stop working on some systems [1] and there may be other related issues elsewhere.
To address that, make the ACPI button driver enable wakeup GPEs for ACPI buttons so long as they have handler methods. While this does not restore the old behavior exactly (the ACPI button driver needs to be bound to the button devices for the GPEs to be enabled), it should be sufficient to restore the missing functionality.
For this purpose, introduce
acpi_enable_gpe_cond()that enables a GPE if its dispatch type matches the supplied one and modifyacpi_button_probe()to use that function for enabling the GPEs in question.Fixes 57c31e6d620f ("ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons")Reported-by Nick <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>Cc 7.0+ <[email protected]> # 7.0+---
v1 -> v2:
* Change theacpi_enable_gpe_cond()third parameter to a dispatch type (or "any type" value) and modify checks in it accordingly to address a problem pointed out by sashiko.dev
* Adjust comments inacpi_enable_gpe_cond()andacpi_enable_gpe()
* Update the changelog
Quoted 5 lines
@Nick, It would be good to test this version of the patch on your system because it is a bit different from the previous one (which was not entirely correct). I'm not expecting it to behave differently, but additional testing would be welcome.
I tested this on top of 45255ea1ca096. The keys are still working as expected! I compared it against 6.19.14 too and all the keys seem to behave as before.
I noticed one difference, but it might not be directly related: KEY_SLEEP takes significantly longer to trigger suspend on 7.1-rc4 than on 6.19.14. On the older version it suspends in about a second; on 7.1-rc4 it takes about a minute before it fully suspends. The lid switch on the other hand suspends in about a second, and so does the suspend button in my DE, on both versions. I guess they're doing different kinds of suspend. That's probably related to the other ACPI changes that landed in 7.0.
Here's a log of me pressing the keys again: (we don't see KEY_SUSPEND here because it triggers hiberation which I don't have set up so it just shuts down and I lose the log)
(Apologies if you got this twice, I managed to reset.my mail client to HTML defaults while testing somehow)
$ uname -r 6.19.14-arch1-1 $ sudo libinput debug-events --show-keycodes -event2 DEVICE_ADDED Power Button seat0 default group1 cap:k -event4 DEVICE_ADDED Video Bus seat0 default group2 cap:k -event1 DEVICE_ADDED Power Button seat0 default group3 cap:k -event0 DEVICE_ADDED Lid Switch seat0 default group4 cap:S -event5 DEVICE_ADDED Toshiba input device seat0 default group5 cap:k -event12 DEVICE_ADDED Synaptics TM3322-002 seat0 default group6 cap:pg size 95x53mm tap (dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on -event3 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group7 cap:k -event5 KEYBOARD_KEY +0.000s KEY_MUTE (113) pressed event5 KEYBOARD_KEY +0.000s KEY_MUTE (113) released event5 KEYBOARD_KEY +1.054s KEY_MUTE (113) pressed event5 KEYBOARD_KEY +1.054s KEY_MUTE (113) released event5 KEYBOARD_KEY +2.979s KEY_COFFEE (152) pressed event5 KEYBOARD_KEY +2.979s KEY_COFFEE (152) released event5 KEYBOARD_KEY +3.810s KEY_COFFEE (152) pressed event5 KEYBOARD_KEY +3.810s KEY_COFFEE (152) released event5 KEYBOARD_KEY +5.552s KEY_BATTERY (236) pressed event5 KEYBOARD_KEY +5.552s KEY_BATTERY (236) released event5 KEYBOARD_KEY +6.180s KEY_BATTERY (236) pressed event5 KEYBOARD_KEY +6.180s KEY_BATTERY (236) released event5 KEYBOARD_KEY +7.964s KEY_SLEEP (142) pressed event5 KEYBOARD_KEY +7.964s KEY_SLEEP (142) released event5 KEYBOARD_KEY +10.545s KEY_UNKNOWN (240) pressed event5 KEYBOARD_KEY +10.545s KEY_UNKNOWN (240) released -event1 KEYBOARD_KEY +10.598s KEY_WAKEUP (143) pressed event1 KEYBOARD_KEY +10.598s KEY_WAKEUP (143) released -event2 KEYBOARD_KEY +10.600s KEY_WAKEUP (143) pressed event2 KEYBOARD_KEY +10.600s KEY_WAKEUP (143) released -event5 KEYBOARD_KEY +20.312s KEY_SWITCHVIDEOMODE (227) pressed event5 KEYBOARD_KEY +20.312s KEY_SWITCHVIDEOMODE (227) released event5 KEYBOARD_KEY +20.981s KEY_SWITCHVIDEOMODE (227) pressed event5 KEYBOARD_KEY +20.981s KEY_SWITCHVIDEOMODE (227) released event5 KEYBOARD_KEY +21.467s KEY_BRIGHTNESSDOWN (224) pressed event5 KEYBOARD_KEY +21.467s KEY_BRIGHTNESSDOWN (224) released event5 KEYBOARD_KEY +22.034s KEY_BRIGHTNESSDOWN (224) pressed event5 KEYBOARD_KEY +22.034s KEY_BRIGHTNESSDOWN (224) released event5 KEYBOARD_KEY +22.420s KEY_BRIGHTNESSUP (225) pressed event5 KEYBOARD_KEY +22.420s KEY_BRIGHTNESSUP (225) released event5 KEYBOARD_KEY +22.845s KEY_BRIGHTNESSUP (225) pressed event5 KEYBOARD_KEY +22.845s KEY_BRIGHTNESSUP (225) released event5 KEYBOARD_KEY +23.757s KEY_WLAN (238) pressed event5 KEYBOARD_KEY +23.757s KEY_WLAN (238) released event5 KEYBOARD_KEY +24.953s KEY_WLAN (238) pressed event5 KEYBOARD_KEY +24.953s KEY_WLAN (238) released
$ uname -r 7.1.0-rc4-1-git-00393-g39551c4ef087 $ sudo libinput debug-events --show-keycodes -event5 DEVICE_ADDED Toshiba input device seat0 default group1 cap:k -event12 DEVICE_ADDED Synaptics TM3322-002 seat0 default group2 cap:pg size 95x53mm tap (dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on dwtp-on -event4 DEVICE_ADDED Video Bus seat0 default group3 cap:k -event2 DEVICE_ADDED Power Button seat0 default group4 cap:k -event1 DEVICE_ADDED Power Button seat0 default group5 cap:k -event0 DEVICE_ADDED Lid Switch seat0 default group6 cap:S -event3 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group7 cap:k event3 KEYBOARD_KEY +1.467s KEY_LEFTCTRL (29) pressed event3 KEYBOARD_KEY +1.469s KEY_LEFTMETA (125) pressed event3 KEYBOARD_KEY +1.470s KEY_F24 (194) pressed event3 KEYBOARD_KEY +1.608s KEY_F24 (194) released event3 KEYBOARD_KEY +1.611s KEY_LEFTMETA (125) released event3 KEYBOARD_KEY +1.612s KEY_LEFTCTRL (29) released -event5 KEYBOARD_KEY +4.041s KEY_WLAN (238) pressed event5 KEYBOARD_KEY +4.041s KEY_WLAN (238) released event5 KEYBOARD_KEY +7.001s KEY_BRIGHTNESSUP (225) pressed event5 KEYBOARD_KEY +7.001s KEY_BRIGHTNESSUP (225) released event5 KEYBOARD_KEY +7.568s KEY_BRIGHTNESSDOWN (224) pressed event5 KEYBOARD_KEY +7.568s KEY_BRIGHTNESSDOWN (224) released event5 KEYBOARD_KEY +12.350s KEY_SWITCHVIDEOMODE (227) pressed event5 KEYBOARD_KEY +12.350s KEY_SWITCHVIDEOMODE (227) released event5 KEYBOARD_KEY +13.726s KEY_SWITCHVIDEOMODE (227) pressed event5 KEYBOARD_KEY +13.726s KEY_SWITCHVIDEOMODE (227) released event5 KEYBOARD_KEY +19.846s KEY_SLEEP (142) pressed event5 KEYBOARD_KEY +19.846s KEY_SLEEP (142) released -event3 KEYBOARD_KEY +50.998s KEY_LEFTCTRL (29) pressed event3 KEYBOARD_KEY +51.140s KEY_LEFTCTRL (29) released -event5 KEYBOARD_KEY +96.713s KEY_UNKNOWN (240) pressed event5 KEYBOARD_KEY +96.716s KEY_UNKNOWN (240) released -event1 KEYBOARD_KEY +96.740s KEY_WAKEUP (143) pressed event1 KEYBOARD_KEY +96.740s KEY_WAKEUP (143) released -event2 KEYBOARD_KEY +96.743s KEY_WAKEUP (143) pressed event2 KEYBOARD_KEY +96.743s KEY_WAKEUP (143) released -event5 KEYBOARD_KEY +111.647s KEY_BATTERY (236) pressed event5 KEYBOARD_KEY +111.647s KEY_BATTERY (236) released event5 KEYBOARD_KEY +113.308s KEY_BATTERY (236) pressed event5 KEYBOARD_KEY +113.308s KEY_BATTERY (236) released event5 KEYBOARD_KEY +119.950s KEY_COFFEE (152) pressed event5 KEYBOARD_KEY +119.950s KEY_COFFEE (152) released event5 KEYBOARD_KEY +121.349s KEY_COFFEE (152) pressed event5 KEYBOARD_KEY +121.349s KEY_COFFEE (152) released event5 KEYBOARD_KEY +124.933s KEY_MUTE (113) pressed event5 KEYBOARD_KEY +124.933s KEY_MUTE (113) released event5 KEYBOARD_KEY +125.420s KEY_MUTE (113) pressed event5 KEYBOARD_KEY +125.420s KEY_MUTE (113) released -event0 SWITCH_TOGGLE +133.939s switch lid state 1 -event5 KEYBOARD_KEY +136.839s KEY_UNKNOWN (240) pressed event5 KEYBOARD_KEY +136.850s KEY_UNKNOWN (240) released -event0 SWITCH_TOGGLE +136.873s switch lid state 0 -event1 KEYBOARD_KEY +136.873s KEY_WAKEUP (143) pressed event1 KEYBOARD_KEY +136.873s KEY_WAKEUP (143) released -event2 KEYBOARD_KEY +136.874s KEY_WAKEUP (143) pressed event2 KEYBOARD_KEY +136.874s KEY_WAKEUP (143) released
Rafael J. Wysocki
maintainerRe: [PATCH v2 2/3] ACPI: button: Enable wakeup GPEs for ACPI buttons at probe time
Quoted 39 lines · Nick
Quoted 35 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Prior to commit
57c31e6d620f("ACPI: scan: Useacpi_setup_gpe_for_wake()for buttons"), ACPI button wakeup GPEs having handler methods remained enabled afteracpi_wakeup_gpe_init(), but currently they are not enabled becauseacpi_setup_gpe_for_wake()disables them.That causes function keys to stop working on some systems [1] and there may be other related issues elsewhere.
To address that, make the ACPI button driver enable wakeup GPEs for ACPI buttons so long as they have handler methods. While this does not restore the old behavior exactly (the ACPI button driver needs to be bound to the button devices for the GPEs to be enabled), it should be sufficient to restore the missing functionality.
For this purpose, introduce
acpi_enable_gpe_cond()that enables a GPE if its dispatch type matches the supplied one and modifyacpi_button_probe()to use that function for enabling the GPEs in question.Fixes 57c31e6d620f ("ACPI: scan: Use acpi_setup_gpe_for_wake() for buttons")Reported-by Nick <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>Cc 7.0+ <[email protected]> # 7.0+---
v1 -> v2:
* Change theacpi_enable_gpe_cond()third parameter to a dispatch type (or "any type" value) and modify checks in it accordingly to address a problem pointed out by sashiko.dev
* Adjust comments inacpi_enable_gpe_cond()andacpi_enable_gpe()
* Update the changelog
Quoted 8 lines
Quoted 5 lines
@Nick, It would be good to test this version of the patch on your system because it is a bit different from the previous one (which was not entirely correct). I'm not expecting it to behave differently, but additional testing would be welcome.
I tested this on top of
45255ea1ca096. The keys are still working as expected! I compared it against 6.19.14 too and all the keys seem to behave as before.
Thanks for the confirmation!
I'll add a Tested-by tag for you to the patch when applying it unless you don't want me to do that.
Quoted 4 lines
I noticed one difference, but it might not be directly related:
KEY_SLEEPtakes significantly longer to trigger suspend on 7.1-rc4 than on 6.19.14. On the older version it suspends in about a second; on 7.1-rc4 it takes about a minute before it fully suspends. The lid switch on the other hand suspends in about a second, and so does the suspend button in my DE, on both versions.
This is unlikely to be related to the issue addressed by the $subject patch.
Quoted 2 lines
I guess they're doing different kinds of suspend. That's probably related to the other ACPI changes that landed in 7.0.
One thing to take into consideration here is that the kernel doesn't trigger suspend by itself. The
key press event first goes to user space which then decides what to do with it and may (or may
not) trigger a system suspend in response. It may be doing different things for KEY_SLEEP and
the lid switch.
Rafael J. Wysocki
maintainerPATCH v2 3/3 ACPI: button: Add missing device class clearing on probe failures
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Commit e18947038bf4 ("ACPI: driver: Do not set acpi_device_class() unnecessarily") modified acpi_button_remove() to clear the device class field in struct acpi_device on driver removal, but it should also have updated the rollback path in acpi_button_probe(), which it didn't do, so do it now.
---
v1 -> v2:
* Add R-by from Mario
* No other changes
--- drivers/acpi/button.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/button.c +1 -0
@@ -687,6 +687,7 @@ err_remove_fs:acpi_button_remove_fs (button); err_free_button:kfree (button); +memset (acpi_device_class (device),0 ,sizeof (acpi_device_class));return error; }