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().
Signed-off-by: Dmitry Mastykin <[email protected]>
---
drivers/pinctrl/pinctrl-mcp23s08.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 9c950bbf..447763a 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -891,16 +891,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;
--
2.7.4
On Thu, Dec 28, 2017 at 4:19 PM, Dmitry Mastykin <[email protected]> wrote:
> 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().
>
> Signed-off-by: Dmitry Mastykin <[email protected]>
Patch applied, albeit for devel.
Should it be tagged for stable or go into fixes?
Yours,
Linus Walleij
On Tue, Jan 2, 2018 at 12:10 PM, Linus Walleij <[email protected]> wrote:
>
> Patch applied, albeit for devel.
>
> Should it be tagged for stable or go into fixes?
>
Thank you very much, Linus!
About tags, please do as it convenient for you.
Kind regards,
Dmitry
> On Thu, Dec 28, 2017 at 4:19 PM, Dmitry Mastykin <[email protected]> wrote:
>
>> 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().
>>
>> Signed-off-by: Dmitry Mastykin <[email protected]>
On 2/01/2018 17:10, Linus Walleij wrote:
> On Thu, Dec 28, 2017 at 4:19 PM, Dmitry Mastykin <[email protected]> wrote:
>
>> 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().
>>
>> Signed-off-by: Dmitry Mastykin <[email protected]>
>
> Patch applied, albeit for devel.
>
> Should it be tagged for stable or go into fixes?
>
I'm no expert on this one, but looking at other drivers they're using a mixture of ordering
for irq setup and devm_gpiochip_add_data() calls.
But should probably go into stable if it is the fix.
--
Regards
Phil Reid