Skip to content

Commit 02e389e

Browse files
mastykinlinusw
authored andcommitted
pinctrl: mcp23s08: fix irq setup order
When using mcp23s08 module with gpio-keys, often (50% of boots) it fails to get irq numbers with message: "gpio-keys keys: Unable to get irq number for GPIO 0, error -6". Seems that irqs must be setup before devm_gpiochip_add_data(). Cc: stable@vger.kernel.org Signed-off-by: Dmitry Mastykin <mastichi@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent d3452f1 commit 02e389e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/pinctrl/pinctrl-mcp23s08.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,16 +890,16 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
890890
goto fail;
891891
}
892892

893-
ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
894-
if (ret < 0)
895-
goto fail;
896-
897893
if (mcp->irq && mcp->irq_controller) {
898894
ret = mcp23s08_irq_setup(mcp);
899895
if (ret)
900896
goto fail;
901897
}
902898

899+
ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
900+
if (ret < 0)
901+
goto fail;
902+
903903
mcp->pinctrl_desc.name = "mcp23xxx-pinctrl";
904904
mcp->pinctrl_desc.pctlops = &mcp_pinctrl_ops;
905905
mcp->pinctrl_desc.confops = &mcp_pinconf_ops;

0 commit comments

Comments
 (0)