[PATCH v2 0/2] Input: discard pre-registration events and test state seeding
From: Karlos Abel
Date: Sat Oct 10 2026 - 15:10:46 EST
This series prevents input handlers from receiving buffered initialization
events after device registration. On a ThinkPad T14 Gen 6, a later LED
update flushed a stale SW_RFKILL_ALL event seeded by thinkpad_acpi.
The fix drops the pending events and their timestamp before handlers
attach, while retaining the seeded switch and absolute-axis state.
Patch 1 contains the six-line runtime fix. Patch 2 adds KUnit coverage for
registration with and without event-buffer resizing. The test uses a
virtual SW_DOCK device and performs no real radio operations.
Tested on mainline 3857c2fe5449541e24afc5efdb0f81a8a8f9a3a0 (7.3.0-rc6):
- Tests alone on the unmodified input core: four pass, two fail.
The non-resizing case replays one stale switch event; both cases
retain the initialization timestamp.
- Patch 1 alone: all four existing input-core tests pass.
- Both patches: all six input-core tests pass.
Both source commits were built and tested under UML without compiler
warnings. The revised tests repeat the same failing/passing comparison.
The same runtime fix was also tested with QEMU/KVM on Arch 7.2.7 and on
the ThinkPad.
AI assistance: OpenAI Codex assisted source analysis, the fix, regression
tests and this text. The submitter performed the physical hardware
comparisons.
Previous version:
Message-ID: <20261010180031.7-1-kabel@xxxxxxxxxxxx>
Review addressed:
Message-ID: <sashiko-outbox-166792@xxxxxxxxxx>
Changes in v2:
- Patch 1 is unchanged.
- Patch 2 checks absinfo allocation before event seeding and unregisters
its handler before its device, addressing Sashiko's review of v1.
- Forced allocation failure now reaches the explicit check and cleanup.
A forced teardown interleaving reproduced unintended binding after
actual allocator address reuse; handler-first cleanup prevents it.
Karlos Abel (2):
Input: discard pre-registration events before attaching handlers
Input: test state seeding across device registration
drivers/input/input.c | 6 ++
drivers/input/tests/input_test.c | 171 +++++++++++++++++++++++++++++++
2 files changed, 177 insertions(+)
base-commit: 3857c2fe5449541e24afc5efdb0f81a8a8f9a3a0