On Tue, Dec 13, 2011 at 01:23:33PM -0500, Kyle Moffett wrote:
> Mirroring the new gpio_request_array() interface, we add several a few
> helper functions for operating on entire arrays of GPIOs.
> 
> Also, to make it easier to write various combinations of "of_get_gpio()"
> followed by "gpio_request()", add several other new inline wrappers.
> 
> Signed-off-by: Kyle Moffett <[email protected]>
> ---
>  drivers/of/gpio.c       |   96 +++++++++++++++++++++++++++++
>  include/linux/of_gpio.h |  154 
> +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 250 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c
> index f349aaf..4c04f2f 100644
> --- a/drivers/of/gpio.c
> +++ b/drivers/of/gpio.c
> @@ -83,6 +83,47 @@ err0:
>  EXPORT_SYMBOL(of_get_named_gpio_flags);
>  
>  /**
> + * of_get_gpio_array_flags() - Get array of gpios to use with GPIO API
> + * @np:              device node to get GPIOs from
> + * @of_gpios:        array of "struct of_gpio" to select which GPIOs to look 
> up
> + * @of_flags:        array of "enum of_gpio_flags" to be filled in (may be 
> NULL)
> + * @gpios:   array of "struct gpio" to be filled in
> + * @num:     the number of GPIOs to look up
> + *
> + * Takes a constant array of "struct of_gpio" and looks up each item in the
> + * indicated device-node.  The results are stored into the @gpios array,
> + * along with the optional GPIO "label" and "flags" values from the "of_gpio"
> + * structure.
> + *
> + * If an array of @of_flags is provided then any flags from the translate
> + * function will be stored into the corresponding element there.
> + */

That seems overly complex to me.  How many gpios are you expecting to
request?  If it is less than a handful, then I think letting the
driver call of_get_request() multiple times would still be simpler.

g.

_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

Reply via email to