From: Alexander Stein <alexander.stein@systec-electronic.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org,
Alexandre Courbot <acourbot@nvidia.com>,
linux-input@vger.kernel.org,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH] gpiolib: handle probe deferrals better
Date: Fri, 01 Apr 2016 14:16:57 +0200 [thread overview]
Message-ID: <1766024.riJEdmHPZI@ws-stein> (raw)
In-Reply-To: <1459511048-24084-1-git-send-email-linus.walleij@linaro.org>
On Friday 01 April 2016 13:44:08, Linus Walleij wrote:
> The gpiolib does not currently return probe deferrals from the
> .to_irq() hook while the GPIO drivers are being initialized.
> Further: it keeps returning -EPROBE_DEFER for gpio[d]_get()
> even after all builtin drivers have initialized.
>
> Fix this thusly:
>
> - Move the assignment of .to_irq() to the last step when
> using gpiolib_irqchip_add() so we can't get spurious calls
> into the .to_irq() function until all set-up is finished.
>
> - Put in a late_initcall_sync() to set a boolean state variable to
> indicate that we're not gonna defer any longer. Since deferred
> probe happens at late_initcall() time, using late_initcall_sync()
> should be fine.
>
> - After this point, return hard errors (-ENXIO) from both
> gpio[d]_get() and .to_irq().
>
> This way we should (at least for all drivers using GPIOLIB_IRQCHIP)
> be getting proper deferrals from both gpio[d]_get() and .to_irq()
> until the irqchip side is properly set up, and then proper
> errors after all drivers should have been probed.
>
> This problem was first seen with gpio-keys.
>
> Cc: linux-input@vger.kernel.org
> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Reported-by: Alexander Stein <alexander.stein@systec-electronic.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Alexander: please test this, you need Guether's patches too,
> I have it all on my "fixes" branch in the GPIO git:
> https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-gpio.git/log/?h=fi
> xes
I cherry-picked the top most 3 patches:
7f41f039a096a957eaa3e0ef0b040d96e7ad200d
2f126cda38e0614b3e8d211047b18e831b110f82
e6918cd02fd84402311f3fab4b218d9c911e70d6
Unfortunately it does not fix it. At least I do not get an IRQ of 0. After 10
boots:
4x gpio-keys user_sw: Unable to get irq number for GPIO 376, error -6
1x gpio-keys dip: Unable to get irq number for GPIO 352, error -6
5x ok
user_sw and dip are essientially the same, just different devices in DT with
different gpiochip parents (MCP23S18 and PCA9555).
I noticed you fiddle with late_initcall_sync. Sorry, I did not mention it:
gpio_mcp23s08 as well as gpio_keys are loaded as modules, so late_initcall_*
should not affect it.
Best regards,
Alexander
next prev parent reply other threads:[~2016-04-01 12:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 11:44 [PATCH] gpiolib: handle probe deferrals better Linus Walleij
2016-04-01 12:16 ` Alexander Stein [this message]
2016-04-01 13:03 ` Linus Walleij
2016-04-01 13:42 ` Alexander Stein
2016-04-01 14:03 ` Grygorii Strashko
2016-04-01 14:35 ` Alexander Stein
2016-04-01 14:04 ` Guenter Roeck
2016-04-01 17:52 ` Bjorn Andersson
2016-04-01 12:42 ` Guenter Roeck
2016-04-01 13:28 ` Grygorii Strashko
2016-04-04 16:21 ` Grygorii Strashko
2016-04-06 13:39 ` Linus Walleij
2016-04-06 15:42 ` Grygorii Strashko
2016-04-07 17:09 ` Linus Walleij
2016-04-11 6:10 ` Alexander Stein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1766024.riJEdmHPZI@ws-stein \
--to=alexander.stein@systec-electronic.com \
--cc=acourbot@nvidia.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).