Skip to contentSkip to conversation

pinctrl: da9062: don't pull in internal GPIOLIB headers

PATCH In review Bartosz Golaszewski 3 participants 8 messages Sep 1, 2023 – Sep 12, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover pinctrl: da9062: don't pull in internal GPIOLIB headers

From: Bartosz Golaszewski <[email protected]>

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(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/3 pinctrl: da9062: add missing include

From: Bartosz Golaszewski <[email protected]>

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.

---
 drivers/pinctrl/pinctrl-da9062.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pinctrl/pinctrl-da9062.c +1 -0
index 0e0ac3f3ffef..9239b9cd9002 100644
@@ -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>
Signature · 1 line
2.39.2
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] pinctrl: da9062: add missing include

Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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.

For allt three patches.
Just apply them to the GPIO tree, that's easiest!

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH 1/3] pinctrl: da9062: add missing include

Quoted 9 lines · Linus Walleij
Quoted 6 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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.

Quoted 8 lines
Quoted 1 line

For allt three patches.
Just apply them to the GPIO tree, that's easiest!

Yours,
Linus Walleij

Ok, queued, thanks!

Bart

#4 lore raw

PATCH 2/3 gpiolib: make gpiochip_get_desc() public

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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.

---
 drivers/gpio/gpiolib.h      | 2 --
 include/linux/gpio/driver.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib.h +0 -2
index a0a67569300b..09c5feb01d52 100644
@@ -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));	\
include/linux/gpio/driver.h +2 -0
index 4f0c5d62c8f3..8fc3ceffcbe9 100644
@@ -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 */
Signature · 1 line
2.39.2
#5 lore raw

PATCH 3/3 pinctrl: da9062: don't include private GPIOLIB header

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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

---
 drivers/pinctrl/pinctrl-da9062.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/pinctrl/pinctrl-da9062.c +0 -6
index 9239b9cd9002..3998b27cbe0e 100644
@@ -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 */
Signature · 1 line
2.39.2
Reviewed-by on the v1 series
#6 lore raw
In reply to Bartosz Golaszewski
Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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().

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw
In reply to Bartosz Golaszewski
Quoted 14 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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

Quoted 8 lines
 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