linux-stable/drivers/pinctrl
Samuel Holland bac129dbc6 pinctrl: sunxi: Use unique lockdep classes for IRQs
This driver, like several others, uses a chained IRQ for each GPIO bank,
and forwards .irq_set_wake to the GPIO bank's upstream IRQ. As a result,
a call to irq_set_irq_wake() needs to lock both the upstream and
downstream irq_desc's. Lockdep considers this to be a possible deadlock
when the irq_desc's share lockdep classes, which they do by default:

 ============================================
 WARNING: possible recursive locking detected
 5.17.0-rc3-00394-gc849047c2473 #1 Not tainted
 --------------------------------------------
 init/307 is trying to acquire lock:
 c2dfe27c (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0x58/0xa0

 but task is already holding lock:
 c3c0ac7c (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0x58/0xa0

 other info that might help us debug this:
  Possible unsafe locking scenario:

        CPU0
        ----
   lock(&irq_desc_lock_class);
   lock(&irq_desc_lock_class);

  *** DEADLOCK ***

  May be due to missing lock nesting notation

 4 locks held by init/307:
  #0: c1f29f18 (system_transition_mutex){+.+.}-{3:3}, at: __do_sys_reboot+0x90/0x23c
  #1: c20f7760 (&dev->mutex){....}-{3:3}, at: device_shutdown+0xf4/0x224
  #2: c2e804d8 (&dev->mutex){....}-{3:3}, at: device_shutdown+0x104/0x224
  #3: c3c0ac7c (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0x58/0xa0

 stack backtrace:
 CPU: 0 PID: 307 Comm: init Not tainted 5.17.0-rc3-00394-gc849047c2473 #1
 Hardware name: Allwinner sun8i Family
  unwind_backtrace from show_stack+0x10/0x14
  show_stack from dump_stack_lvl+0x68/0x90
  dump_stack_lvl from __lock_acquire+0x1680/0x31a0
  __lock_acquire from lock_acquire+0x148/0x3dc
  lock_acquire from _raw_spin_lock_irqsave+0x50/0x6c
  _raw_spin_lock_irqsave from __irq_get_desc_lock+0x58/0xa0
  __irq_get_desc_lock from irq_set_irq_wake+0x2c/0x19c
  irq_set_irq_wake from irq_set_irq_wake+0x13c/0x19c
    [tail call from sunxi_pinctrl_irq_set_wake]
  irq_set_irq_wake from gpio_keys_suspend+0x80/0x1a4
  gpio_keys_suspend from gpio_keys_shutdown+0x10/0x2c
  gpio_keys_shutdown from device_shutdown+0x180/0x224
  device_shutdown from __do_sys_reboot+0x134/0x23c
  __do_sys_reboot from ret_fast_syscall+0x0/0x1c

However, this can never deadlock because the upstream and downstream
IRQs are never the same (nor do they even involve the same irqchip).

Silence this erroneous lockdep splat by applying what appears to be the
usual fix of moving the GPIO IRQs to separate lockdep classes.

Fixes: a59c99d9ea ("pinctrl: sunxi: Forward calls to irq_set_irq_wake")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220216040037.22730-1-samuel@sholland.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2022-02-28 23:53:19 +01:00
..
actions pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
aspeed pinctrl: aspeed: fix unmet dependencies on MFD_SYSCON for PINCTRL_ASPEED 2021-12-16 04:28:49 +01:00
bcm pinctrl: bcm63xx: fix unmet dependency on REGMAP for GPIO_REGMAP 2022-01-30 02:44:00 +01:00
berlin
cirrus pinctrl: Propagate firmware node from a parent device 2021-12-22 03:09:56 +01:00
freescale pinctrl: imx: fix assigning groups names 2022-01-02 07:33:51 +01:00
intel intel-pinctrl for v5.17-5 2022-02-19 02:03:58 +01:00
mediatek Pin control bulk changes for the v5.17 kernel cycle 2022-01-12 10:56:08 -08:00
meson
mvebu pinctrl: armada-37xx: Switch to use devm_kasprintf_strarray() 2021-11-18 18:40:09 +02:00
nomadik pinctrl: nomadik: Kconfig: Remove repeated config dependency 2021-09-17 00:08:14 +02:00
nuvoton pinctrl: Bulk conversion to generic_handle_domain_irq() 2021-08-12 11:39:39 +01:00
pxa pinctrl: Introduce MODE group in enum pin_config_param 2021-04-22 02:03:01 +02:00
qcom pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
ralink pinctrl: ralink: include 'ralink_regs.h' in 'pinctrl-mt7620.c' 2021-11-16 02:19:14 +01:00
renesas pinctrl: renesas: Updates for v5.17 (take two) 2021-12-20 03:14:33 +01:00
samsung pinctrl: samsung: Use platform_get_irq_optional() to get the interrupt 2021-12-25 11:18:06 +01:00
spear pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
sprd
stm32 pinctrl: stm32: consider the GPIO offset to expose all the GPIO lines 2021-12-16 04:14:56 +01:00
sunxi pinctrl: sunxi: Use unique lockdep classes for IRQs 2022-02-28 23:53:19 +01:00
tegra pinctrl: tegra194: remove duplicate initializer again 2021-11-16 02:19:15 +01:00
ti pinctrl: ti: fix error return code of ti_iodelay_dt_node_to_map() 2021-04-08 15:57:14 +02:00
uniphier pinctrl: uniphier: Add UniPhier NX1 pinctrl driver 2021-10-13 02:13:47 +02:00
visconti
vt8500 pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
core.c Pin control changes for the v5.16 kernel cycle 2021-11-05 08:24:17 -07:00
core.h
devicetree.c
devicetree.h
Kconfig Pin control bulk changes for the v5.17 kernel cycle 2022-01-12 10:56:08 -08:00
Makefile pinctrl: Place correctly CONFIG_PINCTRL_ST in the Makefile 2022-01-24 16:30:13 +02:00
pinconf-generic.c pinctrl: pinconf-generic: Add support for "output-impedance-ohms" to be extracted from DT files 2021-11-15 10:13:36 +01:00
pinconf.c
pinconf.h
pinctrl-amd.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-amd.h pinctrl: amd: Add irq field data 2021-09-17 00:48:45 +02:00
pinctrl-apple-gpio.c pinctrl: apple-gpio: fix flexible_array.cocci warnings 2021-12-02 02:34:45 +01:00
pinctrl-artpec6.c
pinctrl-as3722.c pinctrl: Propagate firmware node from a parent device 2021-12-22 03:09:56 +01:00
pinctrl-at91-pio4.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-at91.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-at91.h
pinctrl-axp209.c
pinctrl-bm1880.c
pinctrl-da850-pupd.c
pinctrl-da9062.c pinctrl: Propagate firmware node from a parent device 2021-12-22 03:09:56 +01:00
pinctrl-digicolor.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-equilibrium.c pinctrl: equilibrium: Fix function addition in multiple groups 2021-10-25 00:20:01 +02:00
pinctrl-equilibrium.h
pinctrl-falcon.c
pinctrl-gemini.c pinctrl: gemini: fix typos 2021-10-14 01:22:58 +02:00
pinctrl-ingenic.c This is the bulk of pin control changes for the v5.15 kernel cycle, 2021-09-02 14:22:56 -07:00
pinctrl-k210.c pinctrl: k210: Fix bias-pull-up 2022-02-11 02:19:47 +01:00
pinctrl-keembay.c pinctrl: keembay: rework loops looking for groups names 2021-12-22 02:57:27 +01:00
pinctrl-lantiq.c
pinctrl-lantiq.h
pinctrl-lpc18xx.c pinctrl: Introduce MODE group in enum pin_config_param 2021-04-22 02:03:01 +02:00
pinctrl-max77620.c pinctrl: Propagate firmware node from a parent device 2021-12-22 03:09:56 +01:00
pinctrl-mcp23s08.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-mcp23s08.h pinctrl: mcp23s08: Add optional reset GPIO 2021-06-12 01:58:10 +02:00
pinctrl-mcp23s08_i2c.c
pinctrl-mcp23s08_spi.c
pinctrl-microchip-sgpio.c pinctrl: microchip-sgpio: Fix support for regmap 2022-01-31 12:07:31 +01:00
pinctrl-ocelot.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-oxnas.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-palmas.c
pinctrl-pic32.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-pic32.h
pinctrl-pistachio.c pinctrl: Bulk conversion to generic_handle_domain_irq() 2021-08-12 11:39:39 +01:00
pinctrl-rk805.c pinctrl: Propagate firmware node from a parent device 2021-12-22 03:09:56 +01:00
pinctrl-rockchip.c pinctrl/rockchip: fix gpio device creation 2021-12-02 02:24:53 +01:00
pinctrl-rockchip.h pinctrl/rockchip: add a queue for deferred pin output settings on probe 2021-09-18 01:32:20 +02:00
pinctrl-single.c This is the bulk of pin control changes for the v5.15 kernel cycle, 2021-09-02 14:22:56 -07:00
pinctrl-st.c pinctrl: st: Switch to use devm_kasprintf_strarray() 2021-11-18 18:40:10 +02:00
pinctrl-starfive.c pinctrl: starfive: Use a static name for the GPIO irq_chip 2022-02-19 01:50:23 +01:00
pinctrl-stmfx.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-sx150x.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-tb10x.c
pinctrl-thunderbay.c pinctrl: thunderbay: rework loops looking for groups names 2022-01-24 01:12:45 +01:00
pinctrl-utils.c
pinctrl-utils.h
pinctrl-xway.c pinctrl: Get rid of duplicate of_node assignment in the drivers 2021-12-16 04:18:30 +01:00
pinctrl-zynq.c pinctrl: pinctrl-zynq: Add support for 'power-source' parameter 2021-07-30 14:40:42 +02:00
pinctrl-zynqmp.c pinctrl: zynqmp: Revert "Unify pin naming" 2022-01-28 16:52:04 +02:00
pinmux.c pinctrl: add one more "const" for generic function groups 2021-12-22 02:57:27 +01:00
pinmux.h pinctrl: add one more "const" for generic function groups 2021-12-22 02:57:27 +01:00