Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input: matrix-keypad - don't map irqs when atomic #6427

Merged
merged 1 commit into from
Oct 20, 2024

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Oct 18, 2024

Calling gpio_to_irq can result in irqs being mapped for the first time. which is not safe in atomic context. Enabling CONFIG_PROVE_LOCKING will trigger a kernel splat from _lock_acquire in a call chain from matrix_keypad_scan.

Fix the bug (and improve efficiency) by mapping all GPIO irqs from within the probe function.

Link: https://forums.raspberrypi.com/viewtopic.php?t=378044
Fixes: bab7614 ("Input: add support for generic GPIO-based matrix keypad")

commit a96fb71 upstream.

There is no need to do conversion from GPIOs to interrupt numbers.
Convert row GPIOs to interrupt numbers once in probe() and use
this information when the driver needs to enable or disable given
interrupt line.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
@pelwell
Copy link
Contributor Author

pelwell commented Oct 18, 2024

Perhaps not so surprisingly, an almost identical patch is already in kernels from 6.9 onwards. PR updated with a back-port of that commit instead.

@pelwell
Copy link
Contributor Author

pelwell commented Oct 18, 2024

@dtor FYI your patch is a fix, not just an optimisation.

@pelwell pelwell merged commit 25b2b36 into raspberrypi:rpi-6.6.y Oct 20, 2024
11 of 12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Oct 22, 2024
See: raspberrypi/linux#6273

kernel: DRM Writeback connector priority changes
See: raspberrypi/linux#6345

kernel: Input: matrix-keypad - don't map irqs when atomic
See: raspberrypi/linux#6427
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Oct 22, 2024
See: raspberrypi/linux#6273

kernel: DRM Writeback connector priority changes
See: raspberrypi/linux#6345

kernel: Input: matrix-keypad - don't map irqs when atomic
See: raspberrypi/linux#6427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants