Linux GPIO subsystem development
 help / color / mirror / Atom feed
* gpio irqchip initialization race
@ 2016-04-01  8:28 Alexander Stein
  2016-04-01  8:43 ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Stein @ 2016-04-01  8:28 UTC (permalink / raw)
  To: linux-gpio; +Cc: Linus Walleij, Alexandre Courbot

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


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

end of thread, other threads:[~2016-04-01 12:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-01  8:28 gpio irqchip initialization race Alexander Stein
2016-04-01  8:43 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox