Re: [PATCH v5 1/6] gpiolib: Introduce a helper to get first GPIO controller node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 14, 2022 at 9:02 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> Introduce a helper to get first GPIO controller node which drivers
> may want to use.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  include/linux/gpio/driver.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
> index 12de0b22b4ef..83e2d72e51bb 100644
> --- a/include/linux/gpio/driver.h
> +++ b/include/linux/gpio/driver.h
> @@ -766,4 +766,14 @@ static inline unsigned int gpiochip_node_count(struct device *dev)
>         return count;
>  }
>
> +static inline struct fwnode_handle *gpiochip_node_get_first(struct device *dev)
> +{
> +       struct fwnode_handle *fwnode;
> +
> +       for_each_gpiochip_node(dev, fwnode)
> +               return fwnode;
> +
> +       return NULL;
> +}
> +
>  #endif /* __LINUX_GPIO_DRIVER_H */
> --
> 2.35.1
>

Any chance you could name it get_first_gpiochip_node()? It's static so
we don't have to worry about the prefix and it would make the purpose
more clear.

Bart



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux