[PATCH] of/gpio: Implement of_get_gpio_flags()

Trent Piepho tpiepho at freescale.com
Fri Nov 28 20:11:38 EST 2008


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?

> +	/*
> +	 * 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), 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.



More information about the Linuxppc-dev mailing list