Re: [PATCH 1/3] gpiolib: add gpiod_to_gpio_device() stub for !GPIOLIB

From: Bartosz Golaszewski
Date: Thu Jan 25 2024 - 03:36:51 EST


On Thu, Jan 25, 2024 at 9:16 AM Krzysztof Kozlowski
<krzysztof.kozlowski@xxxxxxxxxx> wrote:
>
> Add empty stub of gpiod_to_gpio_device() when GPIOLIB is not enabled.
>
> Cc: <stable@xxxxxxxxxxxxxxx>
> Fixes: 370232d096e3 ("gpiolib: provide gpiod_to_gpio_device()")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
>
> ---
>
> Cc: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> ---
> include/linux/gpio/driver.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
> index 9a5c6c76e653..012797e7106d 100644
> --- a/include/linux/gpio/driver.h
> +++ b/include/linux/gpio/driver.h
> @@ -819,6 +819,12 @@ static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
> return ERR_PTR(-ENODEV);
> }
>
> +static inline struct gpio_device *gpiod_to_gpio_device(struct gpio_desc *desc)
> +{
> + WARN_ON(1);
> + return ERR_PTR(-ENODEV);
> +}
> +
> static inline int gpiochip_lock_as_irq(struct gpio_chip *gc,
> unsigned int offset)
> {
> --
> 2.34.1
>

Why is this needed? Users of gpio/driver.h should select GPIOLIB.

Bart