WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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