Skip to content

Input: discard pre-registration events and test state seeding

Karlos Abel linux-input lkml 3 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 0 repliesNew
  2. v22 patches 0 repliesSuperseded
  3. v12 patches 3 repliesSuperseded

Changes in v3 from the cover letter

- Use an explicit spin_lock_irq()/spin_unlock_irq() pair instead of adding scoped cleanup to the goto-based registration path.
- Include the spinlock declarations directly.
- Patch 2 is unchanged from v2.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Input: discard pre-registration events before attaching handlersdrivers/input/input.c+7 -00 replies
2/2Input: test state seeding across device registrationdrivers/input/tests/input_test.c+171 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] Input: discard pre-registration events and test state seeding

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 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:
- V3 with both patches: all six input-core KUnit tests pass under UML, with CONFIG_PROVE_LOCKING and CONFIG_DEBUG_SPINLOCK enabled. No compiler warnings or lockdep diagnostics were reported.
- The unchanged tests previously failed against the unmodified input
core: four passed and two failed. The non-resizing case replayed one stale switch event; both cases retained the initialization timestamp.

Earlier versions using a scoped spinlock guard were also tested with QEMU/KVM on Arch 7.2.7 and on the ThinkPad. V3 uses the same underlying lock/unlock operations but has not been rerun on physical hardware.

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: <[email protected]>
Review addressed:
Message-ID: <[email protected]>

Changes in v3:
- Use an explicit spin_lock_irq()/spin_unlock_irq() pair instead of adding scoped cleanup to the goto-based registration path.
- Include the spinlock declarations directly.
- Patch 2 is unchanged from v2.

Changes in v2:
- Check absinfo allocation before test event seeding.
- Unregister the test handler before unregistering its device.

Karlos Abel (2):
Input: discard pre-registration events before attaching handlers
Input: test state seeding across device registration

 drivers/input/input.c            |   7 ++
 drivers/input/tests/input_test.c | 171 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 178 insertions(+)

base-commit: 3857c2fe5449541e24afc5efdb0f81a8a8f9a3a0