]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pinctrl: mcp23s08: Fix add_data and irqchip_add_nested call order
authorPhil Reid <preid@electromag.com.au>
Thu, 13 Jun 2019 04:10:23 +0000 (12:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Jul 2019 07:01:58 +0000 (09:01 +0200)
commite6c2076b1421249682f02b345b484d9fcb3538f2
tree21d04081f284045e39a5ceb3d06f9c75ea90469e
parentaa08b940a00313b3c6704f5eec15f21ef69b6e5e
pinctrl: mcp23s08: Fix add_data and irqchip_add_nested call order

[ Upstream commit 6dbc6e6f58556369bf999cd7d9793586f1b0e4b4 ]

Currently probing of the mcp23s08 results in an error message
"detected irqchip that is shared with multiple gpiochips:
please fix the driver"

This is due to the following:

Call to mcp23s08_irqchip_setup() with call hierarchy:
mcp23s08_irqchip_setup()
  gpiochip_irqchip_add_nested()
    gpiochip_irqchip_add_key()
      gpiochip_set_irq_hooks()

Call to devm_gpiochip_add_data() with call hierarchy:
devm_gpiochip_add_data()
  gpiochip_add_data_with_key()
    gpiochip_add_irqchip()
      gpiochip_set_irq_hooks()

The gpiochip_add_irqchip() returns immediately if there isn't a irqchip
but we added a irqchip due to the previous mcp23s08_irqchip_setup()
call. So it calls gpiochip_set_irq_hooks() a second time.

Fix this by moving the call to devm_gpiochip_add_data before
the call to mcp23s08_irqchip_setup

Fixes: 02e389e63e35 ("pinctrl: mcp23s08: fix irq setup order")
Suggested-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/pinctrl-mcp23s08.c