From: Alexander Stein <alexander.stein@systec-electronic.com>
To: linux-gpio@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>
Subject: gpio irqchip initialization race
Date: Fri, 01 Apr 2016 10:28:54 +0200 [thread overview]
Message-ID: <44236018.b6N0xPzKYW@ws-stein> (raw)
Hi,
I'm currently observing a (supposedly) race condition during system start.
My board is running an SMP kernel on 2 cores and uses a MCP23S17 where some
buttons are attached to. In the device tree the buttons are configured to used
by gpio-keys, thus some GPIOs on MCP23S17 will be used as interrupts.
In probably most cases init is fine and buttons can be used by evtest. But on
some boots I get 2 different error messages:
> gpio-keys user_sw: Unable to claim irq 0; error -22
and
> gpio-keys user_sw: Unable to get irq number for GPIO 376, error -6
GPIO 376 is Pin 8 on MCP23S17.
I suspect this depends on the time when gpio-keys is being probed. It will not
be probed (or actually deferred) before mcp23s08_probe_one calls
gpiochip_add_data as the parent GPIo controller to buttons is not present yet.
I guess those error messages raise when gpio-keys is probed after
gpiochip_add_data but before gpiochip_irqchip_add or
gpiochip_set_chained_irqchip (in mcp23s08_irq_setup).
The comment to _gpiochip_irqchip_add states the gpiochip has to be registered
when calling. So to me this opens a rather small window where childs to
gpiochip can be probed (parent is registered) but registering an interrupt
will fail as the parent IRQ setup has not finished yet.
Any suggestions how to fix that?
Best regards,
Alexander
next reply other threads:[~2016-04-01 8:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 8:28 Alexander Stein [this message]
2016-04-01 8:43 ` gpio irqchip initialization race Linus Walleij
2016-04-01 8:47 ` Linus Walleij
2016-04-01 8:56 ` Alexander Stein
2016-04-01 11:29 ` Linus Walleij
2016-04-01 12:45 ` 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=44236018.b6N0xPzKYW@ws-stein \
--to=alexander.stein@systec-electronic.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/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