linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: mcp23s08: fix irq setup order
@ 2017-12-28 15:19 Dmitry Mastykin
  2018-01-02  9:10 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Mastykin @ 2017-12-28 15:19 UTC (permalink / raw)
  Cc: preid, Dmitry Mastykin, Linus Walleij, linux-gpio, linux-kernel

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 <mastichi@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: mcp23s08: fix irq setup order
  2017-12-28 15:19 [PATCH] pinctrl: mcp23s08: fix irq setup order Dmitry Mastykin
@ 2018-01-02  9:10 ` Linus Walleij
  2018-01-03 12:49   ` Dmitry Mastykin
  2018-01-08  5:29   ` Phil Reid
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2018-01-02  9:10 UTC (permalink / raw)
  To: Dmitry Mastykin, Sebastian Reichel
  Cc: Phil Reid, linux-gpio, linux-kernel@vger.kernel.org

On Thu, Dec 28, 2017 at 4:19 PM, Dmitry Mastykin <mastichi@gmail.com> 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 <mastichi@gmail.com>

Patch applied, albeit for devel.

Should it be tagged for stable or go into fixes?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: mcp23s08: fix irq setup order
  2018-01-02  9:10 ` Linus Walleij
@ 2018-01-03 12:49   ` Dmitry Mastykin
  2018-01-08  5:29   ` Phil Reid
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Mastykin @ 2018-01-03 12:49 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Sebastian Reichel, Phil Reid, linux-gpio,
	linux-kernel@vger.kernel.org

On Tue, Jan 2, 2018 at 12:10 PM, Linus Walleij <linus.walleij@linaro.org> 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 <mastichi@gmail.com> 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 <mastichi@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: mcp23s08: fix irq setup order
  2018-01-02  9:10 ` Linus Walleij
  2018-01-03 12:49   ` Dmitry Mastykin
@ 2018-01-08  5:29   ` Phil Reid
  1 sibling, 0 replies; 4+ messages in thread
From: Phil Reid @ 2018-01-08  5:29 UTC (permalink / raw)
  To: Linus Walleij, Dmitry Mastykin, Sebastian Reichel
  Cc: linux-gpio, linux-kernel@vger.kernel.org

On 2/01/2018 17:10, Linus Walleij wrote:
> On Thu, Dec 28, 2017 at 4:19 PM, Dmitry Mastykin <mastichi@gmail.com> 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 <mastichi@gmail.com>
> 
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-08  5:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-28 15:19 [PATCH] pinctrl: mcp23s08: fix irq setup order Dmitry Mastykin
2018-01-02  9:10 ` Linus Walleij
2018-01-03 12:49   ` Dmitry Mastykin
2018-01-08  5:29   ` Phil Reid

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).