[PATCH 1/4] [POWERPC] Implement GPIO API embryo

Segher Boessenkool segher at kernel.crashing.org
Sun Dec 23 13:49:30 EST 2007


> +int __of_parse_gpio_bank_pin(struct device_node *np, int index,
> +			     int bank_width, int max_bank)
> +{
> +	int bank;
> +	int pin;
> +	const u32 *gpios;
> +
> +	/*
> +	 * We can get there only if of_get_gpio() succeeded, thus
> +	 * no need checking for "gpios" existence.
> +	 */
> +	gpios = of_get_property(np, "gpios", NULL);
> +	bank = gpios[index * 2];
> +	pin = gpios[index * 2 + 1];

If you stick with the #gpio-cells plan, here is where you should use it.


Segher




More information about the Linuxppc-dev mailing list