[PATCH] of/gpio: Implement of_get_gpio_flags()

Anton Vorontsov avorontsov at ru.mvista.com
Fri Nov 28 21:07:47 EST 2008


On Fri, Nov 28, 2008 at 01:11:38AM -0800, Trent Piepho wrote:
> On Thu, 27 Nov 2008, Anton Vorontsov wrote:
> > This function is alike to the simple of_get_gpio(), but accepts new
> > argument: flags. This new function will be used by the drivers that
> > need to retrieve additional GPIO information, such as active-low flag.
> >
> > Signed-off-by: Anton Vorontsov <avorontsov at ru.mvista.com>
> 
> So you want to do the clean up patch later?

Yup, some day in 2.6.30, I think.

> > +	/*
> > +	 * We're discouraging gpio_cells < 2, since that way you'll have to
> > +	 * write your own xlate function (that will have to retrive the GPIO
> > +	 * number and the flags from a single gpio cell -- this is possible,
> > +	 * but not recommended).
> > +	 */
> > +	if (of_gc->gpio_cells < 2) {
> > +		WARN_ON(1);
> > +		return -EINVAL;
> > +	}
> 
> If you're not going to allow 1 cell anymore (which should perhaps be
> mentioned in the changelog),

It wasn't allowed from the start, I just had to catch the bogus users
on the mailing list.

> you could just check that when the of_gpio
> chip is registered. There's no need to see if of_gc->gpio_cells has
> changed each time a driver maps a GPIO.

There is no single OF GPIO registration function, yet. So the only
way we can check for correct gpio_cells for all "simple" gpio chips
is .xlate(). Soon there will be of_gpio_{,un}register_simple() thus
we can move that check there.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2



More information about the Linuxppc-dev mailing list