linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers
@ 2023-09-01 11:29 Bartosz Golaszewski
  2023-09-01 11:29 ` [PATCH 1/3] pinctrl: da9062: add missing include Bartosz Golaszewski
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2023-09-01 11:29 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
  Cc: Support Opensource, linux-gpio, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

I'm removing instances of users of internal GPIOLIB headers which should
not be included by anyone but GPIO core code. The pinctrl-da9062 driver
uses gpiochip_get_desc() which we should put into the gpio/driver.h
header as it does sometimes make sense for GPIO providers to get its own
descriptors without having to go through gpiochip_request_own_desc().

Bartosz Golaszewski (3):
  pinctrl: da9062: add missing include
  gpiolib: make gpiochip_get_desc() public
  pinctrl: da9062: don't include private GPIOLIB header

 drivers/gpio/gpiolib.h           | 2 --
 drivers/pinctrl/pinctrl-da9062.c | 7 +------
 include/linux/gpio/driver.h      | 2 ++
 3 files changed, 3 insertions(+), 8 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] pinctrl: da9062: add missing include
  2023-09-01 11:29 [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Bartosz Golaszewski
@ 2023-09-01 11:29 ` Bartosz Golaszewski
  2023-09-12  7:29   ` Linus Walleij
  2023-09-01 11:29 ` [PATCH 2/3] gpiolib: make gpiochip_get_desc() public Bartosz Golaszewski
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Bartosz Golaszewski @ 2023-09-01 11:29 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
  Cc: Support Opensource, linux-gpio, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

gpiod_is_active_low() is defined in linux/gpio/consumer.h. It's only
because we're pulling in the gpiolib.h private header that we get this
declaration implicitly but let's fix it as that is going away soon.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/pinctrl/pinctrl-da9062.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/pinctrl-da9062.c b/drivers/pinctrl/pinctrl-da9062.c
index 0e0ac3f3ffef..9239b9cd9002 100644
--- a/drivers/pinctrl/pinctrl-da9062.c
+++ b/drivers/pinctrl/pinctrl-da9062.c
@@ -17,6 +17,7 @@
 #include <linux/property.h>
 #include <linux/regmap.h>
 
+#include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
 
 #include <linux/mfd/da9062/core.h>
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] gpiolib: make gpiochip_get_desc() public
  2023-09-01 11:29 [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Bartosz Golaszewski
  2023-09-01 11:29 ` [PATCH 1/3] pinctrl: da9062: add missing include Bartosz Golaszewski
@ 2023-09-01 11:29 ` Bartosz Golaszewski
  2023-09-01 11:29 ` [PATCH 3/3] pinctrl: da9062: don't include private GPIOLIB header Bartosz Golaszewski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2023-09-01 11:29 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
  Cc: Support Opensource, linux-gpio, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

It makes sense for a GPIO driver to want to get its own descriptor
without requesting it. After all, the driver knows that it'll still be
valid. Let's move this helper to linux/gpio/driver.h.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpiolib.h      | 2 --
 include/linux/gpio/driver.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index a0a67569300b..09c5feb01d52 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -122,8 +122,6 @@ struct gpio_array {
 	unsigned long		invert_mask[];
 };
 
-struct gpio_desc *gpiochip_get_desc(struct gpio_chip *gc, unsigned int hwnum);
-
 #define for_each_gpio_desc(gc, desc)					\
 	for (unsigned int __i = 0;					\
 	     __i < gc->ngpio && (desc = gpiochip_get_desc(gc, __i));	\
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 4f0c5d62c8f3..8fc3ceffcbe9 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -758,6 +758,8 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc,
 					    enum gpiod_flags dflags);
 void gpiochip_free_own_desc(struct gpio_desc *desc);
 
+struct gpio_desc *gpiochip_get_desc(struct gpio_chip *gc, unsigned int hwnum);
+
 #ifdef CONFIG_GPIOLIB
 
 /* lock/unlock as IRQ */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] pinctrl: da9062: don't include private GPIOLIB header
  2023-09-01 11:29 [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Bartosz Golaszewski
  2023-09-01 11:29 ` [PATCH 1/3] pinctrl: da9062: add missing include Bartosz Golaszewski
  2023-09-01 11:29 ` [PATCH 2/3] gpiolib: make gpiochip_get_desc() public Bartosz Golaszewski
@ 2023-09-01 11:29 ` Bartosz Golaszewski
  2023-09-01 12:15 ` [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Andy Shevchenko
  2023-09-11  7:18 ` Bartosz Golaszewski
  4 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2023-09-01 11:29 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
  Cc: Support Opensource, linux-gpio, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

gpiochip_get_desc() now lives in linux/gpio/driver.h and there is no
longer any need to include GPIOLIB's private header.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/pinctrl/pinctrl-da9062.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-da9062.c b/drivers/pinctrl/pinctrl-da9062.c
index 9239b9cd9002..3998b27cbe0e 100644
--- a/drivers/pinctrl/pinctrl-da9062.c
+++ b/drivers/pinctrl/pinctrl-da9062.c
@@ -23,12 +23,6 @@
 #include <linux/mfd/da9062/core.h>
 #include <linux/mfd/da9062/registers.h>
 
-/*
- * We need this get the gpio_desc from a <gpio_chip,offset> tuple to decide if
- * the gpio is active low without a vendor specific dt-binding.
- */
-#include "../gpio/gpiolib.h"
-
 #define DA9062_TYPE(offset)		(4 * (offset % 2))
 #define DA9062_PIN_SHIFT(offset)	(4 * (offset % 2))
 #define DA9062_PIN_ALTERNATE		0x00 /* gpio alternate mode */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers
  2023-09-01 11:29 [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2023-09-01 11:29 ` [PATCH 3/3] pinctrl: da9062: don't include private GPIOLIB header Bartosz Golaszewski
@ 2023-09-01 12:15 ` Andy Shevchenko
  2023-09-11  7:18 ` Bartosz Golaszewski
  4 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2023-09-01 12:15 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Support Opensource, linux-gpio, linux-kernel,
	Bartosz Golaszewski

On Fri, Sep 01, 2023 at 01:29:23PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> I'm removing instances of users of internal GPIOLIB headers which should
> not be included by anyone but GPIO core code. The pinctrl-da9062 driver
> uses gpiochip_get_desc() which we should put into the gpio/driver.h
> header as it does sometimes make sense for GPIO providers to get its own
> descriptors without having to go through gpiochip_request_own_desc().

Reviewed-by: Andy Shevchenko <andy@kernel.org>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers
  2023-09-01 11:29 [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Bartosz Golaszewski
                   ` (3 preceding siblings ...)
  2023-09-01 12:15 ` [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Andy Shevchenko
@ 2023-09-11  7:18 ` Bartosz Golaszewski
  4 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2023-09-11  7:18 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Support Opensource, linux-gpio, linux-kernel, Bartosz Golaszewski,
	Andy Shevchenko, Bartosz Golaszewski

On Fri, Sep 1, 2023 at 1:29 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> I'm removing instances of users of internal GPIOLIB headers which should
> not be included by anyone but GPIO core code. The pinctrl-da9062 driver
> uses gpiochip_get_desc() which we should put into the gpio/driver.h
> header as it does sometimes make sense for GPIO providers to get its own
> descriptors without having to go through gpiochip_request_own_desc().
>
> Bartosz Golaszewski (3):
>   pinctrl: da9062: add missing include
>   gpiolib: make gpiochip_get_desc() public
>   pinctrl: da9062: don't include private GPIOLIB header
>
>  drivers/gpio/gpiolib.h           | 2 --
>  drivers/pinctrl/pinctrl-da9062.c | 7 +------
>  include/linux/gpio/driver.h      | 2 ++
>  3 files changed, 3 insertions(+), 8 deletions(-)
>
> --
> 2.39.2
>

Linus,

Do you mind me taking these through the GPIO tree or do you prefer to
apply them yourself in which case I'll apply patch 2/3 first and
provide you with an immutable tag?

Bartosz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] pinctrl: da9062: add missing include
  2023-09-01 11:29 ` [PATCH 1/3] pinctrl: da9062: add missing include Bartosz Golaszewski
@ 2023-09-12  7:29   ` Linus Walleij
  2023-09-12  7:45     ` Bartosz Golaszewski
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2023-09-12  7:29 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Andy Shevchenko, Support Opensource, linux-gpio, linux-kernel,
	Bartosz Golaszewski

On Fri, Sep 1, 2023 at 1:29 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> gpiod_is_active_low() is defined in linux/gpio/consumer.h. It's only
> because we're pulling in the gpiolib.h private header that we get this
> declaration implicitly but let's fix it as that is going away soon.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Acked-by: Linus Walleij <linus.walleij@linaro.org>
For allt three patches.
Just apply them to the GPIO tree, that's easiest!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] pinctrl: da9062: add missing include
  2023-09-12  7:29   ` Linus Walleij
@ 2023-09-12  7:45     ` Bartosz Golaszewski
  0 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2023-09-12  7:45 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Support Opensource, linux-gpio, linux-kernel,
	Bartosz Golaszewski

On Tue, Sep 12, 2023 at 9:30 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Fri, Sep 1, 2023 at 1:29 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > gpiod_is_active_low() is defined in linux/gpio/consumer.h. It's only
> > because we're pulling in the gpiolib.h private header that we get this
> > declaration implicitly but let's fix it as that is going away soon.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> For allt three patches.
> Just apply them to the GPIO tree, that's easiest!
>
> Yours,
> Linus Walleij

Ok, queued, thanks!

Bart

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-12  7:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-01 11:29 [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Bartosz Golaszewski
2023-09-01 11:29 ` [PATCH 1/3] pinctrl: da9062: add missing include Bartosz Golaszewski
2023-09-12  7:29   ` Linus Walleij
2023-09-12  7:45     ` Bartosz Golaszewski
2023-09-01 11:29 ` [PATCH 2/3] gpiolib: make gpiochip_get_desc() public Bartosz Golaszewski
2023-09-01 11:29 ` [PATCH 3/3] pinctrl: da9062: don't include private GPIOLIB header Bartosz Golaszewski
2023-09-01 12:15 ` [PATCH 0/3] pinctrl: da9062: don't pull in internal GPIOLIB headers Andy Shevchenko
2023-09-11  7:18 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).