On Thu, Apr 07, 2016 at 05:34:00PM -0300, Jared McNeill wrote:
Hi Manuel --
A few comments:
The attached patch adds two functions to gpio.c:
gpio_pin_wait() is called by a thread that wants to wait on an interrupt.
A thread can wait only on a single pin.
Any particular reason you went with this approach instead of say, something
that follows the typical foo_intr_establish pattern? I think "register a
callback" would be a much more typical use-case for a device driver here.
In a SMP world you want to do less in interrupt handlers and more in
kernel threads, basically. Also, in this kind of setup, the
device raising an interrupt is most likely behind a bus that itself needs
interrupts to work (i2c, spi, uart, ...). So the action triggered by
the interrupt can't be part of the interrupt handler, it has to execute
in a thread.
Also, if we ever makes this usable up to userland, condvar will be needed.