Skip to contentSkip to conversation

pinctrl: don't use GPIOLIB global numberspace in helpers

PATCH Superseded Bartosz Golaszewski 15 participants 78 messages Oct 3, 2023 – Dec 6, 2023

Subsystems (26)

v1 of 3 Superseded 1 of 36 applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover pinctrl: don't use GPIOLIB global numberspace in helpers

From: Bartosz Golaszewski <[email protected]>

We have a set of pinctrl helpers for GPIOLIB drivers that take a number from the global GPIO numberspace as argument. We are trying to get rid of this global numbering. Let's rework these helpers to use the recommended gpio_chip + controller-relative offset instead.

This work is split into phases: first let's introduce the new variants of the helpers. Next: let's convert all users one-by-one for easier review. Finally let's remove the old helpers and rename the new variants to take the place of the old ones.

Bartosz Golaszewski (36):
pinctrl: remove unneeded extern specifiers from consumer.h
pinctrl: provide new GPIO-to-pinctrl glue helpers
gpiolib: generic: use new pinctrl GPIO helpers
gpio: cdev: use pinctrl_gpio_can_use_line_new()
gpio: rcar: use new pinctrl GPIO helpers
gpio: tegra: use new pinctrl GPIO helpers
gpio: em: use new pinctrl GPIO helpers
gpio: aspeed: use new pinctrl GPIO helpers
gpio: mvebu: use new pinctrl GPIO helpers
gpio: pxa: use new pinctrl GPIO helpers
gpio: rockchip: use new pinctrl GPIO helpers
gpio: vf610: use new pinctrl GPIO helpers
pinctrl: nuvoton: use new pinctrl GPIO helpers
pinctrl: renesas: use new pinctrl GPIO helpers
pinctrl: bcm: use new pinctrl GPIO helpers
pinctrl: stm32: use new pinctrl GPIO helpers
pinctrl: spear: use new pinctrl GPIO helpers
pinctrl: starfive: use new pinctrl GPIO helpers
pinctrl: ocelot: use new pinctrl GPIO helpers
pinctrl: rk805: use new pinctrl GPIO helpers
pinctrl: cirrus: use new pinctrl GPIO helpers
pinctrl: mediatek: use new pinctrl GPIO helpers
pinctrl: axp209: use new pinctrl GPIO helpers
pinctrl: vt8500: use new pinctrl GPIO helpers
pinctrl: cy8c95x0: use new pinctrl GPIO helpers
pinctrl: as3722: use new pinctrl GPIO helpers
pinctrl: ingenic: use new pinctrl GPIO helpers
pinctrl: intel: use new pinctrl GPIO helpers
pinctrl: st: use new pinctrl GPIO helpers
pinctrl: remove old GPIO helpers
treewide: rename pinctrl_gpio_can_use_line_new()
treewide: rename pinctrl_gpio_request_new()
treewide: rename pinctrl_gpio_free_new()
treewide: rename pinctrl_gpio_direction_input_new()
treewide: rename pinctrl_gpio_direction_output_new()
treewide: rename pinctrl_gpio_set_config_new()

 drivers/gpio/gpio-aspeed.c                    |   6 +-
 drivers/gpio/gpio-em.c                        |   4 +-
 drivers/gpio/gpio-mvebu.c                     |   4 +-
 drivers/gpio/gpio-pxa.c                       |   4 +-
 drivers/gpio/gpio-rcar.c                      |   4 +-
 drivers/gpio/gpio-rockchip.c                  |   4 +-
 drivers/gpio/gpio-tegra.c                     |   8 +-
 drivers/gpio/gpio-vf610.c                     |   4 +-
 drivers/gpio/gpiolib-cdev.c                   |   3 +-
 drivers/gpio/gpiolib.c                        |   6 +-
 drivers/pinctrl/bcm/pinctrl-iproc-gpio.c      |   6 +-
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c      |   4 +-
 drivers/pinctrl/cirrus/pinctrl-lochnagar.c    |   2 +-
 drivers/pinctrl/core.c                        | 182 +++++++++---------
 drivers/pinctrl/intel/pinctrl-cherryview.c    |   4 +-
 drivers/pinctrl/intel/pinctrl-intel.c         |   4 +-
 drivers/pinctrl/intel/pinctrl-lynxpoint.c     |   4 +-
 drivers/pinctrl/mediatek/pinctrl-moore.c      |   4 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   4 +-
 drivers/pinctrl/mediatek/pinctrl-paris.c      |   4 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c     |   8 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c     |   8 +-
 drivers/pinctrl/pinctrl-as3722.c              |   4 +-
 drivers/pinctrl/pinctrl-axp209.c              |   2 +-
 drivers/pinctrl/pinctrl-cy8c95x0.c            |   4 +-
 drivers/pinctrl/pinctrl-ingenic.c             |  11 +-
 drivers/pinctrl/pinctrl-ocelot.c              |   4 +-
 drivers/pinctrl/pinctrl-rk805.c               |   4 +-
 drivers/pinctrl/pinctrl-st.c                  |   4 +-
 drivers/pinctrl/renesas/gpio.c                |   8 +-
 drivers/pinctrl/renesas/pinctrl-rzg2l.c       |   4 +-
 drivers/pinctrl/renesas/pinctrl-rzv2m.c       |   4 +-
 drivers/pinctrl/spear/pinctrl-plgpio.c        |   8 +-
 .../starfive/pinctrl-starfive-jh7100.c        |   4 +-
 .../starfive/pinctrl-starfive-jh7110.c        |   4 +-
 drivers/pinctrl/stm32/pinctrl-stm32.c         |   8 +-
 drivers/pinctrl/vt8500/pinctrl-wmt.c          |   4 +-
 include/linux/pinctrl/consumer.h              |  57 +++---
 38 files changed, 210 insertions(+), 205 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/36 pinctrl: remove unneeded extern specifiers from consumer.h

From: Bartosz Golaszewski <[email protected]>

The 'extern' specifiers are not needed for function declarations. Remove all of them from the pinctrl/consumer.h header.

---
 include/linux/pinctrl/consumer.h | 34 ++++++++++++++++----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
include/linux/pinctrl/consumer.h +17 -17
index 4729d54e8995..22eef0a513ce 100644
@@ -25,27 +25,27 @@ struct pinctrl_state;
 #ifdef CONFIG_PINCTRL
 
 /* External interface to pin control */
-extern bool pinctrl_gpio_can_use_line(unsigned gpio);
-extern int pinctrl_gpio_request(unsigned gpio);
-extern void pinctrl_gpio_free(unsigned gpio);
-extern int pinctrl_gpio_direction_input(unsigned gpio);
-extern int pinctrl_gpio_direction_output(unsigned gpio);
-extern int pinctrl_gpio_set_config(unsigned gpio, unsigned long config);
+bool pinctrl_gpio_can_use_line(unsigned gpio);
+int pinctrl_gpio_request(unsigned gpio);
+void pinctrl_gpio_free(unsigned gpio);
+int pinctrl_gpio_direction_input(unsigned gpio);
+int pinctrl_gpio_direction_output(unsigned gpio);
+int pinctrl_gpio_set_config(unsigned gpio, unsigned long config);
 
-extern struct pinctrl * __must_check pinctrl_get(struct device *dev);
-extern void pinctrl_put(struct pinctrl *p);
-extern struct pinctrl_state * __must_check pinctrl_lookup_state(struct pinctrl *p,
-								const char *name);
-extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
+struct pinctrl * __must_check pinctrl_get(struct device *dev);
+void pinctrl_put(struct pinctrl *p);
+struct pinctrl_state * __must_check pinctrl_lookup_state(struct pinctrl *p,
+							 const char *name);
+int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
 
-extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
-extern void devm_pinctrl_put(struct pinctrl *p);
-extern int pinctrl_select_default_state(struct device *dev);
+struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
+void devm_pinctrl_put(struct pinctrl *p);
+int pinctrl_select_default_state(struct device *dev);
 
 #ifdef CONFIG_PM
-extern int pinctrl_pm_select_default_state(struct device *dev);
-extern int pinctrl_pm_select_sleep_state(struct device *dev);
-extern int pinctrl_pm_select_idle_state(struct device *dev);
+int pinctrl_pm_select_default_state(struct device *dev);
+int pinctrl_pm_select_sleep_state(struct device *dev);
+int pinctrl_pm_select_idle_state(struct device *dev);
 #else
 static inline int pinctrl_pm_select_default_state(struct device *dev)
 {
Signature · 1 line
2.39.2
#3 lore raw

PATCH 2/36 pinctrl: provide new GPIO-to-pinctrl glue helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Currently the pinctrl GPIO helpers all take a number from the global GPIO numberspace - of which we're trying to get rid of as argument.

These helpers are almost universally called from GPIOLIB driver callbacks which take a pointer to the backing gpio_chip and the controller-relative offset as arguments.

Let's provide improved variants of these functions that match the GPIOLIB signatures as the first step in removing the older flavor.

---
 drivers/pinctrl/core.c           | 107 ++++++++++++++++++++++---------
 include/linux/pinctrl/consumer.h |  46 +++++++++++++
 2 files changed, 124 insertions(+), 29 deletions(-)
drivers/pinctrl/core.c +78 -29
index e2f7519bef04..679f48c5beeb 100644
@@ -23,6 +23,7 @@
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 
+#include <linux/gpio/driver.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pinctrl/devinfo.h>
 #include <linux/pinctrl/machine.h>
@@ -781,14 +782,13 @@ bool pinctrl_gpio_can_use_line(unsigned gpio)
 }
 EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line);
 
-/**
- * pinctrl_gpio_request() - request a single pin to be used as GPIO
- * @gpio: the GPIO pin number from the GPIO subsystem number space
- *
- * This function should *ONLY* be used from gpiolib-based GPIO drivers,
- * as part of their gpio_request() semantics, platforms and individual drivers
- * shall *NOT* request GPIO pins to be muxed in.
- */
+bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset)
+{
+	return pinctrl_gpio_can_use_line(gc->base + offset);
+}
+EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line_new);
+
+/* This function is deprecated and will be removed. Don't use. */
 int pinctrl_gpio_request(unsigned gpio)
 {
 	struct pinctrl_dev *pctldev;
@@ -817,13 +817,21 @@ int pinctrl_gpio_request(unsigned gpio)
 EXPORT_SYMBOL_GPL(pinctrl_gpio_request);
 
 /**
- * pinctrl_gpio_free() - free control on a single pin, currently used as GPIO
- * @gpio: the GPIO pin number from the GPIO subsystem number space
+ * pinctrl_gpio_request_new() - request a single pin to be used as GPIO
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
  *
  * This function should *ONLY* be used from gpiolib-based GPIO drivers,
- * as part of their gpio_free() semantics, platforms and individual drivers
- * shall *NOT* request GPIO pins to be muxed out.
+ * as part of their gpio_request() semantics, platforms and individual drivers
+ * shall *NOT* request GPIO pins to be muxed in.
  */
+int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset)
+{
+	return pinctrl_gpio_request(gc->base + offset);
+}
+EXPORT_SYMBOL_GPL(pinctrl_gpio_request_new);
+
+/* This function is deprecated and will be removed. Don't use. */
 void pinctrl_gpio_free(unsigned gpio)
 {
 	struct pinctrl_dev *pctldev;
@@ -846,6 +854,21 @@ void pinctrl_gpio_free(unsigned gpio)
 }
 EXPORT_SYMBOL_GPL(pinctrl_gpio_free);
 
+/**
+ * pinctrl_gpio_free_new() - free control on a single pin, currently used as GPIO
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
+ *
+ * This function should *ONLY* be used from gpiolib-based GPIO drivers,
+ * as part of their gpio_request() semantics, platforms and individual drivers
+ * shall *NOT* request GPIO pins to be muxed in.
+ */
+void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset)
+{
+	return pinctrl_gpio_free(gc->base + offset);
+}
+EXPORT_SYMBOL_GPL(pinctrl_gpio_free_new);
+
 static int pinctrl_gpio_direction(unsigned gpio, bool input)
 {
 	struct pinctrl_dev *pctldev;
@@ -869,14 +892,7 @@ static int pinctrl_gpio_direction(unsigned gpio, bool input)
 	return ret;
 }
 
-/**
- * pinctrl_gpio_direction_input() - request a GPIO pin to go into input mode
- * @gpio: the GPIO pin number from the GPIO subsystem number space
- *
- * This function should *ONLY* be used from gpiolib-based GPIO drivers,
- * as part of their gpio_direction_input() semantics, platforms and individual
- * drivers shall *NOT* touch pin control GPIO calls.
- */
+/* This function is deprecated and will be removed. Don't use. */
 int pinctrl_gpio_direction_input(unsigned gpio)
 {
 	return pinctrl_gpio_direction(gpio, true);
@@ -884,13 +900,21 @@ int pinctrl_gpio_direction_input(unsigned gpio)
 EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
 
 /**
- * pinctrl_gpio_direction_output() - request a GPIO pin to go into output mode
- * @gpio: the GPIO pin number from the GPIO subsystem number space
+ * pinctrl_gpio_direction_input_new() - request a GPIO pin to go into input mode
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
  *
  * This function should *ONLY* be used from gpiolib-based GPIO drivers,
- * as part of their gpio_direction_output() semantics, platforms and individual
+ * as part of their gpio_direction_input() semantics, platforms and individual
  * drivers shall *NOT* touch pin control GPIO calls.
  */
+int pinctrl_gpio_direction_input_new(struct gpio_chip *gc, unsigned int offset)
+{
+	return pinctrl_gpio_direction_input(gc->base + offset);
+}
+EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input_new);
+
+/* This function is deprecated and will be removed. Don't use. */
 int pinctrl_gpio_direction_output(unsigned gpio)
 {
 	return pinctrl_gpio_direction(gpio, false);
@@ -898,14 +922,22 @@ int pinctrl_gpio_direction_output(unsigned gpio)
 EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
 
 /**
- * pinctrl_gpio_set_config() - Apply config to given GPIO pin
- * @gpio: the GPIO pin number from the GPIO subsystem number space
- * @config: the configuration to apply to the GPIO
+ * pinctrl_gpio_direction_output_new() - request a GPIO pin to go into output
+ *                                       mode
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
  *
- * This function should *ONLY* be used from gpiolib-based GPIO drivers, if
- * they need to call the underlying pin controller to change GPIO config
- * (for example set debounce time).
+ * This function should *ONLY* be used from gpiolib-based GPIO drivers,
+ * as part of their gpio_direction_output() semantics, platforms and individual
+ * drivers shall *NOT* touch pin control GPIO calls.
  */
+int pinctrl_gpio_direction_output_new(struct gpio_chip *gc, unsigned int offset)
+{
+	return pinctrl_gpio_direction_output(gc->base + offset);
+}
+EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output_new);
+
+/* This function is deprecated and will be removed. Don't use. */
 int pinctrl_gpio_set_config(unsigned gpio, unsigned long config)
 {
 	unsigned long configs[] = { config };
@@ -926,6 +958,23 @@ int pinctrl_gpio_set_config(unsigned gpio, unsigned long config)
 }
 EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config);
 
+/**
+ * pinctrl_gpio_set_config_new() - Apply config to given GPIO pin
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
+ * @config: the configuration to apply to the GPIO
+ *
+ * This function should *ONLY* be used from gpiolib-based GPIO drivers, if
+ * they need to call the underlying pin controller to change GPIO config
+ * (for example set debounce time).
+ */
+int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
+				unsigned long config)
+{
+	return pinctrl_gpio_set_config(gc->base + offset, config);
+}
+EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config_new);
+
 static struct pinctrl_state *find_state(struct pinctrl *p,
 					const char *name)
 {
include/linux/pinctrl/consumer.h +46 -0

93 lines not on this page · raw message

Signature · 1 line
2.39.2
#4 lore raw

Re: [PATCH 02/36] pinctrl: provide new GPIO-to-pinctrl glue helpers

Quoted 12 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Currently the pinctrl GPIO helpers all take a number from the global GPIO numberspace - of which we're trying to get rid of as argument.

These helpers are almost universally called from GPIOLIB driver callbacks which take a pointer to the backing gpio_chip and the controller-relative offset as arguments.

Let's provide improved variants of these functions that match the GPIOLIB signatures as the first step in removing the older flavor.

...

Quoted 1 line

+#include <linux/gpio/driver.h>

+ blank line here

Quoted 3 lines

#include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/devinfo.h>
#include <linux/pinctrl/machine.h>

...

Quoted 3 lines

EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line);

+/* This function is deprecated and will be removed. Don't use. */

Shouldn't the same / similar comment be added to
pinctrl_gpio_can_use_line() above?

...

Quoted 1 line

+ * pinctrl_gpio_request_new() - request a single pin to be used as GPIO

"new" is too broad and too odd suffix, what I would see as a better alternative(s) is (are):

pinctrl_gpiochip_request()
pinctrl_gpio_chip_request()
pinctrl_gc_request()

(sorted by personal preference from high to low).

The similar comment to all of them.

...

Quoted 5 lines

* This function should *ONLY* be used from gpiolib-based GPIO drivers,
- * as part of their gpio_free() semantics, platforms and individual drivers
- * shall *NOT* request GPIO pins to be muxed out.
+ * as part of their gpio_request() semantics, platforms and individual drivers
+ * shall *NOT* request GPIO pins to be muxed in.

Hmm... This looks like a fix to the previous code that can even be backported.

Quoted 1 line

*/

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

Re: [PATCH 02/36] pinctrl: provide new GPIO-to-pinctrl glue helpers

Quoted 1 line · Andy Shevchenko

On Tue, Oct 3, 2023 at 5:51 PM Bartosz Golaszewski <[email protected]> wrote:

...

Quoted 5 lines
Quoted 1 line

+ * pinctrl_gpio_request_new() - request a single pin to be used as GPIO

"new" is too broad and too odd suffix, what I would see as a better alternative(s) is (are):

Quoted 7 lines

pinctrl_gpiochip_request()
pinctrl_gpio_chip_request()
pinctrl_gc_request()

(sorted by personal preference from high to low).

The similar comment to all of them.

Or since it's about the GPIO line

pinctrl_gpio_line_request()

(and other variants near to this).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

PATCH 3/36 gpiolib: generic: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpiolib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib.c +3 -3
index 7c27a1efc1b0..511f6220071d 100644
@@ -1854,7 +1854,7 @@ int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset)
 		return 0;
 #endif
 
-	return pinctrl_gpio_request(gc->gpiodev->base + offset);
+	return pinctrl_gpio_request_new(gc, offset);
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_request);
 
@@ -1870,7 +1870,7 @@ void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset)
 		return;
 #endif
 
-	pinctrl_gpio_free(gc->gpiodev->base + offset);
+	pinctrl_gpio_free_new(gc, offset);
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_free);
 
@@ -1883,7 +1883,7 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_free);
 int gpiochip_generic_config(struct gpio_chip *gc, unsigned int offset,
 			    unsigned long config)
 {
-	return pinctrl_gpio_set_config(gc->gpiodev->base + offset, config);
+	return pinctrl_gpio_set_config_new(gc, offset, config);
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_config);
 
Signature · 1 line
2.39.2
Reviewed-by on v1 3/36
#7 lore raw

Re: [PATCH 03/36] gpiolib: generic: use new pinctrl GPIO helpers

Quoted 6 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

With whatever name of the APIs at the end,

--
With Best Regards,
Andy Shevchenko

#8 lore raw

PATCH 4/36 gpio: cdev: use pinctrl_gpio_can_use_line_new()

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Use the improved variant of pinctrl_gpio_can_use_line() which takes a pointer to the gpio_chip and a controller-relative offset.

---
 drivers/gpio/gpiolib-cdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpiolib-cdev.c +1 -2
index 31fc71a612c2..54ee075410db 100644
@@ -2287,8 +2287,7 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
 	 * FIXME: find a non-racy way to retrieve this information. Maybe a
 	 * lock common to both frameworks?
 	 */
-	ok_for_pinctrl =
-		pinctrl_gpio_can_use_line(gc->base + info->offset);
+	ok_for_pinctrl = pinctrl_gpio_can_use_line_new(gc, info->offset);
 
 	spin_lock_irqsave(&gpio_lock, flags);
 
Signature · 1 line
2.39.2
reviewer
#9 lore raw

Re: [PATCH 04/36] gpio: cdev: use pinctrl_gpio_can_use_line_new()

Quoted 15 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Use the improved variant of pinctrl_gpio_can_use_line() which takes a pointer to the gpio_chip and a controller-relative offset.

---
 drivers/gpio/gpiolib-cdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpiolib-cdev.c +0 -0
index 31fc71a612c2..54ee075410db 100644

drivers/gpio/gpiolib-cdev.c static void gpio_desc_to_lineinfo(struct gpio_desc *desc, · line 2291

Quoted 7 lines
drivers/gpio/gpiolib-cdev.c +1 -2
@@ -2287,8 +2287,7 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
 	 * FIXME: find a non-racy way to retrieve this information. Maybe a
 	 * lock common to both frameworks?
 	 */
-	ok_for_pinctrl =
-		pinctrl_gpio_can_use_line(gc->base + info->offset);
+	ok_for_pinctrl = pinctrl_gpio_can_use_line_new(gc, info->offset);
 

_new?? In what sense?

I agree with the change in principle, just not comfortable with the naming.

Cheers,
Kent.

#10 lore raw

Re: [PATCH 04/36] gpio: cdev: use pinctrl_gpio_can_use_line_new()

Quoted 1 line · Kent Gibson

On Tue, Oct 03, 2023 at 04:50:42PM +0200, Bartosz Golaszewski wrote:

...

Quoted 1 line

I agree with the change in principle, just not comfortable with the naming.

+1 here. I proposed some names, have you seen my comment(s)?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
reviewer
#11 lore raw

Re: [PATCH 04/36] gpio: cdev: use pinctrl_gpio_can_use_line_new()

Quoted 9 lines · Andy Shevchenko
Quoted 1 line · Kent Gibson

On Tue, Oct 03, 2023 at 04:50:42PM +0200, Bartosz Golaszewski wrote:

...

Quoted 1 line

I agree with the change in principle, just not comfortable with the naming.

+1 here. I proposed some names, have you seen my comment(s)?

I have now - any of those work for me.
Whichever is consistent with what we are using for gpiochip functions in gpiolib would make most sense to me.

Cheers,
Kent.

#12 lore raw

Re: [PATCH 04/36] gpio: cdev: use pinctrl_gpio_can_use_line_new()

Quoted 7 lines · Kent Gibson
Quoted 5 lines · Andy Shevchenko
Quoted 1 line · Kent Gibson

On Tue, Oct 03, 2023 at 04:50:42PM +0200, Bartosz Golaszewski wrote:

...

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

I agree with the change in principle, just not comfortable with the naming.

+1 here. I proposed some names, have you seen my comment(s)?

I have now - any of those work for me.
Whichever is consistent with what we are using for gpiochip functions in gpiolib would make most sense to me.

Does it really matter? It's not here to stay, it's temporary and exists only until the whole series is applied - which given that it's limited to gpio and pinctrl, shouldn't take more than one release cycle.

There are plenty of examples of this naming convention for temporary symbols - there's even an ongoing effort to replace all .remove() callbacks with .remove_new() which will then be changed back to .remove() treewide.

Bart

reviewer
#13 lore raw

Re: [PATCH 04/36] gpio: cdev: use pinctrl_gpio_can_use_line_new()

Quoted 23 lines · Bartosz Golaszewski
Quoted 7 lines · Kent Gibson
Quoted 5 lines · Andy Shevchenko
Quoted 1 line · Kent Gibson

On Tue, Oct 03, 2023 at 04:50:42PM +0200, Bartosz Golaszewski wrote:

...

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

I agree with the change in principle, just not comfortable with the naming.

+1 here. I proposed some names, have you seen my comment(s)?

I have now - any of those work for me.
Whichever is consistent with what we are using for gpiochip functions in gpiolib would make most sense to me.

Does it really matter? It's not here to stay, it's temporary and exists only until the whole series is applied - which given that it's limited to gpio and pinctrl, shouldn't take more than one release cycle.

Quoted 5 lines

There are plenty of examples of this naming convention for temporary symbols - there's even an ongoing effort to replace all .remove() callbacks with .remove_new() which will then be changed back to .remove() treewide.

This was the only patch that I was included into, so I didn't realise there was a treewide rename at the end.
Even so, using _new suffix for that purpose is poor (well pinctrl_gpio_free_new() did draw a laugh, but other than that...). Perhaps use something specific to the patch series so it is clear what its purpose is?

Cheers,
Kent.

#14 lore raw

Re: [PATCH 04/36] gpio: cdev: use pinctrl_gpio_can_use_line_new()

Quoted 25 lines · Kent Gibson
Quoted 23 lines · Bartosz Golaszewski
Quoted 7 lines · Kent Gibson
Quoted 5 lines · Andy Shevchenko
Quoted 1 line · Kent Gibson

On Tue, Oct 03, 2023 at 04:50:42PM +0200, Bartosz Golaszewski wrote:

...

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

I agree with the change in principle, just not comfortable with the naming.

+1 here. I proposed some names, have you seen my comment(s)?

I have now - any of those work for me.
Whichever is consistent with what we are using for gpiochip functions in gpiolib would make most sense to me.

Does it really matter? It's not here to stay, it's temporary and exists only until the whole series is applied - which given that it's limited to gpio and pinctrl, shouldn't take more than one release cycle.

Quoted 8 lines
Quoted 5 lines

There are plenty of examples of this naming convention for temporary symbols - there's even an ongoing effort to replace all .remove() callbacks with .remove_new() which will then be changed back to .remove() treewide.

This was the only patch that I was included into, so I didn't realise there was a treewide rename at the end.

I didn't want to spam 20+ maintainers with the entire series of 36 patches. Should have probably Cc'ed everyone on the cover letter though.

Quoted 5 lines

Even so, using _new suffix for that purpose is poor (well pinctrl_gpio_free_new() did draw a laugh, but other than that...). Perhaps use something specific to the patch series so it is clear what its purpose is?

I think Linus will end up applying the entire series to his tree in one go in which case the name really doesn't matter. Do we really need to bikeshed about the name which will exist for as long as it takes to apply the series on his laptop? I much more care about preserving bisectability across the series which it does.

Bart

#15 lore raw

PATCH 5/36 gpio: rcar: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-rcar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-rcar.c +2 -2
index d8b1baae6357..47121e1a6d4e 100644
@@ -275,7 +275,7 @@ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
 		return error;
 	}
 
-	error = pinctrl_gpio_request(chip->base + offset);
+	error = pinctrl_gpio_request_new(chip, offset);
 	if (error)
 		pm_runtime_put(p->dev);
 
@@ -286,7 +286,7 @@ static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
 {
 	struct gpio_rcar_priv *p = gpiochip_get_data(chip);
 
-	pinctrl_gpio_free(chip->base + offset);
+	pinctrl_gpio_free_new(chip, offset);
 
 	/*
 	 * Set the GPIO as an input to ensure that the next GPIO request won't
Signature · 1 line
2.39.2
Reviewed-by Acked-by on v1 5/36
#16 lore raw

Re: [PATCH 05/36] gpio: rcar: use new pinctrl GPIO helpers

Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#17 lore raw

PATCH 6/36 gpio: tegra: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-tegra.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-tegra.c +4 -4
index ea715582bcf3..08951ddcd294 100644
@@ -139,14 +139,14 @@ static void tegra_gpio_disable(struct tegra_gpio_info *tgi, unsigned int gpio)
 
 static int tegra_gpio_request(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_request(chip->base + offset);
+	return pinctrl_gpio_request_new(chip, offset);
 }
 
 static void tegra_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
 	struct tegra_gpio_info *tgi = gpiochip_get_data(chip);
 
-	pinctrl_gpio_free(chip->base + offset);
+	pinctrl_gpio_free_new(chip, offset);
 	tegra_gpio_disable(tgi, offset);
 }
 
@@ -179,7 +179,7 @@ static int tegra_gpio_direction_input(struct gpio_chip *chip,
 	tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 0);
 	tegra_gpio_enable(tgi, offset);
 
-	ret = pinctrl_gpio_direction_input(chip->base + offset);
+	ret = pinctrl_gpio_direction_input_new(chip, offset);
 	if (ret < 0)
 		dev_err(tgi->dev,
 			"Failed to set pinctrl input direction of GPIO %d: %d",
@@ -199,7 +199,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip,
 	tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 1);
 	tegra_gpio_enable(tgi, offset);
 
-	ret = pinctrl_gpio_direction_output(chip->base + offset);
+	ret = pinctrl_gpio_direction_output_new(chip, offset);
 	if (ret < 0)
 		dev_err(tgi->dev,
 			"Failed to set pinctrl output direction of GPIO %d: %d",
Signature · 1 line
2.39.2
#18 lore raw

PATCH 7/36 gpio: em: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-em.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-em.c +2 -2
index 858e6ebbb584..35c65ff43f71 100644
@@ -229,12 +229,12 @@ static int em_gio_to_irq(struct gpio_chip *chip, unsigned offset)
 
 static int em_gio_request(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_request(chip->base + offset);
+	return pinctrl_gpio_request_new(chip, offset);
 }
 
 static void em_gio_free(struct gpio_chip *chip, unsigned offset)
 {
-	pinctrl_gpio_free(chip->base + offset);
+	pinctrl_gpio_free_new(chip, offset);
 
 	/* Set the GPIO as an input to ensure that the next GPIO request won't
 	* drive the GPIO pin as an output.
Signature · 1 line
2.39.2
#19 lore raw

PATCH 8/36 gpio: aspeed: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-aspeed.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-aspeed.c +3 -3
index da33bbbdacb9..d3aa1cfd4ace 100644
@@ -750,12 +750,12 @@ static int aspeed_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	if (!have_gpio(gpiochip_get_data(chip), offset))
 		return -ENODEV;
 
-	return pinctrl_gpio_request(chip->base + offset);
+	return pinctrl_gpio_request_new(chip, offset);
 }
 
 static void aspeed_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-	pinctrl_gpio_free(chip->base + offset);
+	pinctrl_gpio_free_new(chip, offset);
 }
 
 static int usecs_to_cycles(struct aspeed_gpio *gpio, unsigned long usecs,
@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
 	else if (param == PIN_CONFIG_BIAS_DISABLE ||
 			param == PIN_CONFIG_BIAS_PULL_DOWN ||
 			param == PIN_CONFIG_DRIVE_STRENGTH)
-		return pinctrl_gpio_set_config(offset, config);
+		return pinctrl_gpio_set_config_new(chip, offset, config);
 	else if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN ||
 			param == PIN_CONFIG_DRIVE_OPEN_SOURCE)
 		/* Return -ENOTSUPP to trigger emulation, as per datasheet */
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 8/36
#20 lore raw

Re: [PATCH 08/36] gpio: aspeed: use new pinctrl GPIO helpers

Quoted 31 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-aspeed.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-aspeed.c +2 -2
index da33bbbdacb9..d3aa1cfd4ace 100644
@@ -750,12 +750,12 @@ static int aspeed_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	if (!have_gpio(gpiochip_get_data(chip), offset))
 		return -ENODEV;
 
-	return pinctrl_gpio_request(chip->base + offset);
+	return pinctrl_gpio_request_new(chip, offset);
 }
 
 static void aspeed_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-	pinctrl_gpio_free(chip->base + offset);
+	pinctrl_gpio_free_new(chip, offset);
 }
 
 static int usecs_to_cycles(struct aspeed_gpio *gpio, unsigned long usecs,

drivers/gpio/gpio-aspeed.c static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset, · line 976

Quoted 5 lines
drivers/gpio/gpio-aspeed.c +1 -1
@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
 	else if (param == PIN_CONFIG_BIAS_DISABLE ||
 			param == PIN_CONFIG_BIAS_PULL_DOWN ||
 			param == PIN_CONFIG_DRIVE_STRENGTH)
-		return pinctrl_gpio_set_config(offset, config);
+		return pinctrl_gpio_set_config_new(chip, offset, config);

Ah, this looks like it removes a bug too. Nice.

Quoted 3 lines
drivers/gpio/gpio-aspeed.c +0 -0
 	else if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN ||
 			param == PIN_CONFIG_DRIVE_OPEN_SOURCE)
 		/* Return -ENOTSUPP to trigger emulation, as per datasheet */
#21 lore raw

Re: [PATCH 08/36] gpio: aspeed: use new pinctrl GPIO helpers

Quoted 41 lines · On Wed, Oct 4, 2023 at 1:30?AM Andrew Jeffery <[email protected]>…
Quoted 31 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-aspeed.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-aspeed.c +2 -2
index da33bbbdacb9..d3aa1cfd4ace 100644
@@ -750,12 +750,12 @@ static int aspeed_gpio_request(struct gpio_chip *chip, unsigned int offset)
      if (!have_gpio(gpiochip_get_data(chip), offset))
              return -ENODEV;
 
-     return pinctrl_gpio_request(chip->base + offset);
+     return pinctrl_gpio_request_new(chip, offset);
 }
 
 static void aspeed_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-     pinctrl_gpio_free(chip->base + offset);
+     pinctrl_gpio_free_new(chip, offset);
 }
 
 static int usecs_to_cycles(struct aspeed_gpio *gpio, unsigned long usecs,

drivers/gpio/gpio-aspeed.c static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset, · line 976

Quoted 5 lines
drivers/gpio/gpio-aspeed.c +1 -1
@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
      else if (param == PIN_CONFIG_BIAS_DISABLE ||
                      param == PIN_CONFIG_BIAS_PULL_DOWN ||
                      param == PIN_CONFIG_DRIVE_STRENGTH)
-             return pinctrl_gpio_set_config(offset, config);
+             return pinctrl_gpio_set_config_new(chip, offset, config);

Ah, this looks like it removes a bug too. Nice.

Quoted 6 lines
Quoted 3 lines
drivers/gpio/gpio-aspeed.c +0 -0
      else if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN ||
                      param == PIN_CONFIG_DRIVE_OPEN_SOURCE)
              /* Return -ENOTSUPP to trigger emulation, as per datasheet */

I sent a separate patch that fixes this issue for backporting, once the other one is in next, we can update this series.

Bart

Acked-by on v1 8/36
#22 lore raw

Re: [PATCH 08/36] gpio: aspeed: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski
Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

LGTM,

Thanks
Uwe

Signature · 9 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20231009/ec9612e6/attachment.sig>
#23 lore raw

PATCH 9/36 gpio: mvebu: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-mvebu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mvebu.c +2 -2
index 67497116ce27..8fada9cd258a 100644
@@ -345,7 +345,7 @@ static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned int pin)
 	 * Check with the pinctrl driver whether this pin is usable as
 	 * an input GPIO
 	 */
-	ret = pinctrl_gpio_direction_input(chip->base + pin);
+	ret = pinctrl_gpio_direction_input_new(chip, pin);
 	if (ret)
 		return ret;
 
@@ -365,7 +365,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
 	 * Check with the pinctrl driver whether this pin is usable as
 	 * an output GPIO
 	 */
-	ret = pinctrl_gpio_direction_output(chip->base + pin);
+	ret = pinctrl_gpio_direction_output_new(chip, pin);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.39.2
Acked-by on v1 9/36
#24 lore raw

Re: [PATCH 09/36] gpio: mvebu: use new pinctrl GPIO helpers

Hello Bartosz,

Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

Looks good (after I found the cover letter which luckily is easy).

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#25 lore raw

PATCH 10/36 gpio: pxa: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-pxa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-pxa.c +2 -2
index cae9661862fe..2fd797b91270 100644
@@ -260,7 +260,7 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 	int ret;
 
 	if (pxa_gpio_has_pinctrl()) {
-		ret = pinctrl_gpio_direction_input(chip->base + offset);
+		ret = pinctrl_gpio_direction_input_new(chip, offset);
 		if (ret)
 			return ret;
 	}
@@ -289,7 +289,7 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
 	writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
 
 	if (pxa_gpio_has_pinctrl()) {
-		ret = pinctrl_gpio_direction_output(chip->base + offset);
+		ret = pinctrl_gpio_direction_output_new(chip, offset);
 		if (ret)
 			return ret;
 	}
Signature · 1 line
2.39.2
#26 lore raw

PATCH 11/36 gpio: rockchip: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-rockchip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-rockchip.c +2 -2
index 23040a8cea34..3576793f0bd9 100644
@@ -159,9 +159,9 @@ static int rockchip_gpio_set_direction(struct gpio_chip *chip,
 
 
 	if (input)
-		pinctrl_gpio_direction_input(bank->pin_base + offset);
+		pinctrl_gpio_direction_input_new(chip, offset);
 	else
-		pinctrl_gpio_direction_output(bank->pin_base + offset);
+		pinctrl_gpio_direction_output_new(chip, offset);
 
 	raw_spin_lock_irqsave(&bank->slock, flags);
 	rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr);
Signature · 1 line
2.39.2
maintainer Acked-by on v1 11/36
#27 lore raw

Re: [PATCH 11/36] gpio: rockchip: use new pinctrl GPIO helpers

Am Dienstag, 3. Oktober 2023, 16:50:49 CEST schrieb Bartosz Golaszewski:

Quoted 7 lines

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#28 lore raw

PATCH 12/36 gpio: vf610: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/gpio/gpio-vf610.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-vf610.c +2 -2
index dbc7ba0ee72c..32142b9564f9 100644
@@ -116,7 +116,7 @@ static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
 		vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
 	}
 
-	return pinctrl_gpio_direction_input(chip->base + gpio);
+	return pinctrl_gpio_direction_input_new(chip, gpio);
 }
 
 static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
@@ -134,7 +134,7 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
 
 	vf610_gpio_set(chip, gpio, value);
 
-	return pinctrl_gpio_direction_output(chip->base + gpio);
+	return pinctrl_gpio_direction_output_new(chip, gpio);
 }
 
 static void vf610_gpio_irq_handler(struct irq_desc *desc)
Signature · 1 line
2.39.2
#29 lore raw

PATCH 13/36 pinctrl: nuvoton: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 8 ++++----
 drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +4 -4
index 8bdd0124e2eb..62134a7f0b4e 100644
@@ -171,7 +171,7 @@ static int npcmgpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 	struct npcm7xx_gpio *bank = gpiochip_get_data(chip);
 	int ret;
 
-	ret = pinctrl_gpio_direction_input(offset + chip->base);
+	ret = pinctrl_gpio_direction_input_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -188,7 +188,7 @@ static int npcmgpio_direction_output(struct gpio_chip *chip,
 	dev_dbg(chip->parent, "gpio_direction_output: offset%d = %x\n", offset,
 		value);
 
-	ret = pinctrl_gpio_direction_output(offset + chip->base);
+	ret = pinctrl_gpio_direction_output_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -201,7 +201,7 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	int ret;
 
 	dev_dbg(chip->parent, "gpio_request: offset%d\n", offset);
-	ret = pinctrl_gpio_request(offset + chip->base);
+	ret = pinctrl_gpio_request_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -211,7 +211,7 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
 static void npcmgpio_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
 	dev_dbg(chip->parent, "gpio_free: offset%d\n", offset);
-	pinctrl_gpio_free(offset + chip->base);
+	pinctrl_gpio_free_new(chip, offset);
 }
 
 static void npcmgpio_irq_handler(struct irq_desc *desc)
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c +4 -4
index da21f6a45888..0b6d6964087e 100644
@@ -173,7 +173,7 @@ static int npcmgpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 	struct npcm8xx_gpio *bank = gpiochip_get_data(chip);
 	int ret;
 
-	ret = pinctrl_gpio_direction_input(offset + chip->base);
+	ret = pinctrl_gpio_direction_input_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -186,7 +186,7 @@ static int npcmgpio_direction_output(struct gpio_chip *chip,
 	struct npcm8xx_gpio *bank = gpiochip_get_data(chip);
 	int ret;
 
-	ret = pinctrl_gpio_direction_output(offset + chip->base);
+	ret = pinctrl_gpio_direction_output_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -198,7 +198,7 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	struct npcm8xx_gpio *bank = gpiochip_get_data(chip);
 	int ret;
 
-	ret = pinctrl_gpio_request(offset + chip->base);
+	ret = pinctrl_gpio_request_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -207,7 +207,7 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
 
 static void npcmgpio_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-	pinctrl_gpio_free(offset + chip->base);
+	pinctrl_gpio_free_new(chip, offset);
 }
 
 static void npcmgpio_irq_handler(struct irq_desc *desc)
Signature · 1 line
2.39.2
#30 lore raw

PATCH 14/36 pinctrl: renesas: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/renesas/gpio.c          | 8 ++++----
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 4 ++--
 drivers/pinctrl/renesas/pinctrl-rzv2m.c | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/pinctrl/renesas/gpio.c +4 -4
index 5758daf94fe2..e7771a57e6d1 100644
@@ -135,12 +135,12 @@ static int gpio_pin_request(struct gpio_chip *gc, unsigned offset)
 	if (idx < 0 || pfc->info->pins[idx].enum_id == 0)
 		return -EINVAL;
 
-	return pinctrl_gpio_request(gc->base + offset);
+	return pinctrl_gpio_request_new(gc, offset);
 }
 
 static void gpio_pin_free(struct gpio_chip *gc, unsigned offset)
 {
-	return pinctrl_gpio_free(gc->base + offset);
+	return pinctrl_gpio_free_new(gc, offset);
 }
 
 static void gpio_pin_set_value(struct sh_pfc_chip *chip, unsigned offset,
@@ -164,7 +164,7 @@ static void gpio_pin_set_value(struct sh_pfc_chip *chip, unsigned offset,
 
 static int gpio_pin_direction_input(struct gpio_chip *gc, unsigned offset)
 {
-	return pinctrl_gpio_direction_input(gc->base + offset);
+	return pinctrl_gpio_direction_input_new(gc, offset);
 }
 
 static int gpio_pin_direction_output(struct gpio_chip *gc, unsigned offset,
@@ -172,7 +172,7 @@ static int gpio_pin_direction_output(struct gpio_chip *gc, unsigned offset,
 {
 	gpio_pin_set_value(gpiochip_get_data(gc), offset, value);
 
-	return pinctrl_gpio_direction_output(gc->base + offset);
+	return pinctrl_gpio_direction_output_new(gc, offset);
 }
 
 static int gpio_pin_get(struct gpio_chip *gc, unsigned offset)
drivers/pinctrl/renesas/pinctrl-rzg2l.c +2 -2
index 03b36c6b2b6d..b9195fff0abd 100644
@@ -801,7 +801,7 @@ static int rzg2l_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	u8 reg8;
 	int ret;
 
-	ret = pinctrl_gpio_request(chip->base + offset);
+	ret = pinctrl_gpio_request_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -920,7 +920,7 @@ static void rzg2l_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
 	unsigned int virq;
 
-	pinctrl_gpio_free(chip->base + offset);
+	pinctrl_gpio_free_new(chip, offset);
 
 	virq = irq_find_mapping(chip->irq.domain, offset);
 	if (virq)
drivers/pinctrl/renesas/pinctrl-rzv2m.c +2 -2
index 52aeafaba4b6..3d29c77a5aad 100644
@@ -754,7 +754,7 @@ static int rzv2m_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	u8 bit = RZV2M_PIN_ID_TO_PIN(offset);
 	int ret;
 
-	ret = pinctrl_gpio_request(chip->base + offset);
+	ret = pinctrl_gpio_request_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -832,7 +832,7 @@ static int rzv2m_gpio_get(struct gpio_chip *chip, unsigned int offset)
 
 static void rzv2m_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-	pinctrl_gpio_free(chip->base + offset);
+	pinctrl_gpio_free_new(chip, offset);
 
 	/*
 	 * Set the GPIO as an input to ensure that the next GPIO request won't
Signature · 1 line
2.39.2
Reviewed-by Acked-by on v1 14/36
#31 lore raw

Re: [PATCH 14/36] pinctrl: renesas: use new pinctrl GPIO helpers

Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#32 lore raw

PATCH 15/36 pinctrl: bcm: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +2 -4
index bc7bb9876e57..fb98c3e14743 100644
@@ -330,24 +330,22 @@ static const struct irq_chip iproc_gpio_irq_chip = {
 static int iproc_gpio_request(struct gpio_chip *gc, unsigned offset)
 {
 	struct iproc_gpio *chip = gpiochip_get_data(gc);
-	unsigned gpio = gc->base + offset;
 
 	/* not all Iproc GPIO pins can be muxed individually */
 	if (!chip->pinmux_is_supported)
 		return 0;
 
-	return pinctrl_gpio_request(gpio);
+	return pinctrl_gpio_request_new(gc, offset);
 }
 
 static void iproc_gpio_free(struct gpio_chip *gc, unsigned offset)
 {
 	struct iproc_gpio *chip = gpiochip_get_data(gc);
-	unsigned gpio = gc->base + offset;
 
 	if (!chip->pinmux_is_supported)
 		return;
 
-	pinctrl_gpio_free(gpio);
+	pinctrl_gpio_free_new(gc, offset);
 }
 
 static int iproc_gpio_direction_input(struct gpio_chip *gc, unsigned gpio)
Signature · 1 line
2.39.2
#33 lore raw

PATCH 16/36 pinctrl: stm32: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +4 -4
index a73385a431de..11d9f07934bd 100644
@@ -217,12 +217,12 @@ static int stm32_gpio_request(struct gpio_chip *chip, unsigned offset)
 		return -EINVAL;
 	}
 
-	return pinctrl_gpio_request(chip->base + offset);
+	return pinctrl_gpio_request_new(chip, offset);
 }
 
 static void stm32_gpio_free(struct gpio_chip *chip, unsigned offset)
 {
-	pinctrl_gpio_free(chip->base + offset);
+	pinctrl_gpio_free_new(chip, offset);
 }
 
 static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -241,7 +241,7 @@ static void stm32_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int stm32_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int stm32_gpio_direction_output(struct gpio_chip *chip,
@@ -250,7 +250,7 @@ static int stm32_gpio_direction_output(struct gpio_chip *chip,
 	struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
 
 	__stm32_gpio_set(bank, offset, value);
-	pinctrl_gpio_direction_output(chip->base + offset);
+	pinctrl_gpio_direction_output_new(chip, offset);
 
 	return 0;
 }
Signature · 1 line
2.39.2
#34 lore raw

PATCH 17/36 pinctrl: spear: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/spear/pinctrl-plgpio.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pinctrl/spear/pinctrl-plgpio.c +3 -5
index 722681e0b89b..7488f6394318 100644
@@ -204,14 +204,13 @@ static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
 static int plgpio_request(struct gpio_chip *chip, unsigned offset)
 {
 	struct plgpio *plgpio = gpiochip_get_data(chip);
-	int gpio = chip->base + offset;
 	unsigned long flags;
 	int ret = 0;
 
 	if (offset >= chip->ngpio)
 		return -EINVAL;
 
-	ret = pinctrl_gpio_request(gpio);
+	ret = pinctrl_gpio_request_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -249,14 +248,13 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)
 	if (!IS_ERR(plgpio->clk))
 		clk_disable(plgpio->clk);
 err0:
-	pinctrl_gpio_free(gpio);
+	pinctrl_gpio_free_new(chip, offset);
 	return ret;
 }
 
 static void plgpio_free(struct gpio_chip *chip, unsigned offset)
 {
 	struct plgpio *plgpio = gpiochip_get_data(chip);
-	int gpio = chip->base + offset;
 	unsigned long flags;
 
 	if (offset >= chip->ngpio)
@@ -280,7 +278,7 @@ static void plgpio_free(struct gpio_chip *chip, unsigned offset)
 	if (!IS_ERR(plgpio->clk))
 		clk_disable(plgpio->clk);
 
-	pinctrl_gpio_free(gpio);
+	pinctrl_gpio_free_new(chip, offset);
 }
 
 /* PLGPIO IRQ */
Signature · 1 line
2.39.2
Acked-by on v1 17/36
#35 lore raw

Re: [PATCH 17/36] pinctrl: spear: use new pinctrl GPIO helpers

Quoted 48 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/spear/pinctrl-plgpio.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pinctrl/spear/pinctrl-plgpio.c +2 -4
index 722681e0b89b..7488f6394318 100644
@@ -204,14 +204,13 @@ static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
 static int plgpio_request(struct gpio_chip *chip, unsigned offset)
 {
 	struct plgpio *plgpio = gpiochip_get_data(chip);
-	int gpio = chip->base + offset;
 	unsigned long flags;
 	int ret = 0;
 
 	if (offset >= chip->ngpio)
 		return -EINVAL;
 
-	ret = pinctrl_gpio_request(gpio);
+	ret = pinctrl_gpio_request_new(chip, offset);
 	if (ret)
 		return ret;
 
@@ -249,14 +248,13 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)
 	if (!IS_ERR(plgpio->clk))
 		clk_disable(plgpio->clk);
 err0:
-	pinctrl_gpio_free(gpio);
+	pinctrl_gpio_free_new(chip, offset);
 	return ret;
 }
 
 static void plgpio_free(struct gpio_chip *chip, unsigned offset)
 {
 	struct plgpio *plgpio = gpiochip_get_data(chip);
-	int gpio = chip->base + offset;
 	unsigned long flags;
 
 	if (offset >= chip->ngpio)

drivers/pinctrl/spear/pinctrl-plgpio.c static void plgpio_free(struct gpio_chip *chip, unsigned offset) · line 282

Quoted 6 lines
drivers/pinctrl/spear/pinctrl-plgpio.c +1 -1
@@ -280,7 +278,7 @@ static void plgpio_free(struct gpio_chip *chip, unsigned offset)
 	if (!IS_ERR(plgpio->clk))
 		clk_disable(plgpio->clk);
 
-	pinctrl_gpio_free(gpio);
+	pinctrl_gpio_free_new(chip, offset);
 }
Signature · 1 line
viresh
#36 lore raw

Re: [PATCH 17/36] pinctrl: spear: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski
This patch was applied to soc/soc.git (arm/fixes) by Bartosz Golaszewski <[email protected]>:

Hello:

This patch was applied to soc/soc.git (arm/fixes) by Bartosz Golaszewski <[email protected]>:

Quoted 9 lines · On Tue, 3 Oct 2023 16:50:55 +0200 you wrote:

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

[...]

Here is the summary with links:
- [17/36] pinctrl: spear: use new pinctrl GPIO helpers

    https://git.kernel.org/soc/soc/c/a3305049053a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#37 lore raw

PATCH 18/36 pinctrl: starfive: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 4 ++--
 drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +2 -2
index 530fe340a9a1..22a2db8fa315 100644
@@ -918,12 +918,12 @@ static struct pinctrl_desc starfive_desc = {
 
 static int starfive_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 {
-	return pinctrl_gpio_request(gc->base + gpio);
+	return pinctrl_gpio_request_new(gc, gpio);
 }
 
 static void starfive_gpio_free(struct gpio_chip *gc, unsigned int gpio)
 {
-	pinctrl_gpio_free(gc->base + gpio);
+	pinctrl_gpio_free_new(gc, gpio);
 }
 
 static int starfive_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +2 -2
index 640f827a9b2c..5557ef3fbeb2 100644
@@ -547,12 +547,12 @@ static const struct pinconf_ops jh7110_pinconf_ops = {
 
 static int jh7110_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 {
-	return pinctrl_gpio_request(gc->base + gpio);
+	return pinctrl_gpio_request_new(gc, gpio);
 }
 
 static void jh7110_gpio_free(struct gpio_chip *gc, unsigned int gpio)
 {
-	pinctrl_gpio_free(gc->base + gpio);
+	pinctrl_gpio_free_new(gc, gpio);
 }
 
 static int jh7110_gpio_get_direction(struct gpio_chip *gc,
Signature · 1 line
2.39.2
#38 lore raw

Re: [PATCH 18/36] pinctrl: starfive: use new pinctrl GPIO helpers

Quoted 18 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 4 ++--
 drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +0 -0
index 530fe340a9a1..22a2db8fa315 100644
@@ -918,12 +918,12 @@ static struct pinctrl_desc starfive_desc = {
 

drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c static struct pinctrl_desc starfive_desc = { · line 926

Quoted 10 lines
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +2 -2
 static int starfive_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 {
-	return pinctrl_gpio_request(gc->base + gpio);
+	return pinctrl_gpio_request_new(gc, gpio);
 }
 
 static void starfive_gpio_free(struct gpio_chip *gc, unsigned int gpio)
 {
-	pinctrl_gpio_free(gc->base + gpio);
+	pinctrl_gpio_free_new(gc, gpio);

Hi Bartosz,

Thank you for the patch. These new pinctrl_gpio_*_new() functions now seem to have the same signature as the starfive_gpio_*() functions. Is there a reason they can't be used as callbacks directly so we could just delete the starfive_gpio_*() wrapppers?

Also it'd be great to be to be CC'd on at least the first generic patches where the new functions are introduced to have some context without having to look it up on lore.

/Emil

Quoted 24 lines
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +0 -0
 }
 
 static int starfive_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +2 -3
index 640f827a9b2c..5557ef3fbeb2 100644
@@ -547,12 +547,12 @@ static const struct pinconf_ops jh7110_pinconf_ops = {
 
 static int jh7110_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 {
-	return pinctrl_gpio_request(gc->base + gpio);
+	return pinctrl_gpio_request_new(gc, gpio);
 }
 
 static void jh7110_gpio_free(struct gpio_chip *gc, unsigned int gpio)
 {
-	pinctrl_gpio_free(gc->base + gpio);
+	pinctrl_gpio_free_new(gc, gpio);
 }
 
 static int jh7110_gpio_get_direction(struct gpio_chip *gc,
--

2.39.2

#39 lore raw

Re: [PATCH 18/36] pinctrl: starfive: use new pinctrl GPIO helpers

Quoted 33 lines · Emil Renner Berthing
Quoted 18 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 4 ++--
 drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +0 -0
index 530fe340a9a1..22a2db8fa315 100644
@@ -918,12 +918,12 @@ static struct pinctrl_desc starfive_desc = {
 

drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c static struct pinctrl_desc starfive_desc = { · line 926

Quoted 10 lines
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +2 -2
 static int starfive_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 {
-     return pinctrl_gpio_request(gc->base + gpio);
+     return pinctrl_gpio_request_new(gc, gpio);
 }
 
 static void starfive_gpio_free(struct gpio_chip *gc, unsigned int gpio)
 {
-     pinctrl_gpio_free(gc->base + gpio);
+     pinctrl_gpio_free_new(gc, gpio);

Hi Bartosz,

Quoted 4 lines

Thank you for the patch. These new pinctrl_gpio_*_new() functions now seem to have the same signature as the starfive_gpio_*() functions. Is there a reason they can't be used as callbacks directly so we could just delete the starfive_gpio_*() wrapppers?

Ha! Make sense and it'll probably apply to more users.

Quoted 5 lines

Also it'd be great to be to be CC'd on at least the first generic patches where the new functions are introduced to have some context without having to look it up on lore.

I wanted to reduce noise for maintainers but ended up introducing confusion. I will probably just send the v2 to everyone so proper context.

Bart

Quoted 26 lines

/Emil

Quoted 24 lines
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +0 -0
 }
 
 static int starfive_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +2 -3
index 640f827a9b2c..5557ef3fbeb2 100644
@@ -547,12 +547,12 @@ static const struct pinconf_ops jh7110_pinconf_ops = {
 
 static int jh7110_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 {
-     return pinctrl_gpio_request(gc->base + gpio);
+     return pinctrl_gpio_request_new(gc, gpio);
 }
 
 static void jh7110_gpio_free(struct gpio_chip *gc, unsigned int gpio)
 {
-     pinctrl_gpio_free(gc->base + gpio);
+     pinctrl_gpio_free_new(gc, gpio);
 }
 
 static int jh7110_gpio_get_direction(struct gpio_chip *gc,
--

2.39.2

#40 lore raw

PATCH 19/36 pinctrl: ocelot: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/pinctrl-ocelot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-ocelot.c +2 -2
index f8ae2e974221..a6022d44ad6c 100644
@@ -1779,7 +1779,7 @@ static int ocelot_gpio_get_direction(struct gpio_chip *chip,
 static int ocelot_gpio_direction_input(struct gpio_chip *chip,
 				       unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int ocelot_gpio_direction_output(struct gpio_chip *chip,
@@ -1795,7 +1795,7 @@ static int ocelot_gpio_direction_output(struct gpio_chip *chip,
 		regmap_write(info->map, REG(OCELOT_GPIO_OUT_CLR, info, offset),
 			     pin);
 
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static const struct gpio_chip ocelot_gpiolib_chip = {
Signature · 1 line
2.39.2
#41 lore raw

PATCH 20/36 pinctrl: rk805: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/pinctrl-rk805.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-rk805.c +2 -2
index 2639a9ee82cd..58e6dd932bc7 100644
@@ -289,14 +289,14 @@ static void rk805_gpio_set(struct gpio_chip *chip,
 static int rk805_gpio_direction_input(struct gpio_chip *chip,
 				      unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int rk805_gpio_direction_output(struct gpio_chip *chip,
 				       unsigned int offset, int value)
 {
 	rk805_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static int rk805_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
Signature · 1 line
2.39.2
#42 lore raw

PATCH 21/36 pinctrl: cirrus: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c   | 4 ++--
 drivers/pinctrl/cirrus/pinctrl-lochnagar.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/cirrus/pinctrl-cs42l43.c +2 -2
index c09646318419..097e4dcdda36 100644
@@ -508,7 +508,7 @@ static void cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset, int va
 
 static int cs42l43_gpio_direction_in(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
@@ -516,7 +516,7 @@ static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
 {
 	cs42l43_gpio_set(chip, offset, value);
 
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static int cs42l43_gpio_add_pin_ranges(struct gpio_chip *chip)
drivers/pinctrl/cirrus/pinctrl-lochnagar.c +1 -1
index 0b78cf611afe..f3c8a8c14e14 100644
@@ -1098,7 +1098,7 @@ static int lochnagar_gpio_direction_out(struct gpio_chip *chip,
 {
 	lochnagar_gpio_set(chip, offset, value);
 
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static int lochnagar_fill_func_groups(struct lochnagar_pin_priv *priv)
Signature · 1 line
2.39.2
maintainer Acked-by on v1 21/36
#43 lore raw

Re: [PATCH 21/36] pinctrl: cirrus: use new pinctrl GPIO helpers

Quoted 8 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---

Thanks,
Charles

#44 lore raw

PATCH 22/36 pinctrl: mediatek: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/mediatek/pinctrl-moore.c      | 4 ++--
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 ++--
 drivers/pinctrl/mediatek/pinctrl-paris.c      | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/pinctrl/mediatek/pinctrl-moore.c +2 -2
index 889469c7ac26..dc41ffa31357 100644
@@ -512,7 +512,7 @@ static void mtk_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
 
 static int mtk_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio)
 {
-	return pinctrl_gpio_direction_input(chip->base + gpio);
+	return pinctrl_gpio_direction_input_new(chip, gpio);
 }
 
 static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
@@ -520,7 +520,7 @@ static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
 {
 	mtk_gpio_set(chip, gpio, value);
 
-	return pinctrl_gpio_direction_output(chip->base + gpio);
+	return pinctrl_gpio_direction_output_new(chip, gpio);
 }
 
 static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
drivers/pinctrl/mediatek/pinctrl-mtk-common.c +2 -2
index 74b15952b742..fc046415b567 100644
@@ -811,14 +811,14 @@ static const struct pinmux_ops mtk_pmx_ops = {
 static int mtk_gpio_direction_input(struct gpio_chip *chip,
 					unsigned offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int mtk_gpio_direction_output(struct gpio_chip *chip,
 					unsigned offset, int value)
 {
 	mtk_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static int mtk_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
drivers/pinctrl/mediatek/pinctrl-paris.c +2 -2
index b7cb5a1f1060..14b151aec2f9 100644
@@ -916,7 +916,7 @@ static int mtk_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio)
 	if (gpio >= hw->soc->npins)
 		return -EINVAL;
 
-	return pinctrl_gpio_direction_input(chip->base + gpio);
+	return pinctrl_gpio_direction_input_new(chip, gpio);
 }
 
 static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
@@ -929,7 +929,7 @@ static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
 
 	mtk_gpio_set(chip, gpio, value);
 
-	return pinctrl_gpio_direction_output(chip->base + gpio);
+	return pinctrl_gpio_direction_output_new(chip, gpio);
 }
 
 static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
Signature · 1 line
2.39.2
#45 lore raw

PATCH 23/36 pinctrl: axp209: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/pinctrl-axp209.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-axp209.c +1 -1
index 9f5b3ab8e184..d7f081f1d1f6 100644
@@ -126,7 +126,7 @@ static int axp20x_gpio_get_reg(unsigned int offset)
 
 static int axp20x_gpio_input(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset)
Signature · 1 line
2.39.2
#46 lore raw

PATCH 24/36 pinctrl: vt8500: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/vt8500/pinctrl-wmt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/vt8500/pinctrl-wmt.c +2 -2
index 6fac30de1c6a..1a313295611e 100644
@@ -528,14 +528,14 @@ static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset,
 
 static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
 				     int value)
 {
 	wmt_gpio_set_value(chip, offset, value);
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static const struct gpio_chip wmt_gpio_chip = {
Signature · 1 line
2.39.2
#47 lore raw

PATCH 25/36 pinctrl: cy8c95x0: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/pinctrl-cy8c95x0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +2 -2
index fae80b52a6fc..8c6006353515 100644
@@ -554,7 +554,7 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
 
 static int cy8c95x0_gpio_direction_input(struct gpio_chip *gc, unsigned int off)
 {
-	return pinctrl_gpio_direction_input(gc->base + off);
+	return pinctrl_gpio_direction_input_new(gc, off);
 }
 
 static int cy8c95x0_gpio_direction_output(struct gpio_chip *gc,
@@ -571,7 +571,7 @@ static int cy8c95x0_gpio_direction_output(struct gpio_chip *gc,
 	if (ret)
 		return ret;
 
-	return pinctrl_gpio_direction_output(gc->base + off);
+	return pinctrl_gpio_direction_output_new(gc, off);
 }
 
 static int cy8c95x0_gpio_get_value(struct gpio_chip *gc, unsigned int off)
Signature · 1 line
2.39.2
Reviewed-by on v1 25/36
#48 lore raw

Re: [PATCH 25/36] pinctrl: cy8c95x0: use new pinctrl GPIO helpers

Quoted 6 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

With whatever name of the APIs at the end,

Quoted 30 lines
---
 drivers/pinctrl/pinctrl-cy8c95x0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +2 -3
index fae80b52a6fc..8c6006353515 100644
@@ -554,7 +554,7 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
 
 static int cy8c95x0_gpio_direction_input(struct gpio_chip *gc, unsigned int off)
 {
-       return pinctrl_gpio_direction_input(gc->base + off);
+       return pinctrl_gpio_direction_input_new(gc, off);
 }
 
 static int cy8c95x0_gpio_direction_output(struct gpio_chip *gc,
@@ -571,7 +571,7 @@ static int cy8c95x0_gpio_direction_output(struct gpio_chip *gc,
        if (ret)
                return ret;
 
-       return pinctrl_gpio_direction_output(gc->base + off);
+       return pinctrl_gpio_direction_output_new(gc, off);
 }
 
 static int cy8c95x0_gpio_get_value(struct gpio_chip *gc, unsigned int off)
--

2.39.2

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#49 lore raw

PATCH 26/36 pinctrl: as3722: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/pinctrl-as3722.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-as3722.c +2 -2
index f0e5d87ac50b..3d3adf9793fb 100644
@@ -502,14 +502,14 @@ static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
 
 static int as3722_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int as3722_gpio_direction_output(struct gpio_chip *chip,
 		unsigned offset, int value)
 {
 	as3722_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
Signature · 1 line
2.39.2
#50 lore raw

PATCH 27/36 pinctrl: ingenic: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/pinctrl-ingenic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-ingenic.c +8 -3
index 2f220a47b749..5072fb907193 100644
@@ -133,6 +133,8 @@ struct ingenic_pinctrl {
 	struct pinctrl_pin_desc *pdesc;
 
 	const struct ingenic_chip_info *info;
+
+	struct gpio_chip *gc;
 };
 
 struct ingenic_gpio_chip {
@@ -3561,14 +3563,14 @@ static int ingenic_gpio_get(struct gpio_chip *gc, unsigned int offset)
 static int ingenic_gpio_direction_input(struct gpio_chip *gc,
 		unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(gc->base + offset);
+	return pinctrl_gpio_direction_input_new(gc, offset);
 }
 
 static int ingenic_gpio_direction_output(struct gpio_chip *gc,
 		unsigned int offset, int value)
 {
 	ingenic_gpio_set(gc, offset, value);
-	return pinctrl_gpio_direction_output(gc->base + offset);
+	return pinctrl_gpio_direction_output_new(gc, offset);
 }
 
 static inline void ingenic_config_pin(struct ingenic_pinctrl *jzpc,
@@ -4052,7 +4054,8 @@ static int ingenic_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
 			break;
 
 		case PIN_CONFIG_OUTPUT:
-			ret = pinctrl_gpio_direction_output(pin);
+			ret = pinctrl_gpio_direction_output_new(jzpc->gc,
+							pin - jzpc->gc->base);
 			if (ret)
 				return ret;
 
@@ -4172,6 +4175,8 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc,
 	if (!jzgc)
 		return -ENOMEM;
 
+	jzpc->gc = &jzgc->gc;
+
 	jzgc->jzpc = jzpc;
 	jzgc->reg_base = bank * jzpc->info->reg_offset;
 
Signature · 1 line
2.39.2
#51 lore raw

PATCH 28/36 pinctrl: intel: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/intel/pinctrl-cherryview.c | 4 ++--
 drivers/pinctrl/intel/pinctrl-intel.c      | 4 ++--
 drivers/pinctrl/intel/pinctrl-lynxpoint.c  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/pinctrl/intel/pinctrl-cherryview.c +2 -2
index 81ee949b946d..56a6b67d8380 100644
@@ -1172,14 +1172,14 @@ static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 
 static int chv_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int chv_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
 				     int value)
 {
 	chv_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static const struct gpio_chip chv_gpio_chip = {
drivers/pinctrl/intel/pinctrl-intel.c +2 -2
index f49d6e136018..4897c8425391 100644
@@ -990,14 +990,14 @@ static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 
 static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
 				       int value)
 {
 	intel_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip, offset);
 }
 
 static const struct gpio_chip intel_gpio_chip = {
drivers/pinctrl/intel/pinctrl-lynxpoint.c +2 -2
index c3732a9f0658..544ea8a607c9 100644
@@ -545,7 +545,7 @@ static void lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
 
 static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(chip->base + offset);
+	return pinctrl_gpio_direction_input_new(chip, offset);
 }
 
 static int lp_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
@@ -553,7 +553,7 @@ static int lp_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
 {
 	lp_gpio_set(chip, offset, value);
 
-	return pinctrl_gpio_direction_output(chip->base + offset);
+	return pinctrl_gpio_direction_output_new(chip,  offset);
 }
 
 static int lp_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
Signature · 1 line
2.39.2
Reviewed-by on v1 28/36
#52 lore raw

Re: [PATCH 28/36] pinctrl: intel: use new pinctrl GPIO helpers

Quoted 6 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

With whatever name of the APIs at the end,

But I want to see this to be in an immutable tag / branch so I can pull it into my tree.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Acked-by on v1 28/36
#53 lore raw

Re: [PATCH 28/36] pinctrl: intel: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski
Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

#54 lore raw

PATCH 29/36 pinctrl: st: use new pinctrl GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/pinctrl-st.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-st.c +2 -2
index c1f36b164ea5..ec763572ab3e 100644
@@ -719,7 +719,7 @@ static void st_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int st_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	pinctrl_gpio_direction_input(chip->base + offset);
+	pinctrl_gpio_direction_input_new(chip, offset);
 
 	return 0;
 }
@@ -730,7 +730,7 @@ static int st_gpio_direction_output(struct gpio_chip *chip,
 	struct st_gpio_bank *bank = gpiochip_get_data(chip);
 
 	__st_gpio_set(bank, offset, value);
-	pinctrl_gpio_direction_output(chip->base + offset);
+	pinctrl_gpio_direction_output_new(chip, offset);
 
 	return 0;
 }
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 29/36
#55 lore raw

Re: [PATCH 29/36] pinctrl: st: use new pinctrl GPIO helpers

Quoted 25 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset.

---
 drivers/pinctrl/pinctrl-st.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-st.c +1 -1
index c1f36b164ea5..ec763572ab3e 100644
@@ -719,7 +719,7 @@ static void st_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int st_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	pinctrl_gpio_direction_input(chip->base + offset);
+	pinctrl_gpio_direction_input_new(chip, offset);
 
 	return 0;
 }

drivers/pinctrl/pinctrl-st.c static int st_gpio_direction_output(struct gpio_chip *chip, · line 736

Quoted 8 lines
drivers/pinctrl/pinctrl-st.c +1 -1
@@ -730,7 +730,7 @@ static int st_gpio_direction_output(struct gpio_chip *chip,
 	struct st_gpio_bank *bank = gpiochip_get_data(chip);
 
 	__st_gpio_set(bank, offset, value);
-	pinctrl_gpio_direction_output(chip->base + offset);
+	pinctrl_gpio_direction_output_new(chip, offset);
 
 	return 0;
 }

Thanks
Patrice

#56 lore raw

PATCH 30/36 pinctrl: remove old GPIO helpers

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Old variants of pinctrl GPIO helpers are no longer used. Let's remove them as well as convert all static functions in pinctrl/core.c that still deal with global GPIO numbers to using the gpio_chip + offset pairs.

---
 drivers/pinctrl/core.c           | 242 ++++++++++++-------------------
 include/linux/pinctrl/consumer.h |  35 -----
 2 files changed, 94 insertions(+), 183 deletions(-)
drivers/pinctrl/core.c +94 -148
index 679f48c5beeb..5bad56ed8176 100644
@@ -268,7 +268,8 @@ static int pinctrl_register_pins(struct pinctrl_dev *pctldev,
 /**
  * gpio_to_pin() - GPIO range GPIO number to pin number translation
  * @range: GPIO range used for the translation
- * @gpio: gpio pin to translate to a pin number
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
  *
  * Finds the pin number for a given GPIO using the specified GPIO range
  * as a base for translation. The distinction between linear GPIO ranges
@@ -279,25 +280,28 @@ static int pinctrl_register_pins(struct pinctrl_dev *pctldev,
  * result of successful pinctrl_get_device_gpio_range calls)!
  */
 static inline int gpio_to_pin(struct pinctrl_gpio_range *range,
-				unsigned int gpio)
+			      struct gpio_chip *gc, unsigned int offset)
 {
-	unsigned int offset = gpio - range->base;
+	unsigned int pin = gc->base + offset - range->base;
+
 	if (range->pins)
-		return range->pins[offset];
+		return range->pins[pin];
 	else
-		return range->pin_base + offset;
+		return range->pin_base + pin;
 }
 
 /**
  * pinctrl_match_gpio_range() - check if a certain GPIO pin is in range
  * @pctldev: pin controller device to check
- * @gpio: gpio pin to check taken from the global GPIO pin space
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
  *
  * Tries to match a GPIO pin number to the ranges handled by a certain pin
  * controller, return the range or NULL
  */
 static struct pinctrl_gpio_range *
-pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
+pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, struct gpio_chip *gc,
+			 unsigned int offset)
 {
 	struct pinctrl_gpio_range *range;
 
@@ -305,8 +309,8 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
 	/* Loop over the ranges */
 	list_for_each_entry(range, &pctldev->gpio_ranges, node) {
 		/* Check if we're in the valid range */
-		if (gpio >= range->base &&
-		    gpio < range->base + range->npins) {
+		if (gc->base + offset >= range->base &&
+		    gc->base + offset < range->base + range->npins) {
 			mutex_unlock(&pctldev->mutex);
 			return range;
 		}
@@ -318,7 +322,8 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
 /**
  * pinctrl_ready_for_gpio_range() - check if other GPIO pins of
  * the same GPIO chip are in range
- * @gpio: gpio pin to check taken from the global GPIO pin space
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
  *
  * This function is complement of pinctrl_match_gpio_range(). If the return
  * value of pinctrl_match_gpio_range() is NULL, this function could be used
@@ -329,19 +334,10 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
  * is false, it means that pinctrl device may not be ready.
  */
 #ifdef CONFIG_GPIOLIB
-static bool pinctrl_ready_for_gpio_range(unsigned gpio)
+static bool pinctrl_ready_for_gpio_range(struct gpio_chip *gc)
 {
 	struct pinctrl_dev *pctldev;
 	struct pinctrl_gpio_range *range = NULL;
-	/*
-	 * FIXME: "gpio" here is a number in the global GPIO numberspace.
-	 * get rid of this from the ranges eventually and get the GPIO
-	 * descriptor from the gpio_chip.
-	 */
-	struct gpio_chip *chip = gpiod_to_chip(gpio_to_desc(gpio));
-
-	if (WARN(!chip, "no gpio_chip for gpio%i?", gpio))
-		return false;
 
 	mutex_lock(&pinctrldev_list_mutex);
 
@@ -351,8 +347,8 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
 		mutex_lock(&pctldev->mutex);
 		list_for_each_entry(range, &pctldev->gpio_ranges, node) {
 			/* Check if any gpio range overlapped with gpio chip */
-			if (range->base + range->npins - 1 < chip->base ||
-			    range->base > chip->base + chip->ngpio - 1)
+			if (range->base + range->npins - 1 < gc->base ||
+			    range->base > gc->base + gc->ngpio - 1)
 				continue;
 			mutex_unlock(&pctldev->mutex);
 			mutex_unlock(&pinctrldev_list_mutex);
@@ -366,12 +362,13 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
 	return false;
 }
 #else
-static bool pinctrl_ready_for_gpio_range(unsigned gpio) { return true; }
+static bool pinctrl_ready_for_gpio_range(struct gpio_chip *gc) { return true; }
 #endif
 
 /**
  * pinctrl_get_device_gpio_range() - find device for GPIO range
- * @gpio: the pin to locate the pin controller for
+ * @gc: GPIO chip structure from the GPIO subsystem
+ * @offset: hardware offset of the GPIO relative to the controller
  * @outdev: the pin control device if found
  * @outrange: the GPIO range if found
  *
@@ -380,7 +377,8 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio) { return true; }
  * -EPROBE_DEFER if the GPIO range could not be found in any device since it
  * may still have not been registered.
  */
-static int pinctrl_get_device_gpio_range(unsigned gpio,
+static int pinctrl_get_device_gpio_range(struct gpio_chip *gc,
+					 unsigned int offset,
 					 struct pinctrl_dev **outdev,
 					 struct pinctrl_gpio_range **outrange)
 {
@@ -392,7 +390,7 @@ static int pinctrl_get_device_gpio_range(unsigned gpio,
 	list_for_each_entry(pctldev, &pinctrldev_list, node) {
 		struct pinctrl_gpio_range *range;
 
-		range = pinctrl_match_gpio_range(pctldev, gpio);
+		range = pinctrl_match_gpio_range(pctldev, gc, offset);
 		if (range) {
 			*outdev = pctldev;
 			*outrange = range;
@@ -754,10 +752,10 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
 	return -EINVAL;
 }
 
-bool pinctrl_gpio_can_use_line(unsigned gpio)
+bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset)
 {
-	struct pinctrl_dev *pctldev;
 	struct pinctrl_gpio_range *range;
+	struct pinctrl_dev *pctldev;
 	bool result;
 	int pin;
 
@@ -766,56 +764,19 @@ bool pinctrl_gpio_can_use_line(unsigned gpio)
 	 * we're probably dealing with GPIO driver
 	 * without a backing pin controller - bail out.
 	 */
-	if (pinctrl_get_device_gpio_range(gpio, &pctldev, &range))
+	if (pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range))
 		return true;
 
-	mutex_lock(&pctldev->mutex);
-
-	/* Convert to the pin controllers number space */
-	pin = gpio_to_pin(range, gpio);
-
-	result = pinmux_can_be_used_for_gpio(pctldev, pin);
-
-	mutex_unlock(&pctldev->mutex);
+	scoped_guard(mutex, &pctldev->mutex) {
+		/* Convert to the pin controllers number space */
+		pin = gpio_to_pin(range, gc, offset);
+		result = pinmux_can_be_used_for_gpio(pctldev, pin);
+	}
 
 	return result;
 }
-EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line);
-
-bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset)
-{
-	return pinctrl_gpio_can_use_line(gc->base + offset);
-}
 EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line_new);
 
-/* This function is deprecated and will be removed. Don't use. */
-int pinctrl_gpio_request(unsigned gpio)
-{
-	struct pinctrl_dev *pctldev;
-	struct pinctrl_gpio_range *range;
-	int ret;
-	int pin;
-
-	ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
-	if (ret) {
-		if (pinctrl_ready_for_gpio_range(gpio))
-			ret = 0;
-		return ret;
-	}
-
-	mutex_lock(&pctldev->mutex);
-
-	/* Convert to the pin controllers number space */
-	pin = gpio_to_pin(range, gpio);
-
-	ret = pinmux_request_gpio(pctldev, range, pin, gpio);
-
-	mutex_unlock(&pctldev->mutex);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(pinctrl_gpio_request);
-
 /**
  * pinctrl_gpio_request_new() - request a single pin to be used as GPIO
  * @gc: GPIO chip structure from the GPIO subsystem
@@ -827,33 +788,29 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_request);
  */
 int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset)
 {
-	return pinctrl_gpio_request(gc->base + offset);
+	struct pinctrl_gpio_range *range;
+	struct pinctrl_dev *pctldev;
+	int ret, pin;
+
+	ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
+	if (ret) {
+		if (pinctrl_ready_for_gpio_range(gc))
+			ret = 0;
+
+		return ret;
+	}
+
+	scoped_guard(mutex, &pctldev->mutex) {
+		/* Convert to the pin controllers number space */
+		pin = gpio_to_pin(range, gc, offset);
+		ret = pinmux_request_gpio(pctldev, range, pin,
+					  gc->base + offset);
+	}
+
+	return ret;
 }
 EXPORT_SYMBOL_GPL(pinctrl_gpio_request_new);
 
-/* This function is deprecated and will be removed. Don't use. */
-void pinctrl_gpio_free(unsigned gpio)
-{
-	struct pinctrl_dev *pctldev;
-	struct pinctrl_gpio_range *range;
-	int ret;
-	int pin;
-
-	ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
-	if (ret) {
-		return;
-	}
-	mutex_lock(&pctldev->mutex);
-
-	/* Convert to the pin controllers number space */
-	pin = gpio_to_pin(range, gpio);
-
-	pinmux_free_gpio(pctldev, pin, range);
-
-	mutex_unlock(&pctldev->mutex);
-}
-EXPORT_SYMBOL_GPL(pinctrl_gpio_free);
-
 /**
  * pinctrl_gpio_free_new() - free control on a single pin, currently used as GPIO
  * @gc: GPIO chip structure from the GPIO subsystem
@@ -865,40 +822,42 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_free);
  */
 void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset)
 {
-	return pinctrl_gpio_free(gc->base + offset);
+	struct pinctrl_gpio_range *range;
+	struct pinctrl_dev *pctldev;
+	int ret, pin;
+
+	ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
+	if (ret)
+		return;
+
+	guard(mutex)(&pctldev->mutex);
+
+	/* Convert to the pin controllers number space */
+	pin = gpio_to_pin(range, gc, offset);
+	pinmux_free_gpio(pctldev, pin, range);
 }
 EXPORT_SYMBOL_GPL(pinctrl_gpio_free_new);
 
-static int pinctrl_gpio_direction(unsigned gpio, bool input)
+static int
+pinctrl_gpio_direction(struct gpio_chip *gc, unsigned int offset, bool input)
 {
-	struct pinctrl_dev *pctldev;
 	struct pinctrl_gpio_range *range;
-	int ret;
-	int pin;
+	struct pinctrl_dev *pctldev;
+	int ret, pin;
 
-	ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
-	if (ret) {
+	ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
+	if (ret)
 		return ret;
+
+	scoped_guard(mutex, &pctldev->mutex) {
+		/* Convert to the pin controllers number space */
+		pin = gpio_to_pin(range, gc, offset);
+		ret = pinmux_gpio_direction(pctldev, range, pin, input);
 	}
 
-	mutex_lock(&pctldev->mutex);
-
-	/* Convert to the pin controllers number space */
-	pin = gpio_to_pin(range, gpio);
-	ret = pinmux_gpio_direction(pctldev, range, pin, input);
-
-	mutex_unlock(&pctldev->mutex);
-
 	return ret;
 }
 
-/* This function is deprecated and will be removed. Don't use. */
-int pinctrl_gpio_direction_input(unsigned gpio)
-{
-	return pinctrl_gpio_direction(gpio, true);
-}
-EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
-
 /**
  * pinctrl_gpio_direction_input_new() - request a GPIO pin to go into input mode
  * @gc: GPIO chip structure from the GPIO subsystem
@@ -910,17 +869,10 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
  */
 int pinctrl_gpio_direction_input_new(struct gpio_chip *gc, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input(gc->base + offset);
+	return pinctrl_gpio_direction(gc, offset, true);
 }
 EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input_new);
 
-/* This function is deprecated and will be removed. Don't use. */
-int pinctrl_gpio_direction_output(unsigned gpio)
-{
-	return pinctrl_gpio_direction(gpio, false);
-}
-EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
-
 /**
  * pinctrl_gpio_direction_output_new() - request a GPIO pin to go into output
  *                                       mode
@@ -933,31 +885,10 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
  */
 int pinctrl_gpio_direction_output_new(struct gpio_chip *gc, unsigned int offset)
 {
-	return pinctrl_gpio_direction_output(gc->base + offset);
+	return pinctrl_gpio_direction(gc, offset, false);
 }
 EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output_new);
 
-/* This function is deprecated and will be removed. Don't use. */
-int pinctrl_gpio_set_config(unsigned gpio, unsigned long config)
-{
-	unsigned long configs[] = { config };
-	struct pinctrl_gpio_range *range;
-	struct pinctrl_dev *pctldev;
-	int ret, pin;
-
-	ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
-	if (ret)
-		return ret;
-
-	mutex_lock(&pctldev->mutex);
-	pin = gpio_to_pin(range, gpio);
-	ret = pinconf_set_config(pctldev, pin, configs, ARRAY_SIZE(configs));
-	mutex_unlock(&pctldev->mutex);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config);
-
 /**
  * pinctrl_gpio_set_config_new() - Apply config to given GPIO pin
  * @gc: GPIO chip structure from the GPIO subsystem
@@ -971,7 +902,22 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config);
 int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
 				unsigned long config)
 {
-	return pinctrl_gpio_set_config(gc->base + offset, config);
+	unsigned long configs[] = { config };
+	struct pinctrl_gpio_range *range;
+	struct pinctrl_dev *pctldev;
+	int ret, pin;
+
+	ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
+	if (ret)
+		return ret;
+
+	scoped_guard(mutex, &pctldev->mutex) {
+		pin = gpio_to_pin(range, gc, offset);
+		ret = pinconf_set_config(pctldev, pin, configs,
+					 ARRAY_SIZE(configs));
+	}
+
+	return ret;
 }
 EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config_new);
 
include/linux/pinctrl/consumer.h +0 -35
index c95c13983376..aa3a7a7ca52d 100644
@@ -26,19 +26,13 @@ struct pinctrl_state;
 #ifdef CONFIG_PINCTRL
 
 /* External interface to pin control */
-bool pinctrl_gpio_can_use_line(unsigned gpio);
 bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset);
-int pinctrl_gpio_request(unsigned gpio);
 int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset);
-void pinctrl_gpio_free(unsigned gpio);
 void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset);
-int pinctrl_gpio_direction_input(unsigned gpio);
 int pinctrl_gpio_direction_input_new(struct gpio_chip *gc,
 				     unsigned int offset);
-int pinctrl_gpio_direction_output(unsigned gpio);
 int pinctrl_gpio_direction_output_new(struct gpio_chip *gc,
 				      unsigned int offset);
-int pinctrl_gpio_set_config(unsigned gpio, unsigned long config);
 int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
 				unsigned long config);
 
@@ -73,64 +67,35 @@ static inline int pinctrl_pm_select_idle_state(struct device *dev)
 
 #else /* !CONFIG_PINCTRL */
 
-static inline bool pinctrl_gpio_can_use_line(unsigned gpio)
-{
-	return true;
-}
-
 static inline bool
 pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset)
 {
 	return true;
 }
 
-static inline int pinctrl_gpio_request(unsigned gpio)
-{
-	return 0;
-}
-
 static inline int
 pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset)
 {
 	return 0;
 }
 
-static inline void pinctrl_gpio_free(unsigned gpio)
-{
-}
-
 static inline void
 pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset)
 {
 }
 
-static inline int pinctrl_gpio_direction_input(unsigned gpio)
-{
-	return 0;
-}
-
 static inline int
 pinctrl_gpio_direction_input_new(struct gpio_chip *gc, unsigned int offset)
 {
 	return 0;
 }
 
-static inline int pinctrl_gpio_direction_output(unsigned gpio)
-{
-	return 0;
-}
-
 static inline int
 pinctrl_gpio_direction_output_new(struct gpio_chip *gc, unsigned int offset)
 {
 	return 0;
 }
 
-static inline int pinctrl_gpio_set_config(unsigned gpio, unsigned long config)
-{
-	return 0;
-}
-
 static inline int
 pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
 			    unsigned long config)
Signature · 1 line
2.39.2
#57 lore raw

Re: [PATCH 30/36] pinctrl: remove old GPIO helpers

Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Old variants of pinctrl GPIO helpers are no longer used. Let's remove them as well as convert all static functions in pinctrl/core.c that still deal with global GPIO numbers to using the gpio_chip + offset pairs.

This patch does three thighs as I see it.

First of all, it silently converts to RAII. Please, do this separately. Second, it shuffles a lot of code between old and new implementations. What I prefer to see is what the subject tells: only "-" (minus) lines.
Third, it will become easier if you name the "new" functions better to begin with, it will help a lot here.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#58 lore raw

Re: [PATCH 30/36] pinctrl: remove old GPIO helpers

Quoted 12 lines · Andy Shevchenko
Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Old variants of pinctrl GPIO helpers are no longer used. Let's remove them as well as convert all static functions in pinctrl/core.c that still deal with global GPIO numbers to using the gpio_chip + offset pairs.

This patch does three thighs as I see it.

I'd argue it just fold the code that lived in old functions into the new ones...

Quoted 1 line

First of all, it silently converts to RAII. Please, do this separately.

... and while at it, it already switches to SBRM because why copy outdated code.

Quoted 6 lines

Second, it shuffles a lot of code between old and new implementations. What I prefer to see is what the subject tells: only "-" (minus) lines.
Third, it will become easier if you name the "new" functions better to begin with, it will help a lot here.

I'll wait for Linus to tell me if he prefers one big squashed commit or a fine-grained history (I prefer the latter) before spending time splitting this commit.

Bart

Quoted 3 lines

--
With Best Regards,
Andy Shevchenko

#59 lore raw

Re: [PATCH 30/36] pinctrl: remove old GPIO helpers

Quoted 3 lines · Bartosz Golaszewski
Quoted 1 line · Andy Shevchenko

On Tue, Oct 3, 2023 at 5:51 PM Bartosz Golaszewski <[email protected]> wrote:

...

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Old variants of pinctrl GPIO helpers are no longer used. Let's remove them as well as convert all static functions in pinctrl/core.c that still deal with global GPIO numbers to using the gpio_chip + offset pairs.

Quoted 8 lines
Quoted 2 lines

This patch does three thighs as I see it.

I'd argue it just fold the code that lived in old functions into the new ones...

Quoted 1 line

First of all, it silently converts to RAII. Please, do this separately.

... and while at it, it already switches to SBRM because why copy outdated code.

This is too big thing for "while at it". If you care about that switch, do it beforehand. But at bare minimum it should be a separate patch.

Quoted 9 lines
Quoted 5 lines

Second, it shuffles a lot of code between old and new implementations. What I prefer to see is what the subject tells: only "-" (minus) lines.
Third, it will become easier if you name the "new" functions better to begin with, it will help a lot here.

I'll wait for Linus to tell me if he prefers one big squashed commit or a fine-grained history (I prefer the latter) before spending time splitting this commit.

Definitely, changing code to SBRM is out of scope of this series and should be done in a separate patch at least.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#60 lore raw

Re: [PATCH 30/36] pinctrl: remove old GPIO helpers

In reply to Bartosz Golaszewski
kernel test robot noticed the following build warnings:

Hi Bartosz,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on linusw-pinctrl/for-next next-20231003]
[cannot apply to brgl/gpio/for-next geert-renesas-drivers/renesas-pinctrl linus/master v6.6-rc4] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/pinctrl-remove-unneeded-extern-specifiers-from-consumer-h/20231003-225540
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link:    https://lore.kernel.org/r/20231003145114.21637-31-brgl%40bgdev.pl
patch subject: [PATCH 30/36] pinctrl: remove old GPIO helpers
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231004/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231004/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/pinctrl/core.c:338: warning: Excess function parameter 'offset' description in 'pinctrl_ready_for_gpio_range'

vim +338 drivers/pinctrl/core.c

2744e8afb3b763 Linus Walleij       2011-05-02  321  
51e13c2475913d Haojian Zhuang      2013-02-17  322  /**
51e13c2475913d Haojian Zhuang      2013-02-17  323   * pinctrl_ready_for_gpio_range() - check if other GPIO pins of
51e13c2475913d Haojian Zhuang      2013-02-17  324   * the same GPIO chip are in range
4b4af250917e1a Bartosz Golaszewski 2023-10-03  325   * @gc: GPIO chip structure from the GPIO subsystem
4b4af250917e1a Bartosz Golaszewski 2023-10-03  326   * @offset: hardware offset of the GPIO relative to the controller
51e13c2475913d Haojian Zhuang      2013-02-17  327   *
51e13c2475913d Haojian Zhuang      2013-02-17  328   * This function is complement of pinctrl_match_gpio_range(). If the return
51e13c2475913d Haojian Zhuang      2013-02-17  329   * value of pinctrl_match_gpio_range() is NULL, this function could be used
51e13c2475913d Haojian Zhuang      2013-02-17  330   * to check whether pinctrl device is ready or not. Maybe some GPIO pins
51e13c2475913d Haojian Zhuang      2013-02-17  331   * of the same GPIO chip don't have back-end pinctrl interface.
51e13c2475913d Haojian Zhuang      2013-02-17  332   * If the return value is true, it means that pinctrl device is ready & the
51e13c2475913d Haojian Zhuang      2013-02-17  333   * certain GPIO pin doesn't have back-end pinctrl device. If the return value
51e13c2475913d Haojian Zhuang      2013-02-17  334   * is false, it means that pinctrl device may not be ready.
51e13c2475913d Haojian Zhuang      2013-02-17  335   */
2afe8229687ec2 Haojian Zhuang      2013-03-28  336  #ifdef CONFIG_GPIOLIB
4b4af250917e1a Bartosz Golaszewski 2023-10-03  337  static bool pinctrl_ready_for_gpio_range(struct gpio_chip *gc)
51e13c2475913d Haojian Zhuang      2013-02-17 @338  {
51e13c2475913d Haojian Zhuang      2013-02-17  339  	struct pinctrl_dev *pctldev;
51e13c2475913d Haojian Zhuang      2013-02-17  340  	struct pinctrl_gpio_range *range = NULL;
942cde724075f8 Tony Lindgren       2015-09-03  341  
44d5f7bbead9e7 Linus Walleij       2013-05-16  342  	mutex_lock(&pinctrldev_list_mutex);
44d5f7bbead9e7 Linus Walleij       2013-05-16  343  
51e13c2475913d Haojian Zhuang      2013-02-17  344  	/* Loop over the pin controllers */
51e13c2475913d Haojian Zhuang      2013-02-17  345  	list_for_each_entry(pctldev, &pinctrldev_list, node) {
51e13c2475913d Haojian Zhuang      2013-02-17  346  		/* Loop over the ranges */
5ffbe2e6138732 Axel Lin            2013-08-18  347  		mutex_lock(&pctldev->mutex);
51e13c2475913d Haojian Zhuang      2013-02-17  348  		list_for_each_entry(range, &pctldev->gpio_ranges, node) {
51e13c2475913d Haojian Zhuang      2013-02-17  349  			/* Check if any gpio range overlapped with gpio chip */
4b4af250917e1a Bartosz Golaszewski 2023-10-03  350  			if (range->base + range->npins - 1 < gc->base ||
4b4af250917e1a Bartosz Golaszewski 2023-10-03  351  			    range->base > gc->base + gc->ngpio - 1)
51e13c2475913d Haojian Zhuang      2013-02-17  352  				continue;
5ffbe2e6138732 Axel Lin            2013-08-18  353  			mutex_unlock(&pctldev->mutex);
44d5f7bbead9e7 Linus Walleij       2013-05-16  354  			mutex_unlock(&pinctrldev_list_mutex);
51e13c2475913d Haojian Zhuang      2013-02-17  355  			return true;
51e13c2475913d Haojian Zhuang      2013-02-17  356  		}
5ffbe2e6138732 Axel Lin            2013-08-18  357  		mutex_unlock(&pctldev->mutex);
51e13c2475913d Haojian Zhuang      2013-02-17  358  	}
44d5f7bbead9e7 Linus Walleij       2013-05-16  359  
44d5f7bbead9e7 Linus Walleij       2013-05-16  360  	mutex_unlock(&pinctrldev_list_mutex);
44d5f7bbead9e7 Linus Walleij       2013-05-16  361  
51e13c2475913d Haojian Zhuang      2013-02-17  362  	return false;
51e13c2475913d Haojian Zhuang      2013-02-17  363  }
2afe8229687ec2 Haojian Zhuang      2013-03-28  364  #else
4b4af250917e1a Bartosz Golaszewski 2023-10-03  365  static bool pinctrl_ready_for_gpio_range(struct gpio_chip *gc) { return true; }
2afe8229687ec2 Haojian Zhuang      2013-03-28  366  #endif
51e13c2475913d Haojian Zhuang      2013-02-17  367  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#61 lore raw

PATCH 31/36 treewide: rename pinctrl_gpio_can_use_line_new()

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_can_use_line() is no longer used, let's drop the '_new' suffix from its improved variant.

---
 drivers/gpio/gpiolib-cdev.c      | 2 +-
 drivers/pinctrl/core.c           | 4 ++--
 include/linux/pinctrl/consumer.h | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpio/gpiolib-cdev.c +1 -1
index 54ee075410db..02ffda6c1e51 100644
@@ -2287,7 +2287,7 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
 	 * FIXME: find a non-racy way to retrieve this information. Maybe a
 	 * lock common to both frameworks?
 	 */
-	ok_for_pinctrl = pinctrl_gpio_can_use_line_new(gc, info->offset);
+	ok_for_pinctrl = pinctrl_gpio_can_use_line(gc, info->offset);
 
 	spin_lock_irqsave(&gpio_lock, flags);
 
drivers/pinctrl/core.c +2 -2
index 5bad56ed8176..eb12aec39ed1 100644
@@ -752,7 +752,7 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
 	return -EINVAL;
 }
 
-bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset)
+bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset)
 {
 	struct pinctrl_gpio_range *range;
 	struct pinctrl_dev *pctldev;
@@ -775,7 +775,7 @@ bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset)
 
 	return result;
 }
-EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line_new);
+EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line);
 
 /**
  * pinctrl_gpio_request_new() - request a single pin to be used as GPIO
include/linux/pinctrl/consumer.h +2 -2
index aa3a7a7ca52d..4f9ead7f65d2 100644
@@ -26,7 +26,7 @@ struct pinctrl_state;
 #ifdef CONFIG_PINCTRL
 
 /* External interface to pin control */
-bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset);
+bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset);
 int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset);
 void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset);
 int pinctrl_gpio_direction_input_new(struct gpio_chip *gc,
@@ -68,7 +68,7 @@ static inline int pinctrl_pm_select_idle_state(struct device *dev)
 #else /* !CONFIG_PINCTRL */
 
 static inline bool
-pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset)
+pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset)
 {
 	return true;
 }
Signature · 1 line
2.39.2
#62 lore raw

PATCH 32/36 treewide: rename pinctrl_gpio_request_new()

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_request() is no longer used, let's drop the '_new' suffix from its improved variant.

---
 drivers/gpio/gpio-aspeed.c                         | 2 +-
 drivers/gpio/gpio-em.c                             | 2 +-
 drivers/gpio/gpio-rcar.c                           | 2 +-
 drivers/gpio/gpio-tegra.c                          | 2 +-
 drivers/gpio/gpiolib.c                             | 2 +-
 drivers/pinctrl/bcm/pinctrl-iproc-gpio.c           | 2 +-
 drivers/pinctrl/core.c                             | 6 +++---
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c          | 2 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c          | 2 +-
 drivers/pinctrl/renesas/gpio.c                     | 2 +-
 drivers/pinctrl/renesas/pinctrl-rzg2l.c            | 2 +-
 drivers/pinctrl/renesas/pinctrl-rzv2m.c            | 2 +-
 drivers/pinctrl/spear/pinctrl-plgpio.c             | 2 +-
 drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 2 +-
 drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 2 +-
 drivers/pinctrl/stm32/pinctrl-stm32.c              | 2 +-
 include/linux/pinctrl/consumer.h                   | 4 ++--
 17 files changed, 20 insertions(+), 20 deletions(-)
drivers/gpio/gpio-aspeed.c +1 -1
index d3aa1cfd4ace..af851c89cacc 100644
@@ -750,7 +750,7 @@ static int aspeed_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	if (!have_gpio(gpiochip_get_data(chip), offset))
 		return -ENODEV;
 
-	return pinctrl_gpio_request_new(chip, offset);
+	return pinctrl_gpio_request(chip, offset);
 }
 
 static void aspeed_gpio_free(struct gpio_chip *chip, unsigned int offset)
drivers/gpio/gpio-em.c +1 -1
index 35c65ff43f71..08c5427deb71 100644
@@ -229,7 +229,7 @@ static int em_gio_to_irq(struct gpio_chip *chip, unsigned offset)
 
 static int em_gio_request(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_request_new(chip, offset);
+	return pinctrl_gpio_request(chip, offset);
 }
 
 static void em_gio_free(struct gpio_chip *chip, unsigned offset)
drivers/gpio/gpio-rcar.c +1 -1
index 47121e1a6d4e..8c98730a7ad2 100644
@@ -275,7 +275,7 @@ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
 		return error;
 	}
 
-	error = pinctrl_gpio_request_new(chip, offset);
+	error = pinctrl_gpio_request(chip, offset);
 	if (error)
 		pm_runtime_put(p->dev);
 
drivers/gpio/gpio-tegra.c +1 -1
index 08951ddcd294..c974ba368d18 100644
@@ -139,7 +139,7 @@ static void tegra_gpio_disable(struct tegra_gpio_info *tgi, unsigned int gpio)
 
 static int tegra_gpio_request(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_request_new(chip, offset);
+	return pinctrl_gpio_request(chip, offset);
 }
 
 static void tegra_gpio_free(struct gpio_chip *chip, unsigned int offset)
drivers/gpio/gpiolib.c +1 -1
index 511f6220071d..7fc97f7ac3ee 100644
@@ -1854,7 +1854,7 @@ int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset)
 		return 0;
 #endif
 
-	return pinctrl_gpio_request_new(gc, offset);
+	return pinctrl_gpio_request(gc, offset);
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_request);
 
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +1 -1
index fb98c3e14743..8162dd840933 100644
@@ -335,7 +335,7 @@ static int iproc_gpio_request(struct gpio_chip *gc, unsigned offset)
 	if (!chip->pinmux_is_supported)
 		return 0;
 
-	return pinctrl_gpio_request_new(gc, offset);
+	return pinctrl_gpio_request(gc, offset);
 }
 
 static void iproc_gpio_free(struct gpio_chip *gc, unsigned offset)
drivers/pinctrl/core.c +3 -3
index eb12aec39ed1..4ce6c73d9813 100644
@@ -778,7 +778,7 @@ bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset)
 EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line);
 
 /**
- * pinctrl_gpio_request_new() - request a single pin to be used as GPIO
+ * pinctrl_gpio_request() - request a single pin to be used as GPIO
  * @gc: GPIO chip structure from the GPIO subsystem
  * @offset: hardware offset of the GPIO relative to the controller
  *
@@ -786,7 +786,7 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line);
  * as part of their gpio_request() semantics, platforms and individual drivers
  * shall *NOT* request GPIO pins to be muxed in.
  */
