linux-stable/drivers/input/keyboard
Lad Prabhakar 4160e09619 Input: gpio-keys - cancel delayed work only in case of GPIO
[ Upstream commit cee409bbba ]

gpio_keys module can either accept gpios or interrupts. The module
initializes delayed work in case of gpios only and is only used if
debounce timer is not used, so make sure cancel_delayed_work_sync()
is called only when its gpio-backed and debounce_use_hrtimer is false.

This fixes the issue seen below when the gpio_keys module is unloaded and
an interrupt pin is used instead of GPIO:

[  360.297569] ------------[ cut here ]------------
[  360.302303] WARNING: CPU: 0 PID: 237 at kernel/workqueue.c:3066 __flush_work+0x414/0x470
[  360.310531] Modules linked in: gpio_keys(-)
[  360.314797] CPU: 0 PID: 237 Comm: rmmod Not tainted 5.18.0-rc5-arm64-renesas-00116-g73636105874d-dirty #166
[  360.324662] Hardware name: Renesas SMARC EVK based on r9a07g054l2 (DT)
[  360.331270] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  360.338318] pc : __flush_work+0x414/0x470
[  360.342385] lr : __cancel_work_timer+0x140/0x1b0
[  360.347065] sp : ffff80000a7fba00
[  360.350423] x29: ffff80000a7fba00 x28: ffff000012b9c5c0 x27: 0000000000000000
[  360.357664] x26: ffff80000a7fbb80 x25: ffff80000954d0a8 x24: 0000000000000001
[  360.364904] x23: ffff800009757000 x22: 0000000000000000 x21: ffff80000919b000
[  360.372143] x20: ffff00000f5974e0 x19: ffff00000f5974e0 x18: ffff8000097fcf48
[  360.379382] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000053f40
[  360.386622] x14: ffff800009850e88 x13: 0000000000000002 x12: 000000000000a60c
[  360.393861] x11: 000000000000a610 x10: 0000000000000000 x9 : 0000000000000008
[  360.401100] x8 : 0101010101010101 x7 : 00000000a473c394 x6 : 0080808080808080
[  360.408339] x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffff80000919b458
[  360.415578] x2 : ffff8000097577f0 x1 : 0000000000000001 x0 : 0000000000000000
[  360.422818] Call trace:
[  360.425299]  __flush_work+0x414/0x470
[  360.429012]  __cancel_work_timer+0x140/0x1b0
[  360.433340]  cancel_delayed_work_sync+0x10/0x18
[  360.437931]  gpio_keys_quiesce_key+0x28/0x58 [gpio_keys]
[  360.443327]  devm_action_release+0x10/0x18
[  360.447481]  release_nodes+0x8c/0x1a0
[  360.451194]  devres_release_all+0x90/0x100
[  360.455346]  device_unbind_cleanup+0x14/0x60
[  360.459677]  device_release_driver_internal+0xe8/0x168
[  360.464883]  driver_detach+0x4c/0x90
[  360.468509]  bus_remove_driver+0x54/0xb0
[  360.472485]  driver_unregister+0x2c/0x58
[  360.476462]  platform_driver_unregister+0x10/0x18
[  360.481230]  gpio_keys_exit+0x14/0x828 [gpio_keys]
[  360.486088]  __arm64_sys_delete_module+0x1e0/0x270
[  360.490945]  invoke_syscall+0x40/0xf8
[  360.494661]  el0_svc_common.constprop.3+0xf0/0x110
[  360.499515]  do_el0_svc+0x20/0x78
[  360.502877]  el0_svc+0x48/0xf8
[  360.505977]  el0t_64_sync_handler+0x88/0xb0
[  360.510216]  el0t_64_sync+0x148/0x14c
[  360.513930] irq event stamp: 4306
[  360.517288] hardirqs last  enabled at (4305): [<ffff8000080b0300>] __cancel_work_timer+0x130/0x1b0
[  360.526359] hardirqs last disabled at (4306): [<ffff800008d194fc>] el1_dbg+0x24/0x88
[  360.534204] softirqs last  enabled at (4278): [<ffff8000080104a0>] _stext+0x4a0/0x5e0
[  360.542133] softirqs last disabled at (4267): [<ffff8000080932ac>] irq_exit_rcu+0x18c/0x1b0
[  360.550591] ---[ end trace 0000000000000000 ]---

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20220524135822.14764-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-09 10:25:35 +02:00
..
adc-keys.c Input: adc-keys - drop bogus __refdata annotation 2021-09-03 23:49:58 -07:00
adp5520-keys.c
adp5588-keys.c Input: adp5588-keys - use the right header 2021-08-30 15:55:15 -07:00
adp5589-keys.c Input: adp5589-keys - use the right header 2021-08-30 15:55:18 -07:00
amikbd.c
applespi.c Input: applespi - fix occasional crc errors under load. 2021-02-19 11:13:29 -08:00
applespi.h
applespi_trace.h
atakbd.c
atkbd.c Input: atkbd - use kobj_to_dev() 2021-06-19 22:36:25 -07:00
bcm-keypad.c
cap11xx.c Input: cap11xx - add support for cap1206 2021-11-02 17:03:04 -07:00
clps711x-keypad.c
cros_ec_keyb.c Input: cros_ec_keyb - use kobj_to_dev() API 2021-06-19 22:36:19 -07:00
cypress-sf.c Input: cypress-sf - register a callback to disable the regulators 2022-05-09 09:16:27 +02:00
davinci_keyscan.c
dlink-dir685-touchkeys.c Input: dlink-dir685-touchkeys - fix a typo in driver name 2020-04-22 14:15:06 -07:00
ep93xx_keypad.c Input: ep93xx_keypad - switch to using managed resources 2021-10-15 18:29:43 -07:00
goldfish_events.c Input: goldfish_events - replace zero-length array with flexible-array member 2020-02-13 17:09:47 -08:00
gpio_keys.c Input: gpio-keys - cancel delayed work only in case of GPIO 2022-06-09 10:25:35 +02:00
gpio_keys_polled.c Input: gpio_keys_polled - replace zero-length array with flexible-array member 2020-02-14 17:19:19 -08:00
hil_kbd.c Input: hil_kbd - fix error return code in hil_dev_connect() 2021-05-24 20:57:04 -07:00
hilkbd.c parisc: Make struct parisc_driver::remove() return void 2021-08-30 10:18:25 +02:00
hpps2atkbd.h
imx_keypad.c Input: imx_keypad - convert to a DT-only driver 2021-03-27 21:40:21 -07:00
imx_sc_key.c Input: imx_sc_key - use devm_add_action_or_reset() to handle all cleanups 2020-05-13 10:34:58 -07:00
ipaq-micro-keys.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
iqs62x-keys.c input: keyboard: Add support for Azoteq IQS620A/621/622/624/625 2020-03-27 08:25:42 +00:00
jornada680_kbd.c
jornada720_kbd.c
Kconfig Input: samsung-keypad - properly state IOMEM dependency 2022-02-27 21:03:55 -08:00
lkkbd.c
lm8323.c
lm8333.c
locomokbd.c ARM: 9049/1: locomo: make locomo bus's remove callback return void 2021-02-01 19:44:30 +00:00
lpc32xx-keys.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
Makefile Input: cypress-sf - add Cypress StreetFighter touchkey driver 2021-09-09 22:26:23 -07:00
maple_keyb.c
matrix_keypad.c
max7359_keypad.c
mcs_touchkey.c
mpr121_touchkey.c Input: mpr121 - make use of the helper function devm_add_action_or_reset() 2021-09-22 21:56:50 -07:00
mtk-pmic-keys.c
newtonkbd.c
nomadik-ske-keypad.c Input: nomadik-ske-keypad - provide some missing struct member docs 2020-11-08 22:19:53 -08:00
nspire-keypad.c Input: nspire-keypad - enable interrupts only when opened 2021-03-23 10:55:10 -07:00
omap-keypad.c Input: omap-keypad - prefer struct_size over open coded arithmetic 2021-09-20 21:59:48 -07:00
omap4-keypad.c Input: omap4-keypad - fix pm_runtime_get_sync() error checking 2022-04-27 14:41:12 +02:00
opencores-kbd.c
pmic8xxx-keypad.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
pxa27x_keypad.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
pxa930_rotary.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
qt1050.c
qt1070.c
qt2160.c
samsung-keypad.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
sh_keysc.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
snvs_pwrkey.c Input: snvs_pwrkey - add clk handling 2021-10-15 22:11:01 -07:00
spear-keyboard.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
st-keyscan.c Input: use input_device_enabled() 2020-12-02 22:10:33 -08:00
stmpe-keypad.c
stowaway.c
sun4i-lradc-keys.c
sunkbd.c Input: sunkbd - avoid use-after-free in teardown paths 2020-11-08 21:59:07 -08:00
tc3589x-keypad.c
tca6416-keypad.c Input: move to use request_irq by IRQF_NO_AUTOEN flag 2021-03-25 15:27:56 -07:00
tca8418_keypad.c
tegra-kbc.c Input: move to use request_irq by IRQF_NO_AUTOEN flag 2021-03-25 15:27:56 -07:00
tm2-touchkey.c Input: tm2-touchkey - allow changing keycodes from userspace 2021-10-15 20:26:30 -07:00
twl4030_keypad.c Input: twl4030_keypad - fix handling of platform_get_irq() error 2020-09-16 10:42:15 -07:00
xtkbd.c