mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: dell-wmi-aio: Use named defines for event types
@ 2026-09-22 19:38 Armin Wolf
  2026-10-05 18:25 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Armin Wolf @ 2026-09-22 19:38 UTC (permalink / raw)
  To: hansg, ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel

There exist two types of events recognized by this driver:
single hotkey events (0x0000) and sequences of hotkey events (0x000F).
Until now both literals are used without a named define, making it
harder to understand their meaning.

Fix this by using named defines for both event types.

Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/dell/dell-wmi-aio.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-aio.c b/drivers/platform/x86/dell/dell-wmi-aio.c
index 8849ad93480b..42c0032991d2 100644
--- a/drivers/platform/x86/dell/dell-wmi-aio.c
+++ b/drivers/platform/x86/dell/dell-wmi-aio.c
@@ -32,10 +32,13 @@ struct dell_wmi_aio_data {
 	struct mutex input_lock;
 };
 
+/* A hot key was pressed or an event occurred */
+#define DELL_AIO_EVENT_TYPE_SINGLE	0x0000
+/* A sequence of hot keys was pressed */
+#define DELL_AIO_EVENT_TYPE_SEQUENCE	0x000F
+
 struct dell_wmi_event {
 	__le16	length;
-	/* 0x000: A hot key pressed or an event occurred
-	 * 0x00F: A sequence of hot keys are pressed */
 	__le16	type;
 	__le16	event[];
 } __packed;
@@ -68,10 +71,14 @@ static bool dell_wmi_aio_event_check(const struct wmi_buffer *buffer)
 	event = buffer->data;
 	length = le16_to_cpu(event->length);
 	type = le16_to_cpu(event->type);
-	if ((type == 0 || type == 0xf) && length >= 2)
-		return true;
 
-	return false;
+	if (type != DELL_AIO_EVENT_TYPE_SINGLE && type != DELL_AIO_EVENT_TYPE_SEQUENCE)
+		return false;
+
+	if (length < 2)
+		return false;
+
+	return true;
 }
 
 static void dell_wmi_aio_notify(struct wmi_device *wdev, const struct wmi_buffer *data)
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-05 18:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 19:38 [PATCH] platform/x86: dell-wmi-aio: Use named defines for event types Armin Wolf
2026-10-05 18:25 ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®