-int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset)
+int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset)
 {
 	struct pinctrl_gpio_range *range;
 	struct pinctrl_dev *pctldev;
@@ -809,7 +809,7 @@ int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset)
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(pinctrl_gpio_request_new);
+EXPORT_SYMBOL_GPL(pinctrl_gpio_request);
 
 /**
  * pinctrl_gpio_free_new() - free control on a single pin, currently used as GPIO
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +1 -1
index 62134a7f0b4e..ad39b8c060b7 100644
@@ -201,7 +201,7 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	int ret;
 
 	dev_dbg(chip->parent, "gpio_request: offset%d\n", offset);
-	ret = pinctrl_gpio_request_new(chip, offset);
+	ret = pinctrl_gpio_request(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c +1 -1
index 0b6d6964087e..dd4532ae62bf 100644
@@ -198,7 +198,7 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	struct npcm8xx_gpio *bank = gpiochip_get_data(chip);
 	int ret;
 
-	ret = pinctrl_gpio_request_new(chip, offset);
+	ret = pinctrl_gpio_request(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/renesas/gpio.c +1 -1
index e7771a57e6d1..0c4f4d8d0891 100644
@@ -135,7 +135,7 @@ static int gpio_pin_request(struct gpio_chip *gc, unsigned offset)
 	if (idx < 0 || pfc->info->pins[idx].enum_id == 0)
 		return -EINVAL;
 
-	return pinctrl_gpio_request_new(gc, offset);
+	return pinctrl_gpio_request(gc, offset);
 }
 
 static void gpio_pin_free(struct gpio_chip *gc, unsigned offset)
drivers/pinctrl/renesas/pinctrl-rzg2l.c +1 -1
index b9195fff0abd..d7ce56243a78 100644
@@ -801,7 +801,7 @@ static int rzg2l_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	u8 reg8;
 	int ret;
 
-	ret = pinctrl_gpio_request_new(chip, offset);
+	ret = pinctrl_gpio_request(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/renesas/pinctrl-rzv2m.c +1 -1
index 3d29c77a5aad..1ec0922f735c 100644
@@ -754,7 +754,7 @@ static int rzv2m_gpio_request(struct gpio_chip *chip, unsigned int offset)
 	u8 bit = RZV2M_PIN_ID_TO_PIN(offset);
 	int ret;
 
-	ret = pinctrl_gpio_request_new(chip, offset);
+	ret = pinctrl_gpio_request(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/spear/pinctrl-plgpio.c +1 -1
index 7488f6394318..6d3b7ce1c35a 100644
@@ -210,7 +210,7 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)
 	if (offset >= chip->ngpio)
 		return -EINVAL;
 
-	ret = pinctrl_gpio_request_new(chip, offset);
+	ret = pinctrl_gpio_request(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +1 -1
index 22a2db8fa315..88e39f68ef25 100644
@@ -918,7 +918,7 @@ static struct pinctrl_desc starfive_desc = {
 
 static int starfive_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 {
-	return pinctrl_gpio_request_new(gc, gpio);
+	return pinctrl_gpio_request(gc, gpio);
 }
 
 static void starfive_gpio_free(struct gpio_chip *gc, unsigned int gpio)
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +1 -1
index 5557ef3fbeb2..c458c6fb992f 100644
@@ -547,7 +547,7 @@ static const struct pinconf_ops jh7110_pinconf_ops = {
 
 static int jh7110_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 {
-	return pinctrl_gpio_request_new(gc, gpio);
+	return pinctrl_gpio_request(gc, gpio);
 }
 
 static void jh7110_gpio_free(struct gpio_chip *gc, unsigned int gpio)
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -1
index 11d9f07934bd..dddbdc1a64c5 100644
@@ -217,7 +217,7 @@ static int stm32_gpio_request(struct gpio_chip *chip, unsigned offset)
 		return -EINVAL;
 	}
 
-	return pinctrl_gpio_request_new(chip, offset);
+	return pinctrl_gpio_request(chip, offset);
 }
 
 static void stm32_gpio_free(struct gpio_chip *chip, unsigned offset)
include/linux/pinctrl/consumer.h +2 -2
index 4f9ead7f65d2..05b2dae05f24 100644
@@ -27,7 +27,7 @@ struct pinctrl_state;
 
 /* External interface to pin control */
 bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset);
-int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset);
+int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset);
 void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset);
 int pinctrl_gpio_direction_input_new(struct gpio_chip *gc,
 				     unsigned int offset);
@@ -74,7 +74,7 @@ pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset)
 }
 
 static inline int
-pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int offset)
+pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset)
 {
 	return 0;
 }
Signature · 1 line
2.39.2
#63 lore raw

PATCH 33/36 treewide: rename pinctrl_gpio_free_new()

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_free()() is no longer used, let's drop the '_new' suffix from its improved variant.

---
 drivers/gpio/gpio-aspeed.c                         | 2 +-
 drivers/gpio/gpio-em.c                             | 2 +-
 drivers/gpio/gpio-rcar.c                           | 2 +-
 drivers/gpio/gpio-tegra.c                          | 2 +-
 drivers/gpio/gpiolib.c                             | 2 +-
 drivers/pinctrl/bcm/pinctrl-iproc-gpio.c           | 2 +-
 drivers/pinctrl/core.c                             | 6 +++---
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c          | 2 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c          | 2 +-
 drivers/pinctrl/renesas/gpio.c                     | 2 +-
 drivers/pinctrl/renesas/pinctrl-rzg2l.c            | 2 +-
 drivers/pinctrl/renesas/pinctrl-rzv2m.c            | 2 +-
 drivers/pinctrl/spear/pinctrl-plgpio.c             | 4 ++--
 drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 2 +-
 drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 2 +-
 drivers/pinctrl/stm32/pinctrl-stm32.c              | 2 +-
 include/linux/pinctrl/consumer.h                   | 4 ++--
 17 files changed, 21 insertions(+), 21 deletions(-)
drivers/gpio/gpio-aspeed.c +1 -1
index af851c89cacc..4c417c8486dd 100644
@@ -755,7 +755,7 @@ static int aspeed_gpio_request(struct gpio_chip *chip, unsigned int offset)
 
 static void aspeed_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 }
 
 static int usecs_to_cycles(struct aspeed_gpio *gpio, unsigned long usecs,
drivers/gpio/gpio-em.c +1 -1
index 08c5427deb71..aa31c189d0ef 100644
@@ -234,7 +234,7 @@ static int em_gio_request(struct gpio_chip *chip, unsigned offset)
 
 static void em_gio_free(struct gpio_chip *chip, unsigned offset)
 {
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 
 	/* Set the GPIO as an input to ensure that the next GPIO request won't
 	* drive the GPIO pin as an output.
drivers/gpio/gpio-rcar.c +1 -1
index 8c98730a7ad2..6159fda38d5d 100644
@@ -286,7 +286,7 @@ static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
 {
 	struct gpio_rcar_priv *p = gpiochip_get_data(chip);
 
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 
 	/*
 	 * Set the GPIO as an input to ensure that the next GPIO request won't
drivers/gpio/gpio-tegra.c +1 -1
index c974ba368d18..fcb3b474d1df 100644
@@ -146,7 +146,7 @@ static void tegra_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
 	struct tegra_gpio_info *tgi = gpiochip_get_data(chip);
 
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 	tegra_gpio_disable(tgi, offset);
 }
 
drivers/gpio/gpiolib.c +1 -1
index 7fc97f7ac3ee..d7c23be24904 100644
@@ -1870,7 +1870,7 @@ void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset)
 		return;
 #endif
 
-	pinctrl_gpio_free_new(gc, offset);
+	pinctrl_gpio_free(gc, offset);
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_free);
 
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +1 -1
index 8162dd840933..fd5ce52d05b1 100644
@@ -345,7 +345,7 @@ static void iproc_gpio_free(struct gpio_chip *gc, unsigned offset)
 	if (!chip->pinmux_is_supported)
 		return;
 
-	pinctrl_gpio_free_new(gc, offset);
+	pinctrl_gpio_free(gc, offset);
 }
 
 static int iproc_gpio_direction_input(struct gpio_chip *gc, unsigned gpio)
drivers/pinctrl/core.c +3 -3
index 4ce6c73d9813..f0fe3de09fee 100644
@@ -812,7 +812,7 @@ int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset)
 EXPORT_SYMBOL_GPL(pinctrl_gpio_request);
 
 /**
- * pinctrl_gpio_free_new() - free control on a single pin, currently used as GPIO
+ * pinctrl_gpio_free() - free control on a single pin, currently used as GPIO
  * @gc: GPIO chip structure from the GPIO subsystem
  * @offset: hardware offset of the GPIO relative to the controller
  *
@@ -820,7 +820,7 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_request);
  * as part of their gpio_request() semantics, platforms and individual drivers
  * shall *NOT* request GPIO pins to be muxed in.
  */
-void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset)
+void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset)
 {
 	struct pinctrl_gpio_range *range;
 	struct pinctrl_dev *pctldev;
@@ -836,7 +836,7 @@ void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset)
 	pin = gpio_to_pin(range, gc, offset);
 	pinmux_free_gpio(pctldev, pin, range);
 }
-EXPORT_SYMBOL_GPL(pinctrl_gpio_free_new);
+EXPORT_SYMBOL_GPL(pinctrl_gpio_free);
 
 static int
 pinctrl_gpio_direction(struct gpio_chip *gc, unsigned int offset, bool input)
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +1 -1
index ad39b8c060b7..ab7cfc1e66f0 100644
@@ -211,7 +211,7 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
 static void npcmgpio_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
 	dev_dbg(chip->parent, "gpio_free: offset%d\n", offset);
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 }
 
 static void npcmgpio_irq_handler(struct irq_desc *desc)
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c +1 -1
index dd4532ae62bf..78dbeef6af86 100644
@@ -207,7 +207,7 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
 
 static void npcmgpio_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 }
 
 static void npcmgpio_irq_handler(struct irq_desc *desc)
drivers/pinctrl/renesas/gpio.c +1 -1
index 0c4f4d8d0891..b39125a632b0 100644
@@ -140,7 +140,7 @@ static int gpio_pin_request(struct gpio_chip *gc, unsigned offset)
 
 static void gpio_pin_free(struct gpio_chip *gc, unsigned offset)
 {
-	return pinctrl_gpio_free_new(gc, offset);
+	return pinctrl_gpio_free(gc, offset);
 }
 
 static void gpio_pin_set_value(struct sh_pfc_chip *chip, unsigned offset,
drivers/pinctrl/renesas/pinctrl-rzg2l.c +1 -1
index d7ce56243a78..e25fa47fec50 100644
@@ -920,7 +920,7 @@ static void rzg2l_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
 	unsigned int virq;
 
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 
 	virq = irq_find_mapping(chip->irq.domain, offset);
 	if (virq)
drivers/pinctrl/renesas/pinctrl-rzv2m.c +1 -1
index 1ec0922f735c..21d7d5ac8c4a 100644
@@ -832,7 +832,7 @@ static int rzv2m_gpio_get(struct gpio_chip *chip, unsigned int offset)
 
 static void rzv2m_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 
 	/*
 	 * Set the GPIO as an input to ensure that the next GPIO request won't
drivers/pinctrl/spear/pinctrl-plgpio.c +2 -2
index 6d3b7ce1c35a..a05570c7d833 100644
@@ -248,7 +248,7 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)
 	if (!IS_ERR(plgpio->clk))
 		clk_disable(plgpio->clk);
 err0:
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 	return ret;
 }
 
@@ -278,7 +278,7 @@ static void plgpio_free(struct gpio_chip *chip, unsigned offset)
 	if (!IS_ERR(plgpio->clk))
 		clk_disable(plgpio->clk);
 
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 }
 
 /* PLGPIO IRQ */
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +1 -1
index 88e39f68ef25..7beed57d665a 100644
@@ -923,7 +923,7 @@ static int starfive_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 
 static void starfive_gpio_free(struct gpio_chip *gc, unsigned int gpio)
 {
-	pinctrl_gpio_free_new(gc, gpio);
+	pinctrl_gpio_free(gc, gpio);
 }
 
 static int starfive_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +1 -1
index c458c6fb992f..695c8c0a6e8b 100644
@@ -552,7 +552,7 @@ static int jh7110_gpio_request(struct gpio_chip *gc, unsigned int gpio)
 
 static void jh7110_gpio_free(struct gpio_chip *gc, unsigned int gpio)
 {
-	pinctrl_gpio_free_new(gc, gpio);
+	pinctrl_gpio_free(gc, gpio);
 }
 
 static int jh7110_gpio_get_direction(struct gpio_chip *gc,
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -1
index dddbdc1a64c5..e4453fa58f9e 100644
@@ -222,7 +222,7 @@ static int stm32_gpio_request(struct gpio_chip *chip, unsigned offset)
 
 static void stm32_gpio_free(struct gpio_chip *chip, unsigned offset)
 {
-	pinctrl_gpio_free_new(chip, offset);
+	pinctrl_gpio_free(chip, offset);
 }
 
 static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset)
include/linux/pinctrl/consumer.h +2 -2
index 05b2dae05f24..55b465edaff1 100644
@@ -28,7 +28,7 @@ struct pinctrl_state;
 /* External interface to pin control */
 bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset);
 int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset);
-void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset);
+void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset);
 int pinctrl_gpio_direction_input_new(struct gpio_chip *gc,
 				     unsigned int offset);
 int pinctrl_gpio_direction_output_new(struct gpio_chip *gc,
@@ -80,7 +80,7 @@ pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset)
 }
 
 static inline void
-pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset)
+pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset)
 {
 }
 
Signature · 1 line
2.39.2
#64 lore raw

PATCH 34/36 treewide: rename pinctrl_gpio_direction_input_new()

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_direction_input() is no longer used, let's drop the '_new' suffix from its improved variant.

---
 drivers/gpio/gpio-mvebu.c                     | 2 +-
 drivers/gpio/gpio-pxa.c                       | 2 +-
 drivers/gpio/gpio-rockchip.c                  | 2 +-
 drivers/gpio/gpio-tegra.c                     | 2 +-
 drivers/gpio/gpio-vf610.c                     | 2 +-
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c      | 2 +-
 drivers/pinctrl/core.c                        | 6 +++---
 drivers/pinctrl/intel/pinctrl-cherryview.c    | 2 +-
 drivers/pinctrl/intel/pinctrl-intel.c         | 2 +-
 drivers/pinctrl/intel/pinctrl-lynxpoint.c     | 2 +-
 drivers/pinctrl/mediatek/pinctrl-moore.c      | 2 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
 drivers/pinctrl/mediatek/pinctrl-paris.c      | 2 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c     | 2 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c     | 2 +-
 drivers/pinctrl/pinctrl-as3722.c              | 2 +-
 drivers/pinctrl/pinctrl-axp209.c              | 2 +-
 drivers/pinctrl/pinctrl-cy8c95x0.c            | 2 +-
 drivers/pinctrl/pinctrl-ingenic.c             | 2 +-
 drivers/pinctrl/pinctrl-ocelot.c              | 2 +-
 drivers/pinctrl/pinctrl-rk805.c               | 2 +-
 drivers/pinctrl/pinctrl-st.c                  | 2 +-
 drivers/pinctrl/renesas/gpio.c                | 2 +-
 drivers/pinctrl/stm32/pinctrl-stm32.c         | 2 +-
 drivers/pinctrl/vt8500/pinctrl-wmt.c          | 2 +-
 include/linux/pinctrl/consumer.h              | 6 +++---
 26 files changed, 30 insertions(+), 30 deletions(-)
drivers/gpio/gpio-mvebu.c +1 -1
index 8fada9cd258a..20f788240481 100644
@@ -345,7 +345,7 @@ static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned int pin)
 	 * Check with the pinctrl driver whether this pin is usable as
 	 * an input GPIO
 	 */
-	ret = pinctrl_gpio_direction_input_new(chip, pin);
+	ret = pinctrl_gpio_direction_input(chip, pin);
 	if (ret)
 		return ret;
 
drivers/gpio/gpio-pxa.c +1 -1
index 2fd797b91270..c60197d5fde0 100644
@@ -260,7 +260,7 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 	int ret;
 
 	if (pxa_gpio_has_pinctrl()) {
-		ret = pinctrl_gpio_direction_input_new(chip, offset);
+		ret = pinctrl_gpio_direction_input(chip, offset);
 		if (ret)
 			return ret;
 	}
drivers/gpio/gpio-rockchip.c +1 -1
index 3576793f0bd9..05afb67fd677 100644
@@ -159,7 +159,7 @@ static int rockchip_gpio_set_direction(struct gpio_chip *chip,
 
 
 	if (input)
-		pinctrl_gpio_direction_input_new(chip, offset);
+		pinctrl_gpio_direction_input(chip, offset);
 	else
 		pinctrl_gpio_direction_output_new(chip, offset);
 
drivers/gpio/gpio-tegra.c +1 -1
index fcb3b474d1df..a9a00b28cc55 100644
@@ -179,7 +179,7 @@ static int tegra_gpio_direction_input(struct gpio_chip *chip,
 	tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 0);
 	tegra_gpio_enable(tgi, offset);
 
-	ret = pinctrl_gpio_direction_input_new(chip, offset);
+	ret = pinctrl_gpio_direction_input(chip, offset);
 	if (ret < 0)
 		dev_err(tgi->dev,
 			"Failed to set pinctrl input direction of GPIO %d: %d",
drivers/gpio/gpio-vf610.c +1 -1
index 32142b9564f9..6551f80c3e51 100644
@@ -116,7 +116,7 @@ static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
 		vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
 	}
 
-	return pinctrl_gpio_direction_input_new(chip, gpio);
+	return pinctrl_gpio_direction_input(chip, gpio);
 }
 
 static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
drivers/pinctrl/cirrus/pinctrl-cs42l43.c +1 -1
index 097e4dcdda36..e35964359381 100644
@@ -508,7 +508,7 @@ static void cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset, int va
 
 static int cs42l43_gpio_direction_in(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
drivers/pinctrl/core.c +3 -3
index f0fe3de09fee..d5a800ff190d 100644
@@ -859,7 +859,7 @@ pinctrl_gpio_direction(struct gpio_chip *gc, unsigned int offset, bool input)
 }
 
 /**
- * pinctrl_gpio_direction_input_new() - request a GPIO pin to go into input mode
+ * pinctrl_gpio_direction_input() - request a GPIO pin to go into input mode
  * @gc: GPIO chip structure from the GPIO subsystem
  * @offset: hardware offset of the GPIO relative to the controller
  *
@@ -867,11 +867,11 @@ pinctrl_gpio_direction(struct gpio_chip *gc, unsigned int offset, bool input)
  * as part of their gpio_direction_input() semantics, platforms and individual
  * drivers shall *NOT* touch pin control GPIO calls.
  */
-int pinctrl_gpio_direction_input_new(struct gpio_chip *gc, unsigned int offset)
+int pinctrl_gpio_direction_input(struct gpio_chip *gc, unsigned int offset)
 {
 	return pinctrl_gpio_direction(gc, offset, true);
 }
-EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input_new);
+EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
 
 /**
  * pinctrl_gpio_direction_output_new() - request a GPIO pin to go into output
drivers/pinctrl/intel/pinctrl-cherryview.c +1 -1
index 56a6b67d8380..7d6532066c83 100644
@@ -1172,7 +1172,7 @@ static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 
 static int chv_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int chv_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
drivers/pinctrl/intel/pinctrl-intel.c +1 -1
index 4897c8425391..b53159611c56 100644
@@ -990,7 +990,7 @@ static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 
 static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
drivers/pinctrl/intel/pinctrl-lynxpoint.c +1 -1
index 544ea8a607c9..6dbf2537016e 100644
@@ -545,7 +545,7 @@ static void lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
 
 static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int lp_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
drivers/pinctrl/mediatek/pinctrl-moore.c +1 -1
index dc41ffa31357..5a5ec00e32ea 100644
@@ -512,7 +512,7 @@ static void mtk_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
 
 static int mtk_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio)
 {
-	return pinctrl_gpio_direction_input_new(chip, gpio);
+	return pinctrl_gpio_direction_input(chip, gpio);
 }
 
 static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
drivers/pinctrl/mediatek/pinctrl-mtk-common.c +1 -1
index fc046415b567..b2dc3072050a 100644
@@ -811,7 +811,7 @@ static const struct pinmux_ops mtk_pmx_ops = {
 static int mtk_gpio_direction_input(struct gpio_chip *chip,
 					unsigned offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int mtk_gpio_direction_output(struct gpio_chip *chip,
drivers/pinctrl/mediatek/pinctrl-paris.c +1 -1
index 14b151aec2f9..d8c969e506ce 100644
@@ -916,7 +916,7 @@ static int mtk_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio)
 	if (gpio >= hw->soc->npins)
 		return -EINVAL;
 
-	return pinctrl_gpio_direction_input_new(chip, gpio);
+	return pinctrl_gpio_direction_input(chip, gpio);
 }
 
 static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +1 -1
index ab7cfc1e66f0..d7ce67242248 100644
@@ -171,7 +171,7 @@ static int npcmgpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 	struct npcm7xx_gpio *bank = gpiochip_get_data(chip);
 	int ret;
 
-	ret = pinctrl_gpio_direction_input_new(chip, offset);
+	ret = pinctrl_gpio_direction_input(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c +1 -1
index 78dbeef6af86..c22513e30068 100644
@@ -173,7 +173,7 @@ static int npcmgpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 	struct npcm8xx_gpio *bank = gpiochip_get_data(chip);
 	int ret;
 
-	ret = pinctrl_gpio_direction_input_new(chip, offset);
+	ret = pinctrl_gpio_direction_input(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/pinctrl-as3722.c +1 -1
index 3d3adf9793fb..3f27da80adde 100644
@@ -502,7 +502,7 @@ static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
 
 static int as3722_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int as3722_gpio_direction_output(struct gpio_chip *chip,
drivers/pinctrl/pinctrl-axp209.c +1 -1
index d7f081f1d1f6..a6eb3b866a23 100644
@@ -126,7 +126,7 @@ static int axp20x_gpio_get_reg(unsigned int offset)
 
 static int axp20x_gpio_input(struct gpio_chip *chip, unsigned int offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset)
drivers/pinctrl/pinctrl-cy8c95x0.c +1 -1
index 8c6006353515..729c13a249ef 100644
@@ -554,7 +554,7 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
 
 static int cy8c95x0_gpio_direction_input(struct gpio_chip *gc, unsigned int off)
 {
-	return pinctrl_gpio_direction_input_new(gc, off);
+	return pinctrl_gpio_direction_input(gc, off);
 }
 
 static int cy8c95x0_gpio_direction_output(struct gpio_chip *gc,
drivers/pinctrl/pinctrl-ingenic.c +1 -1
index 5072fb907193..df36141edbf3 100644
@@ -3563,7 +3563,7 @@ static int ingenic_gpio_get(struct gpio_chip *gc, unsigned int offset)
 static int ingenic_gpio_direction_input(struct gpio_chip *gc,
 		unsigned int offset)
 {
-	return pinctrl_gpio_direction_input_new(gc, offset);
+	return pinctrl_gpio_direction_input(gc, offset);
 }
 
 static int ingenic_gpio_direction_output(struct gpio_chip *gc,
drivers/pinctrl/pinctrl-ocelot.c +1 -1
index a6022d44ad6c..d02d16084f33 100644
@@ -1779,7 +1779,7 @@ static int ocelot_gpio_get_direction(struct gpio_chip *chip,
 static int ocelot_gpio_direction_input(struct gpio_chip *chip,
 				       unsigned int offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int ocelot_gpio_direction_output(struct gpio_chip *chip,
drivers/pinctrl/pinctrl-rk805.c +1 -1
index 58e6dd932bc7..f0feb3a8e630 100644
@@ -289,7 +289,7 @@ static void rk805_gpio_set(struct gpio_chip *chip,
 static int rk805_gpio_direction_input(struct gpio_chip *chip,
 				      unsigned int offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int rk805_gpio_direction_output(struct gpio_chip *chip,
drivers/pinctrl/pinctrl-st.c +1 -1
index ec763572ab3e..3f6631716779 100644
@@ -719,7 +719,7 @@ static void st_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int st_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	pinctrl_gpio_direction_input_new(chip, offset);
+	pinctrl_gpio_direction_input(chip, offset);
 
 	return 0;
 }
drivers/pinctrl/renesas/gpio.c +1 -1
index b39125a632b0..54346b7fcdef 100644
@@ -164,7 +164,7 @@ static void gpio_pin_set_value(struct sh_pfc_chip *chip, unsigned offset,
 
 static int gpio_pin_direction_input(struct gpio_chip *gc, unsigned offset)
 {
-	return pinctrl_gpio_direction_input_new(gc, offset);
+	return pinctrl_gpio_direction_input(gc, offset);
 }
 
 static int gpio_pin_direction_output(struct gpio_chip *gc, unsigned offset,
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -1
index e4453fa58f9e..cbe306f47c0a 100644
@@ -241,7 +241,7 @@ static void stm32_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int stm32_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int stm32_gpio_direction_output(struct gpio_chip *chip,
drivers/pinctrl/vt8500/pinctrl-wmt.c +1 -1
index 1a313295611e..54cd556a16b8 100644
@@ -528,7 +528,7 @@ static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset,
 
 static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	return pinctrl_gpio_direction_input_new(chip, offset);
+	return pinctrl_gpio_direction_input(chip, offset);
 }
 
 static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
include/linux/pinctrl/consumer.h +3 -3
index 55b465edaff1..9531595d1abd 100644
@@ -29,8 +29,8 @@ struct pinctrl_state;
 bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset);
 int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset);
 void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset);
-int pinctrl_gpio_direction_input_new(struct gpio_chip *gc,
-				     unsigned int offset);
+int pinctrl_gpio_direction_input(struct gpio_chip *gc,
+				 unsigned int offset);
 int pinctrl_gpio_direction_output_new(struct gpio_chip *gc,
 				      unsigned int offset);
 int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
@@ -85,7 +85,7 @@ pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset)
 }
 
 static inline int
-pinctrl_gpio_direction_input_new(struct gpio_chip *gc, unsigned int offset)
+pinctrl_gpio_direction_input(struct gpio_chip *gc, unsigned int offset)
 {
 	return 0;
 }
Signature · 1 line
2.39.2
#65 lore raw

Re: [PATCH 34/36] treewide: rename pinctrl_gpio_direction_input_new()

Quoted 5 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_direction_input() is no longer used, let's drop the '_new' suffix from its improved variant.

This and other "treewide" patches in the series are redundant. Just name the functions better to begin with.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#66 lore raw

Re: [PATCH 34/36] treewide: rename pinctrl_gpio_direction_input_new()

Quoted 11 lines · Andy Shevchenko
Quoted 5 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_direction_input() is no longer used, let's drop the '_new' suffix from its improved variant.

This and other "treewide" patches in the series are redundant. Just name the functions better to begin with.

I don't want to rename these functions. They have perfectly fine names. I want to change their signatures and the renaming part is there only to make the reviewing easier.

Bart

#67 lore raw

Re: [PATCH 34/36] treewide: rename pinctrl_gpio_direction_input_new()

Quoted 9 lines · Bartosz Golaszewski
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_direction_input() is no longer used, let's drop the '_new' suffix from its improved variant.

Quoted 6 lines
Quoted 2 lines

This and other "treewide" patches in the series are redundant. Just name the functions better to begin with.

I don't want to rename these functions. They have perfectly fine names. I want to change their signatures and the renaming part is there only to make the reviewing easier.

So, then you can make them macros and based on the type of the first argument use either old or new API, which you then make public. The all noise with "_new" is not needed, really.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#68 lore raw

Re: [PATCH 34/36] treewide: rename pinctrl_gpio_direction_input_new()

Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Bartosz Golaszewski
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_direction_input() is no longer used, let's drop the '_new' suffix from its improved variant.

This and other "treewide" patches in the series are redundant. Just name the functions better to begin with.

Quoted 7 lines
Quoted 3 lines

I don't want to rename these functions. They have perfectly fine names. I want to change their signatures and the renaming part is there only to make the reviewing easier.

So, then you can make them macros and based on the type of the first argument use either old or new API, which you then make public. The all noise with "_new" is not needed, really.

To elaborate:

First patch splits existing functions to the macros that use _Generic(), and old ones become renamed only on the implementation side (to _old or whatever). Then you add a new ones and apply them to these macros as a second (default?) choice. Then you convert users one-by-one or whatever preference is, and at the end you kill macros with old functions and rename "_new" again in a single place (pinctrl core).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#69 lore raw

Re: [PATCH 34/36] treewide: rename pinctrl_gpio_direction_input_new()

Quoted 23 lines · Andy Shevchenko
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Bartosz Golaszewski
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_direction_input() is no longer used, let's drop the '_new' suffix from its improved variant.

This and other "treewide" patches in the series are redundant. Just name the functions better to begin with.

Quoted 7 lines
Quoted 3 lines

I don't want to rename these functions. They have perfectly fine names. I want to change their signatures and the renaming part is there only to make the reviewing easier.

So, then you can make them macros and based on the type of the first argument use either old or new API, which you then make public. The all noise with "_new" is not needed, really.

Quoted 9 lines

To elaborate:

First patch splits existing functions to the macros that use _Generic(), and old ones become renamed only on the implementation side (to _old or whatever). Then you add a new ones and apply them to these macros as a second (default?) choice. Then you convert users one-by-one or whatever preference is, and at the end you kill macros with old functions and rename "_new" again in a single place (pinctrl core).

At which point do we go from "unsigned gpio" to "struct gpio_chip *gc, unsigned int offset" as arguments here?

Bart

#70 lore raw

PATCH 35/36 treewide: rename pinctrl_gpio_direction_output_new()

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_direction_output() is no longer used, let's drop the '_new' suffix from its improved variant.

---
 drivers/gpio/gpio-mvebu.c                     | 2 +-
 drivers/gpio/gpio-pxa.c                       | 2 +-
 drivers/gpio/gpio-rockchip.c                  | 2 +-
 drivers/gpio/gpio-tegra.c                     | 2 +-
 drivers/gpio/gpio-vf610.c                     | 2 +-
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c      | 2 +-
 drivers/pinctrl/cirrus/pinctrl-lochnagar.c    | 2 +-
 drivers/pinctrl/core.c                        | 7 +++----
 drivers/pinctrl/intel/pinctrl-cherryview.c    | 2 +-
 drivers/pinctrl/intel/pinctrl-intel.c         | 2 +-
 drivers/pinctrl/intel/pinctrl-lynxpoint.c     | 2 +-
 drivers/pinctrl/mediatek/pinctrl-moore.c      | 2 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
 drivers/pinctrl/mediatek/pinctrl-paris.c      | 2 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c     | 2 +-
 drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c     | 2 +-
 drivers/pinctrl/pinctrl-as3722.c              | 2 +-
 drivers/pinctrl/pinctrl-cy8c95x0.c            | 2 +-
 drivers/pinctrl/pinctrl-ingenic.c             | 4 ++--
 drivers/pinctrl/pinctrl-ocelot.c              | 2 +-
 drivers/pinctrl/pinctrl-rk805.c               | 2 +-
 drivers/pinctrl/pinctrl-st.c                  | 2 +-
 drivers/pinctrl/renesas/gpio.c                | 2 +-
 drivers/pinctrl/stm32/pinctrl-stm32.c         | 2 +-
 drivers/pinctrl/vt8500/pinctrl-wmt.c          | 2 +-
 include/linux/pinctrl/consumer.h              | 6 +++---
 26 files changed, 31 insertions(+), 32 deletions(-)
drivers/gpio/gpio-mvebu.c +1 -1
index 20f788240481..6abb1b1139fe 100644
@@ -365,7 +365,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
 	 * Check with the pinctrl driver whether this pin is usable as
 	 * an output GPIO
 	 */
-	ret = pinctrl_gpio_direction_output_new(chip, pin);
+	ret = pinctrl_gpio_direction_output(chip, pin);
 	if (ret)
 		return ret;
 
drivers/gpio/gpio-pxa.c +1 -1
index c60197d5fde0..91cea97255fa 100644
@@ -289,7 +289,7 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
 	writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
 
 	if (pxa_gpio_has_pinctrl()) {
-		ret = pinctrl_gpio_direction_output_new(chip, offset);
+		ret = pinctrl_gpio_direction_output(chip, offset);
 		if (ret)
 			return ret;
 	}
drivers/gpio/gpio-rockchip.c +1 -1
index 05afb67fd677..0bd339813110 100644
@@ -161,7 +161,7 @@ static int rockchip_gpio_set_direction(struct gpio_chip *chip,
 	if (input)
 		pinctrl_gpio_direction_input(chip, offset);
 	else
-		pinctrl_gpio_direction_output_new(chip, offset);
+		pinctrl_gpio_direction_output(chip, offset);
 
 	raw_spin_lock_irqsave(&bank->slock, flags);
 	rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr);
drivers/gpio/gpio-tegra.c +1 -1
index a9a00b28cc55..adfbed62eff1 100644
@@ -199,7 +199,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip,
 	tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 1);
 	tegra_gpio_enable(tgi, offset);
 
-	ret = pinctrl_gpio_direction_output_new(chip, offset);
+	ret = pinctrl_gpio_direction_output(chip, offset);
 	if (ret < 0)
 		dev_err(tgi->dev,
 			"Failed to set pinctrl output direction of GPIO %d: %d",
drivers/gpio/gpio-vf610.c +1 -1
index 6551f80c3e51..b11a6d9b1b69 100644
@@ -134,7 +134,7 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
 
 	vf610_gpio_set(chip, gpio, value);
 
-	return pinctrl_gpio_direction_output_new(chip, gpio);
+	return pinctrl_gpio_direction_output(chip, gpio);
 }
 
 static void vf610_gpio_irq_handler(struct irq_desc *desc)
