[PATCH] platform/x86: thinkpad_acpi: Sync initial switch states
From: Karlos Abel
Date: Tue Oct 13 2026 - 21:44:19 EST
hotkey_init() reports the initial switch states before registering the
input device, but does not terminate the packet with input_sync(). Since
input event buffers are allocated before registration, these events can
remain queued until a later SYN_REPORT.
On a ThinkPad, a userspace LED update and SYN_REPORT delivered the initial
SW_RFKILL_ALL=1 event to the rfkill input handler after registration. This
undid a software radio block that had already been applied.
Call input_sync() after reporting the initial switch states to flush the
packet before input handlers attach. This requires the input-core fix to
accept EV_SYN events before registration.
Fixes: 0cd587735205 ("Input: preallocate memory to hold event values")
Cc: stable@xxxxxxxxxxxxxxx
Suggested-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Link: https://lore.kernel.org/r/98c68af25f9fc08500eb818a6d77d0d7@xxxxxxxxx
Assisted-by: LLM
Signed-off-by: Karlos Abel <kabel@xxxxxxxxxxxx>
---
This is the companion driver change requested in the linked discussion.
It depends on Dmitry's "Input: always accept EV_SYN in input_event()":
https://lore.kernel.org/r/asx50uz6iafsyAd5@xxxxxxxxxx
The prerequisite patch ID is included below.
Validation on 3857c2fe5449 plus that core patch:
- KUnit/UML: all six input tests pass with lockdep enabled. The two
regression tests fail with either the core change or the pre-registration
sync removed, and with both removed.
- The tests model the driver's event sequence with a virtual input device;
they do not execute hotkey_init() or operate real radios.
- The actual ThinkPad driver object builds without warnings with W=1,
configured both built-in and as a module (x86-64/GCC).
- No new physical-hardware run of this pair yet.
AI assistance covered the change, message, and regression validation.
drivers/platform/x86/lenovo/thinkpad_acpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c
index 1661f070c..ea8679398 100644
--- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
+++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
@@ -3497,6 +3497,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
input_report_switch(tpacpi_inputdev,
SW_TABLET_MODE, tabletsw_state);
}
+ input_sync(tpacpi_inputdev);
/* Do not issue duplicate brightness change events to
* userspace. tpacpi_detect_brightness_capabilities() must have
base-commit: 3857c2fe5449541e24afc5efdb0f81a8a8f9a3a0
prerequisite-patch-id: f8539bd5b5201ef9795823552ba68a73b7dd6298
--
2.56.0