mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: "Matthew Garrett" <mjg59@srcf.ucam.org>,
	"Pali Rohár" <pali@kernel.org>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Troy Rollo" <linux2021@troy.rollo.name>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] platform/x86: dell-wmi-base: Fix the data pointer for event sequences
Date: Fri, 13 Nov 2026 22:22:19 -0800	[thread overview]
Message-ID: <5fa10b9dbe351074e61493c0ba3344ba6106137a.1794633180.git.rosenp@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-14  6:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5fa10b9dbe351074e61493c0ba3344ba6106137a.1794633180.git.rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux2021@troy.rollo.name \
    --cc=mjg59@srcf.ucam.org \
    --cc=pali@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®