drivers/pinctrl/cirrus/pinctrl-cs42l43.c +1 -1
index e35964359381..1ba89cf279fb 100644
@@ -516,7 +516,7 @@ static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
 {
 	cs42l43_gpio_set(chip, offset, value);
 
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static int cs42l43_gpio_add_pin_ranges(struct gpio_chip *chip)
drivers/pinctrl/cirrus/pinctrl-lochnagar.c +1 -1
index f3c8a8c14e14..014297a3fbd2 100644
@@ -1098,7 +1098,7 @@ static int lochnagar_gpio_direction_out(struct gpio_chip *chip,
 {
 	lochnagar_gpio_set(chip, offset, value);
 
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static int lochnagar_fill_func_groups(struct lochnagar_pin_priv *priv)
drivers/pinctrl/core.c +3 -4
index d5a800ff190d..5f40abef5c1e 100644
@@ -874,8 +874,7 @@ int pinctrl_gpio_direction_input(struct gpio_chip *gc, unsigned int offset)
 EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
 
 /**
- * pinctrl_gpio_direction_output_new() - request a GPIO pin to go into output
- *                                       mode
+ * pinctrl_gpio_direction_output() - request a GPIO pin to go into output mode
  * @gc: GPIO chip structure from the GPIO subsystem
  * @offset: hardware offset of the GPIO relative to the controller
  *
@@ -883,11 +882,11 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
  * as part of their gpio_direction_output() semantics, platforms and individual
  * drivers shall *NOT* touch pin control GPIO calls.
  */
-int pinctrl_gpio_direction_output_new(struct gpio_chip *gc, unsigned int offset)
+int pinctrl_gpio_direction_output(struct gpio_chip *gc, unsigned int offset)
 {
 	return pinctrl_gpio_direction(gc, offset, false);
 }
-EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output_new);
+EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
 
 /**
  * pinctrl_gpio_set_config_new() - Apply config to given GPIO pin
drivers/pinctrl/intel/pinctrl-cherryview.c +1 -1
index 7d6532066c83..6ab5953b858a 100644
@@ -1179,7 +1179,7 @@ static int chv_gpio_direction_output(struct gpio_chip *chip, unsigned int offset
 				     int value)
 {
 	chv_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static const struct gpio_chip chv_gpio_chip = {
drivers/pinctrl/intel/pinctrl-intel.c +1 -1
index b53159611c56..151d4356e6a6 100644
@@ -997,7 +997,7 @@ static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offs
 				       int value)
 {
 	intel_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static const struct gpio_chip intel_gpio_chip = {
drivers/pinctrl/intel/pinctrl-lynxpoint.c +1 -1
index 6dbf2537016e..0bc83a0ba75f 100644
@@ -553,7 +553,7 @@ static int lp_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
 {
 	lp_gpio_set(chip, offset, value);
 
-	return pinctrl_gpio_direction_output_new(chip,  offset);
+	return pinctrl_gpio_direction_output(chip,  offset);
 }
 
 static int lp_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
drivers/pinctrl/mediatek/pinctrl-moore.c +1 -1
index 5a5ec00e32ea..c3f33f96f920 100644
@@ -520,7 +520,7 @@ static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
 {
 	mtk_gpio_set(chip, gpio, value);
 
-	return pinctrl_gpio_direction_output_new(chip, gpio);
+	return pinctrl_gpio_direction_output(chip, gpio);
 }
 
 static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
drivers/pinctrl/mediatek/pinctrl-mtk-common.c +1 -1
index b2dc3072050a..41e9847e3085 100644
@@ -818,7 +818,7 @@ static int mtk_gpio_direction_output(struct gpio_chip *chip,
 					unsigned offset, int value)
 {
 	mtk_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static int mtk_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
drivers/pinctrl/mediatek/pinctrl-paris.c +1 -1
index d8c969e506ce..6392f1e05d02 100644
@@ -929,7 +929,7 @@ static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
 
 	mtk_gpio_set(chip, gpio, value);
 
-	return pinctrl_gpio_direction_output_new(chip, gpio);
+	return pinctrl_gpio_direction_output(chip, gpio);
 }
 
 static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +1 -1
index d7ce67242248..51aeac7ecc79 100644
@@ -188,7 +188,7 @@ static int npcmgpio_direction_output(struct gpio_chip *chip,
 	dev_dbg(chip->parent, "gpio_direction_output: offset%d = %x\n", offset,
 		value);
 
-	ret = pinctrl_gpio_direction_output_new(chip, offset);
+	ret = pinctrl_gpio_direction_output(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c +1 -1
index c22513e30068..140fdbbe8458 100644
@@ -186,7 +186,7 @@ static int npcmgpio_direction_output(struct gpio_chip *chip,
 	struct npcm8xx_gpio *bank = gpiochip_get_data(chip);
 	int ret;
 
-	ret = pinctrl_gpio_direction_output_new(chip, offset);
+	ret = pinctrl_gpio_direction_output(chip, offset);
 	if (ret)
 		return ret;
 
drivers/pinctrl/pinctrl-as3722.c +1 -1
index 3f27da80adde..4151656f6245 100644
@@ -509,7 +509,7 @@ static int as3722_gpio_direction_output(struct gpio_chip *chip,
 		unsigned offset, int value)
 {
 	as3722_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
drivers/pinctrl/pinctrl-cy8c95x0.c +1 -1
index 729c13a249ef..04285c930e94 100644
@@ -571,7 +571,7 @@ static int cy8c95x0_gpio_direction_output(struct gpio_chip *gc,
 	if (ret)
 		return ret;
 
-	return pinctrl_gpio_direction_output_new(gc, off);
+	return pinctrl_gpio_direction_output(gc, off);
 }
 
 static int cy8c95x0_gpio_get_value(struct gpio_chip *gc, unsigned int off)
drivers/pinctrl/pinctrl-ingenic.c +2 -2
index df36141edbf3..ca58c9db5c2c 100644
@@ -3570,7 +3570,7 @@ static int ingenic_gpio_direction_output(struct gpio_chip *gc,
 		unsigned int offset, int value)
 {
 	ingenic_gpio_set(gc, offset, value);
-	return pinctrl_gpio_direction_output_new(gc, offset);
+	return pinctrl_gpio_direction_output(gc, offset);
 }
 
 static inline void ingenic_config_pin(struct ingenic_pinctrl *jzpc,
@@ -4054,7 +4054,7 @@ static int ingenic_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
 			break;
 
 		case PIN_CONFIG_OUTPUT:
-			ret = pinctrl_gpio_direction_output_new(jzpc->gc,
+			ret = pinctrl_gpio_direction_output(jzpc->gc,
 							pin - jzpc->gc->base);
 			if (ret)
 				return ret;
drivers/pinctrl/pinctrl-ocelot.c +1 -1
index d02d16084f33..96b4e9fceb78 100644
@@ -1795,7 +1795,7 @@ static int ocelot_gpio_direction_output(struct gpio_chip *chip,
 		regmap_write(info->map, REG(OCELOT_GPIO_OUT_CLR, info, offset),
 			     pin);
 
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static const struct gpio_chip ocelot_gpiolib_chip = {
drivers/pinctrl/pinctrl-rk805.c +1 -1
index f0feb3a8e630..968f066eb9da 100644
@@ -296,7 +296,7 @@ static int rk805_gpio_direction_output(struct gpio_chip *chip,
 				       unsigned int offset, int value)
 {
 	rk805_gpio_set(chip, offset, value);
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static int rk805_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
drivers/pinctrl/pinctrl-st.c +1 -1
index 3f6631716779..db511dbd50e5 100644
@@ -730,7 +730,7 @@ static int st_gpio_direction_output(struct gpio_chip *chip,
 	struct st_gpio_bank *bank = gpiochip_get_data(chip);
 
 	__st_gpio_set(bank, offset, value);
-	pinctrl_gpio_direction_output_new(chip, offset);
+	pinctrl_gpio_direction_output(chip, offset);
 
 	return 0;
 }
drivers/pinctrl/renesas/gpio.c +1 -1
index 54346b7fcdef..a5136dacaaf2 100644
@@ -172,7 +172,7 @@ static int gpio_pin_direction_output(struct gpio_chip *gc, unsigned offset,
 {
 	gpio_pin_set_value(gpiochip_get_data(gc), offset, value);
 
-	return pinctrl_gpio_direction_output_new(gc, offset);
+	return pinctrl_gpio_direction_output(gc, offset);
 }
 
 static int gpio_pin_get(struct gpio_chip *gc, unsigned offset)
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -1
index cbe306f47c0a..917b87acbf0d 100644
@@ -250,7 +250,7 @@ static int stm32_gpio_direction_output(struct gpio_chip *chip,
 	struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
 
 	__stm32_gpio_set(bank, offset, value);
-	pinctrl_gpio_direction_output_new(chip, offset);
+	pinctrl_gpio_direction_output(chip, offset);
 
 	return 0;
 }
drivers/pinctrl/vt8500/pinctrl-wmt.c +1 -1
index 54cd556a16b8..639446bba373 100644
@@ -535,7 +535,7 @@ static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
 				     int value)
 {
 	wmt_gpio_set_value(chip, offset, value);
-	return pinctrl_gpio_direction_output_new(chip, offset);
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 static const struct gpio_chip wmt_gpio_chip = {
include/linux/pinctrl/consumer.h +3 -3
index 9531595d1abd..e7d660e98e86 100644
@@ -31,8 +31,8 @@ int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset);
 void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset);
 int pinctrl_gpio_direction_input(struct gpio_chip *gc,
 				 unsigned int offset);
-int pinctrl_gpio_direction_output_new(struct gpio_chip *gc,
-				      unsigned int offset);
+int pinctrl_gpio_direction_output(struct gpio_chip *gc,
+				  unsigned int offset);
 int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
 				unsigned long config);
 
@@ -91,7 +91,7 @@ pinctrl_gpio_direction_input(struct gpio_chip *gc, unsigned int offset)
 }
 
 static inline int
-pinctrl_gpio_direction_output_new(struct gpio_chip *gc, unsigned int offset)
+pinctrl_gpio_direction_output(struct gpio_chip *gc, unsigned int offset)
 {
 	return 0;
 }
Signature · 1 line
2.39.2
#71 lore raw

PATCH 36/36 treewide: rename pinctrl_gpio_set_config_new()

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that pinctrl_gpio_set_config() is no longer used, let's drop the '_new' suffix from its improved variant.

---
 drivers/gpio/gpio-aspeed.c       | 2 +-
 drivers/gpio/gpiolib.c           | 2 +-
 drivers/pinctrl/core.c           | 6 +++---
 include/linux/pinctrl/consumer.h | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpio/gpio-aspeed.c +1 -1
index 4c417c8486dd..04c03402db6d 100644
@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
 	else if (param == PIN_CONFIG_BIAS_DISABLE ||
 			param == PIN_CONFIG_BIAS_PULL_DOWN ||
 			param == PIN_CONFIG_DRIVE_STRENGTH)
-		return pinctrl_gpio_set_config_new(chip, offset, config);
+		return pinctrl_gpio_set_config(chip, offset, config);
 	else if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN ||
 			param == PIN_CONFIG_DRIVE_OPEN_SOURCE)
 		/* Return -ENOTSUPP to trigger emulation, as per datasheet */
drivers/gpio/gpiolib.c +1 -1
index d7c23be24904..d9db880593b6 100644
@@ -1883,7 +1883,7 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_free);
 int gpiochip_generic_config(struct gpio_chip *gc, unsigned int offset,
 			    unsigned long config)
 {
-	return pinctrl_gpio_set_config_new(gc, offset, config);
+	return pinctrl_gpio_set_config(gc, offset, config);
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_config);
 
drivers/pinctrl/core.c +3 -3
index 5f40abef5c1e..6d427c22e57b 100644
@@ -889,7 +889,7 @@ int pinctrl_gpio_direction_output(struct gpio_chip *gc, unsigned int offset)
 EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
 
 /**
- * pinctrl_gpio_set_config_new() - Apply config to given GPIO pin
+ * pinctrl_gpio_set_config() - Apply config to given GPIO pin
  * @gc: GPIO chip structure from the GPIO subsystem
  * @offset: hardware offset of the GPIO relative to the controller
  * @config: the configuration to apply to the GPIO
@@ -898,7 +898,7 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
  * they need to call the underlying pin controller to change GPIO config
  * (for example set debounce time).
  */
-int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
+int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
 				unsigned long config)
 {
 	unsigned long configs[] = { config };
@@ -918,7 +918,7 @@ int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config_new);
+EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config);
 
 static struct pinctrl_state *find_state(struct pinctrl *p,
 					const char *name)
include/linux/pinctrl/consumer.h +2 -2
index e7d660e98e86..73de70362b98 100644
@@ -33,7 +33,7 @@ int pinctrl_gpio_direction_input(struct gpio_chip *gc,
 				 unsigned int offset);
 int pinctrl_gpio_direction_output(struct gpio_chip *gc,
 				  unsigned int offset);
-int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
+int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
 				unsigned long config);
 
 struct pinctrl * __must_check pinctrl_get(struct device *dev);
@@ -97,7 +97,7 @@ pinctrl_gpio_direction_output(struct gpio_chip *gc, unsigned int offset)
 }
 
 static inline int
-pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
+pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
 			    unsigned long config)
 {
 	return 0;
Signature · 1 line
2.39.2
Reviewed-by on the v1 series
#72 lore raw
In reply to Bartosz Golaszewski
Quoted 11 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

We have a set of pinctrl helpers for GPIOLIB drivers that take a number from the global GPIO numberspace as argument. We are trying to get rid of this global numbering. Let's rework these helpers to use the recommended gpio_chip + controller-relative offset instead.

This work is split into phases: first let's introduce the new variants of the helpers. Next: let's convert all users one-by-one for easier review. Finally let's remove the old helpers and rename the new variants to take the place of the old ones.

Almost too good attention to process here, I hope you used some tooling and didn't do all this by hand...

I reviewed it by applying the lot with b4 on a branch off my devel branch, and

git diff devel..HEAD

which shows what the goal of the patches is and since the kernel clearly looks better after than before the patches:

Or I can just merge this branch into my devel (for v6.7) branch, and offer you the same as immutable. Which is my plan.

Shall I just do it?

Yours,
Linus Walleij

#73 lore raw
Quoted 23 lines · Linus Walleij
Quoted 11 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

We have a set of pinctrl helpers for GPIOLIB drivers that take a number from the global GPIO numberspace as argument. We are trying to get rid of this global numbering. Let's rework these helpers to use the recommended gpio_chip + controller-relative offset instead.

This work is split into phases: first let's introduce the new variants of the helpers. Next: let's convert all users one-by-one for easier review. Finally let's remove the old helpers and rename the new variants to take the place of the old ones.

Almost too good attention to process here, I hope you used some tooling and didn't do all this by hand...

I reviewed it by applying the lot with b4 on a branch off my devel branch, and

git diff devel..HEAD

Quoted 8 lines

which shows what the goal of the patches is and since the kernel clearly looks better after than before the patches:

Or I can just merge this branch into my devel (for v6.7) branch, and offer you the same as immutable. Which is my plan.

I'll need to send a v2 because there was an issue with one of the stub declarations and I think we should let it rest on the list for a week but eventually I think you should just pick up the entire series and if anything new for the GPIO tree conflicts then we can deal with immutable tags.

What is your view on Andy's and Kent's issues with the _new() name suffix? My argument is that it's just temporary and will be gone once you apply the entire series. Bikeshedding about a temp name is just unnecessary churn and _new() is as good as anything else.

Bart

Quoted 4 lines

Shall I just do it?

Yours,
Linus Walleij

#74 lore raw
Quoted 2 lines · Bartosz Golaszewski

What is your view on Andy's and Kent's issues with the _new() name suffix?

We have done similar operations in the past, and it is similar to what Uwe is doing for the moment with the .remove() callbacks.

Usually the strategy is employed when the work needs to be spread out over a few merge windows so it is a bit of a marker that "this is in transition".

There is the horror story of this staying around forever and becoming
idiomatic: struct napi_struct (include/linux/netdevice.h) where "napi" means "new API" - yeah that could have been handled better...

If there is more moaning about it I will simply squash all the patches into one and call it a day - the end result will be the same and no sign of any *_new suffix anywhere. It was still worth it for reviewing the driver changes on a per-driver basis so then it becomes one of those Schopenhauer ladders that you can toss away after climbing it.

Yours,
Linus Walleij

#75 lore raw
Quoted 15 lines · Linus Walleij
Quoted 2 lines · Bartosz Golaszewski

What is your view on Andy's and Kent's issues with the _new() name suffix?

We have done similar operations in the past, and it is similar to what Uwe is doing for the moment with the .remove() callbacks.

Usually the strategy is employed when the work needs to be spread out over a few merge windows so it is a bit of a marker that "this is in transition".

There is the horror story of this staying around forever and becoming
idiomatic: struct napi_struct (include/linux/netdevice.h) where "napi" means "new API" - yeah that could have been handled better...

Quoted 6 lines

If there is more moaning about it I will simply squash all the patches into one and call it a day - the end result will be the same and no sign of any *_new suffix anywhere. It was still worth it for reviewing the driver changes on a per-driver basis so then it becomes one of those Schopenhauer ladders that you can toss away after climbing it.

You can go with a compromise and name it better from the start, so at least the patches that are taking care of renaming back won't be needed.
Another way to have three or so patches with combined efforts, but still...

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#76 lore raw
Quoted 24 lines · Andy Shevchenko
Quoted 15 lines · Linus Walleij
Quoted 2 lines · Bartosz Golaszewski

What is your view on Andy's and Kent's issues with the _new() name suffix?

We have done similar operations in the past, and it is similar to what Uwe is doing for the moment with the .remove() callbacks.

Usually the strategy is employed when the work needs to be spread out over a few merge windows so it is a bit of a marker that "this is in transition".

There is the horror story of this staying around forever and becoming
idiomatic: struct napi_struct (include/linux/netdevice.h) where "napi" means "new API" - yeah that could have been handled better...

Quoted 6 lines

If there is more moaning about it I will simply squash all the patches into one and call it a day - the end result will be the same and no sign of any *_new suffix anywhere. It was still worth it for reviewing the driver changes on a per-driver basis so then it becomes one of those Schopenhauer ladders that you can toss away after climbing it.

Quoted 3 lines

You can go with a compromise and name it better from the start, so at least the patches that are taking care of renaming back won't be needed.

What are you talking about?! The names are *FINE*. I DON'T want to change them. I want to keep them. The temporary renaming is there to make the review process easier but the end effect is that the names stay the same with only the signature changed.

Bart

Quoted 2 lines

Another way to have three or so patches with combined efforts, but still...

#77 lore raw
Quoted 6 lines · Bartosz Golaszewski
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Linus Walleij
Quoted 2 lines · Bartosz Golaszewski

What is your view on Andy's and Kent's issues with the _new() name suffix?

...

Quoted 8 lines
Quoted 3 lines

You can go with a compromise and name it better from the start, so at least the patches that are taking care of renaming back won't be needed.

What are you talking about?! The names are *FINE*. I DON'T want to change them. I want to keep them. The temporary renaming is there to make the review process easier but the end effect is that the names stay the same with only the signature changed.

I just replied how to leave with renamings done only in a single place (pinctrl core). Would it work for you?

Quoted 1 line
Quoted 1 line

Another way to have three or so patches with combined efforts, but still...

Signature · 2 lines
With Best Regards,
Andy Shevchenko