diff mbox series

[2/4] platform/x86: wmi: Return immediately if an suitable WMI event is found

Message ID 20240103192707.115512-3-W_Armin@gmx.de (mailing list archive)
State Accepted, archived
Headers show
Series platform/x86: wmi: Event handling fixes | expand

Commit Message

Armin Wolf Jan. 3, 2024, 7:27 p.m. UTC
Commit 58f6425eb92f ("WMI: Cater for multiple events with same GUID")
allowed legacy WMI notify handlers to be installed for multiple WMI
devices with the same GUID.
However this is useless since the legacy GUID-based interface is
blacklisted from seeing WMI devices with duplicated GUIDs.

Return immediately if a suitable WMI event is found in
wmi_install/remove_notify_handler() since searching for other suitable
events is pointless.

Tested on a Dell Inspiron 3505 and a Acer Aspire E1-731.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/wmi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--
2.39.2

Comments

Ilpo Järvinen Jan. 4, 2024, 6:13 p.m. UTC | #1
On Wed, 3 Jan 2024, Armin Wolf wrote:

> Commit 58f6425eb92f ("WMI: Cater for multiple events with same GUID")
> allowed legacy WMI notify handlers to be installed for multiple WMI
> devices with the same GUID.
> However this is useless since the legacy GUID-based interface is
> blacklisted from seeing WMI devices with duplicated GUIDs.
> 
> Return immediately if a suitable WMI event is found in
> wmi_install/remove_notify_handler() since searching for other suitable
> events is pointless.
> 
> Tested on a Dell Inspiron 3505 and a Acer Aspire E1-731.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 3899a5e3fca7..7470a149b254 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -572,7 +572,6 @@  acpi_status wmi_install_notify_handler(const char *guid,
 				       void *data)
 {
 	struct wmi_block *block;
-	acpi_status status = AE_NOT_EXIST;
 	guid_t guid_input;

 	if (!guid || !handler)
@@ -595,11 +594,11 @@  acpi_status wmi_install_notify_handler(const char *guid,
 			if (ACPI_FAILURE(wmi_status))
 				dev_warn(&block->dev.dev, "Failed to enable device\n");

-			status = AE_OK;
+			return AE_OK;
 		}
 	}

-	return status;
+	return AE_NOT_EXIST;
 }
 EXPORT_SYMBOL_GPL(wmi_install_notify_handler);

@@ -614,7 +613,6 @@  EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
 acpi_status wmi_remove_notify_handler(const char *guid)
 {
 	struct wmi_block *block;
-	acpi_status status = AE_NOT_EXIST;
 	guid_t guid_input;

 	if (!guid)
@@ -637,11 +635,11 @@  acpi_status wmi_remove_notify_handler(const char *guid)
 			block->handler = NULL;
 			block->handler_data = NULL;

-			status = AE_OK;
+			return AE_OK;
 		}
 	}

-	return status;
+	return AE_NOT_EXIST;
 }
 EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);