gpio irqchip initialization race

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux