Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

From: Haavard Skinnemoen
Date: Thu Nov 15 2007 - 03:52:29 EST


On Thu, 15 Nov 2007 00:20:33 -0800
David Brownell <david-b@xxxxxxxxxxx> wrote:

> > > - gpio_direction_input()/gpio_direction_output() implicitly
> > > request the pins, if they weren't already requested.
> >
> > Eek, that's completely wrong. Allowing to access a resource _before_
> > it is assigned and then doing the assignment implicit is a really bad
> > idea.
>
> This is an artifact of making the GPIO interface easy to adopt,
> by letting all the initial adopters wrap "legacy" SOC-specific
> GPIO interfaces instead of creating a bunch of new platform code.

It's still ok for platforms that do not use gpiolib to provide NOP
gpio_request() and gpio_free() functions if they don't care about
tracking gpio usage. That doesn't mean we shouldn't require all drivers
to use those calls -- if they are implemented as empty inlines, it
won't cost anything to call them.

I'd rather speed up the gpio_direction_* functions a bit by removing
the implicit gpio_request() since they may be called a lot more
frequently and, as you pointed out, possibly from atomic context.

HÃvard
-
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/