Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02e389e6 authored by Dmitry Mastykin's avatar Dmitry Mastykin Committed by Linus Walleij
Browse files

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: default avatarDmitry Mastykin <mastichi@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent d3452f1d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -890,16 +890,16 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
			goto fail;
	}

	ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
	if (ret < 0)
		goto fail;

	if (mcp->irq && mcp->irq_controller) {
		ret = mcp23s08_irq_setup(mcp);
		if (ret)
			goto fail;
	}

	ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
	if (ret < 0)
		goto fail;

	mcp->pinctrl_desc.name = "mcp23xxx-pinctrl";
	mcp->pinctrl_desc.pctlops = &mcp_pinctrl_ops;
	mcp->pinctrl_desc.confops = &mcp_pinconf_ops;