mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: dell-wmi-base: Fix the data pointer for event sequences
@ 2026-11-14  6:22 Rosen Penev
  0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2026-11-14  6:22 UTC (permalink / raw)
  To: Matthew Garrett, Pali Rohár, Hans de Goede,
	Ilpo Järvinen, Troy Rollo
  Cc: platform-driver-x86, linux-kernel

dell_wmi_process_key() expects its buffer argument to point at the
data that follows the event code. The 0x0000 and 0x0012 callers pass
buffer_entry + 3 for a code at buffer_entry[2], and commit
392c19faec6b ("platform/x86: dell-wmi-base: Fix handling of ultra performance key")
relies on this. The remaining count passed for event sequences
(len - i - 1) also counts from the word after the code.

For sequences of type 0x0010 and 0x0011, however, buffer_entry + i is
passed, which points at the code itself. The tablet mode switch event
(type 0x0011, code 0xe070) then reports !0xe070, so SW_TABLET_MODE is
always 0 and tablet mode is never reported.

Pass the word after the code.

Fixes: 5fbd827eb9c2 ("platform/x86: dell-wmi: Recognise or support new switches")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
Developed with the help of an AI coding assistant (Claude Opus 5.5),
which found the issue and drafted the fix; I reviewed it and am
responsible for it. Builds cleanly with W=1.
Not runtime tested: the M4800 does not send the tablet mode event.

 drivers/platform/x86/dell/dell-wmi-base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-base.c b/drivers/platform/x86/dell/dell-wmi-base.c
index 44857e99fdfe..c778409ca099 100644
--- a/drivers/platform/x86/dell/dell-wmi-base.c
+++ b/drivers/platform/x86/dell/dell-wmi-base.c
@@ -523,7 +523,7 @@ static void dell_wmi_notify(struct wmi_device *wdev, const struct wmi_buffer *bu
 			for (i = 2; i < len; ++i)
 				i += dell_wmi_process_key(wdev, le16_to_cpu(buffer_entry[1]),
 							  le16_to_cpu(buffer_entry[i]),
-							  buffer_entry + i,
+							  buffer_entry + i + 1,
 							  len - i - 1);
 			break;
 		case 0x0012:

base-commit: 2800868f63227c8237d70c41e70d441c919620d6
-- 
2.56.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-14  6:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-14  6:22 [PATCH] platform/x86: dell-wmi-base: Fix the data pointer for event sequences Rosen Penev

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®