mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
pinctrl: mcp23s08: fix irq and irqchip setup order
Since 'commit02e389e63e("pinctrl: mcp23s08: fix irq setup order")' the irq request isn't the last devm_* allocation. Without a deeper look at the irq and testing this isn't a good solution. Since this driver relies on the devm mechanism, requesting a interrupt should be the last thing to avoid memory corruptions during unbinding. 'Commit02e389e63e("pinctrl: mcp23s08: fix irq setup order")' fixed the order for the interrupt-controller use case only. The mcp23s08_irq_setup() must be split into two to fix it for the interrupt-controller use case and to register the irq at last. So the irq will be freed first during unbind. Cc: [email protected] Cc: Jan Kundrát <[email protected]> Cc: Dmitry Mastykin <[email protected]> Cc: Sebastian Reichel <[email protected]> Fixes:82039d244f("pinctrl: mcp23s08: add pinconf support") Fixes:02e389e63e("pinctrl: mcp23s08: fix irq setup order") Signed-off-by: Marco Felsch <[email protected]> Tested-by: Phil Reid <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
0238df646e
commit
f259f896f2
1 changed files with 12 additions and 1 deletions
|
|
@ -636,6 +636,14 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp)
|
|||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcp23s08_irqchip_setup(struct mcp23s08 *mcp)
|
||||
{
|
||||
struct gpio_chip *chip = &mcp->chip;
|
||||
int err;
|
||||
|
||||
err = gpiochip_irqchip_add_nested(chip,
|
||||
&mcp23s08_irq_chip,
|
||||
0,
|
||||
|
|
@ -912,7 +920,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
|
|||
}
|
||||
|
||||
if (mcp->irq && mcp->irq_controller) {
|
||||
ret = mcp23s08_irq_setup(mcp);
|
||||
ret = mcp23s08_irqchip_setup(mcp);
|
||||
if (ret)
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -944,6 +952,9 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (mcp->irq)
|
||||
ret = mcp23s08_irq_setup(mcp);
|
||||
|
||||
fail:
|
||||
if (ret < 0)
|
||||
dev_dbg(dev, "can't setup chip %d, --> %d\n", addr, ret);
|
||||
|
|
|
|||
Loading…
Reference in a new issue