diff mbox series

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

Message ID 20240125081601.118051-1-krzysztof.kozlowski@linaro.org
State New
Headers show
Series [1/3] gpiolib: add gpiod_to_gpio_device() stub for !GPIOLIB | expand

Commit Message

Krzysztof Kozlowski Jan. 25, 2024, 8:15 a.m. UTC
Add empty stub of gpiod_to_gpio_device() when GPIOLIB is not enabled.

Cc: <stable@vger.kernel.org>
Fixes: 370232d096e3 ("gpiolib: provide gpiod_to_gpio_device()")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Cc: Philipp Zabel <p.zabel@pengutronix.de>
---
 include/linux/gpio/driver.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Bartosz Golaszewski Jan. 25, 2024, 8:36 a.m. UTC | #1
On Thu, Jan 25, 2024 at 9:16 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> Add empty stub of gpiod_to_gpio_device() when GPIOLIB is not enabled.
>
> Cc: <stable@vger.kernel.org>
> Fixes: 370232d096e3 ("gpiolib: provide gpiod_to_gpio_device()")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> ---
>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  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
Krzysztof Kozlowski Jan. 25, 2024, 8:59 a.m. UTC | #2
On 25/01/2024 09:36, Bartosz Golaszewski wrote:
> On Thu, Jan 25, 2024 at 9:16 AM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> Add empty stub of gpiod_to_gpio_device() when GPIOLIB is not enabled.
>>
>> Cc: <stable@vger.kernel.org>
>> Fixes: 370232d096e3 ("gpiolib: provide gpiod_to_gpio_device()")
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> ---
>>
>> Cc: Philipp Zabel <p.zabel@pengutronix.de>
>> ---
>>  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.

The third patch shows you the user which will not select GPIOLIB. Why?
Because there is no hard dependency between one core framework (RESET)
on other core framework (GPIOLIB).

The first two patches are added for the same purpose, even though there
is no need currently.


Best regards,
Krzysztof
Linus Walleij Jan. 31, 2024, 9 a.m. UTC | #3
On Thu, Jan 25, 2024 at 9:59 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:

> [Bart]
> > Why is this needed? Users of gpio/driver.h should select GPIOLIB.
>
> The third patch shows you the user which will not select GPIOLIB. Why?
> Because there is no hard dependency between one core framework (RESET)
> on other core framework (GPIOLIB).
>
> The first two patches are added for the same purpose, even though there
> is no need currently.

That reset driver implementing a GPIO chip has not been reviewed by the
GPIO maintainers so I looked up the patch and replied, we have
review comments.

Yours,
Linus Walleij
diff mbox series

Patch

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)
 {