Re: gpio api

From: Russell King
Date: Mon Feb 21 2005 - 05:20:45 EST


On Mon, Feb 21, 2005 at 11:02:24AM +0100, Asier Llano Palacios wrote:
> The GPIOs requesting and numbering should be done by specifying the
> chip, the port and the pin. We should be able to manipulate easily a
> GPIO from one of 3 I2C chips and another one from our microprocessor.

I think there's a problem with this approach:

- I2C chips require you to talk to them via a relatively slow bus.
The I2C subsystem takes a semaphore, so it can be used from interrupt
context.
- You may wish to use GPIOs (especially on-chip GPIOs) from interrupt
context.

Therefore, you don't have a clear locking model for a GPIO subsystem.
You'll probably be in the situation where some GPIOs may be locked by
spinlocks (which are fine to manipulate from interrupt context) and
others which are locked by semaphores - so you don't actually know
what's going on beneath the GPIO API.

This is real bad news in terms of ensuring correctness and being able to
review.

--
Russell King

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