2023-10-17 12:05:02

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 00/73] 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. After that let's remove the old helpers and rename the new
variants to take the place of the old ones. Finally convert static
functions in pinctrl/core.c to using the same signature and to top it
off, let's remove now redundant wrappers around the pinctrl_helpers.

This series introduces no functional changes in drivers so I decided to
not spam every single driver maintainer anymore.

As this is a big series and there already are conflicts between it and
current pinctrl tree, I plan on sending it as a separate PR later in the
merge window once the bulk of GPIO and pinctrl changes are already
in master.

v2 -> v3:
- split patches modifying multiple drivers at once into separate
changesets
- fix build errors reported by autobuilders

v1 -> v2:
- drop the conversion to using cleanup.h helpers as this is not the
subject of this series
- split the patch renaming the new variants to the old names into
several patches that perform the operation step by step for easier
review
- collect review tags and acks
- add follow-up patches that drop the wrappers around pinctrl helpers
where applicable (where all the wrappers do is call the helper)
- fix build error with PINCTRL disabled

Bartosz Golaszewski (73):
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: npcm7xx: use new pinctrl GPIO helpers
pinctrl: nuvoton: npcm8xx: 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: jh7100: use new pinctrl GPIO helpers
pinctrl: starfive: jh7110: 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: moore: use new pinctrl GPIO helpers
pinctrl: mediatek: common: use new pinctrl GPIO helpers
pinctrl: mediatek: paris: 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: cherryview: use new pinctrl GPIO helpers
pinctrl: intel: use new pinctrl GPIO helpers
pinctrl: intel: lynxpoint: use new pinctrl GPIO helpers
pinctrl: st: use new pinctrl GPIO helpers
pinctrl: remove pinctrl_gpio_can_use_line()
pinctrl: remove pinctrl_gpio_request()
pinctrl: remove pinctrl_gpio_free()
pinctrl: remove pinctrl_gpio_direction_input()
pinctrl: remove pinctrl_gpio_direction_output()
pinctrl: remove pinctrl_gpio_set_config()
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()
pinctrl: change the signature of pinctrl_gpio_direction()
pinctrl: change the signature of pinctrl_get_device_gpio_range()
pinctrl: change the signature of pinctrl_match_gpio_range()
pinctrl: change the signature of gpio_to_pin()
pinctrl: change the signature of pinctrl_ready_for_gpio_range()
pinctrl: intel: lynxpoint: drop the wrappers around
pinctrl_gpio_direction_input()
pinctrl: intel: drop the wrappers around
pinctrl_gpio_direction_input()
pinctrl: intel: cherryview: drop the wrappers around
pinctrl_gpio_direction_input()
pinctrl: st: drop the wrapper around pinctrl_gpio_direction_input()
pinctrl: ingenic: drop the wrapper around
pinctrl_gpio_direction_input()
pinctrl: as3722: drop the wrapper around
pinctrl_gpio_direction_input()
pinctrl: cy8c95x0: drop the wrapper around
pinctrl_gpio_direction_input()
pinctrl: vt8500: drop the wrapper around
pinctrl_gpio_direction_input()
pinctrl: axp209: drop the wrapper around
pinctrl_gpio_direction_input()
pinctrl: rk805: drop the wrapper around pinctrl_gpio_direction_input()
pinctrl: mediatek: moore: drop the wrappers around
pinctrl_gpio_direction_input()
pinctrl: mediatek: common: drop the wrappers around
pinctrl_gpio_direction_input()
pinctrl: cirrus: drop the wrapper around
pinctrl_gpio_direction_input()
pinctrl: ocelot: drop the wrapper around
pinctrl_gpio_direction_input()
pinctrl: starfive: jh7100: drop wrappers around
pinctrl_gpio_request/free()
pinctrl: starfive: jh7110: drop wrappers around
pinctrl_gpio_request/free()
pinctrl: stm32: drop wrappers around pinctrl_gpio_free/input()
pinctrl: nuvoton: npcm7xx: drop wrappers around
pinctrl_gpio_request/free()
pinctrl: nuvoton: npcm8xx: drop wrappers around
pinctrl_gpio_request/free()
pinctrl: em: drop the wrapper around pinctrl_gpio_request()
pinctrl: tegra: drop the wrapper around pinctrl_gpio_request()

drivers/gpio/gpio-aspeed.c | 6 +-
drivers/gpio/gpio-em.c | 9 +-
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 | 13 +-
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 | 9 +-
drivers/pinctrl/cirrus/pinctrl-lochnagar.c | 2 +-
drivers/pinctrl/core.c | 133 ++++++++++--------
drivers/pinctrl/intel/pinctrl-cherryview.c | 9 +-
drivers/pinctrl/intel/pinctrl-intel.c | 9 +-
drivers/pinctrl/intel/pinctrl-lynxpoint.c | 9 +-
drivers/pinctrl/mediatek/pinctrl-moore.c | 9 +-
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 10 +-
drivers/pinctrl/mediatek/pinctrl-paris.c | 4 +-
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 14 +-
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 13 +-
drivers/pinctrl/pinctrl-as3722.c | 9 +-
drivers/pinctrl/pinctrl-axp209.c | 7 +-
drivers/pinctrl/pinctrl-cy8c95x0.c | 9 +-
drivers/pinctrl/pinctrl-ingenic.c | 19 ++-
drivers/pinctrl/pinctrl-ocelot.c | 10 +-
drivers/pinctrl/pinctrl-rk805.c | 10 +-
drivers/pinctrl/pinctrl-st.c | 13 +-
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 | 14 +-
.../starfive/pinctrl-starfive-jh7110.c | 14 +-
drivers/pinctrl/stm32/pinctrl-stm32.c | 20 +--
drivers/pinctrl/vt8500/pinctrl-wmt.c | 9 +-
include/linux/pinctrl/consumer.h | 57 +++++---
38 files changed, 196 insertions(+), 303 deletions(-)

--
2.39.2


2023-10-17 12:05:03

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 01/73] 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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
include/linux/pinctrl/consumer.h | 34 ++++++++++++++++----------------
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 4729d54e8995..22eef0a513ce 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -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)
{
--
2.39.2

2023-10-17 12:05:12

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 03/73] gpiolib: generic: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/gpio/gpiolib.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index cbafcd95243e..37c1df78437f 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2036,7 +2036,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);

@@ -2052,7 +2052,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);

@@ -2065,7 +2065,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);

--
2.39.2

2023-10-17 12:05:26

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 06/73] gpio: tegra: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/gpio/gpio-tegra.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index ea715582bcf3..08951ddcd294 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -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",
--
2.39.2

2023-10-17 12:05:31

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 04/73] gpio: cdev: use pinctrl_gpio_can_use_line_new()

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/gpio/gpiolib-cdev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index 31fc71a612c2..54ee075410db 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -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);

--
2.39.2

2023-10-17 12:05:38

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 07/73] gpio: em: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/gpio/gpio-em.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index 858e6ebbb584..35c65ff43f71 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -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.
--
2.39.2

2023-10-17 12:05:41

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 09/73] gpio: mvebu: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Acked-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-mvebu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index e5f2c2d2a721..c0ca0aa7b5cd 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -346,7 +346,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;

@@ -366,7 +366,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;

--
2.39.2

2023-10-17 12:05:53

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 10/73] gpio: pxa: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/gpio/gpio-pxa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index cae9661862fe..2fd797b91270 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -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;
}
--
2.39.2

2023-10-17 12:06:00

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 11/73] gpio: rockchip: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Acked-by: Heiko Stuebner <[email protected]>
---
drivers/gpio/gpio-rockchip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 23040a8cea34..3576793f0bd9 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -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);
--
2.39.2

2023-10-17 12:06:08

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 05/73] gpio: rcar: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
---
drivers/gpio/gpio-rcar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index d8b1baae6357..47121e1a6d4e 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -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
--
2.39.2

2023-10-17 12:06:15

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 13/73] pinctrl: nuvoton: npcm7xx: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index 8bdd0124e2eb..62134a7f0b4e 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -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)
--
2.39.2

2023-10-17 12:06:17

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 02/73] pinctrl: provide new GPIO-to-pinctrl glue helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/core.c | 108 ++++++++++++++++++++++---------
include/linux/pinctrl/consumer.h | 46 +++++++++++++
2 files changed, 125 insertions(+), 29 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 9900f8e9e321..6cd22829544c 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -23,6 +23,8 @@
#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 +783,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 +818,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 +855,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 +893,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 +901,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 +923,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 +959,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)
{
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 22eef0a513ce..c95c13983376 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -17,6 +17,7 @@
#include <linux/pinctrl/pinctrl-state.h>

struct device;
+struct gpio_chip;

/* This struct is private to the core and should be regarded as a cookie */
struct pinctrl;
@@ -26,11 +27,20 @@ struct pinctrl_state;

/* 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);

struct pinctrl * __must_check pinctrl_get(struct device *dev);
void pinctrl_put(struct pinctrl *p);
@@ -68,30 +78,66 @@ 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)
+{
+ return 0;
+}
+
static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
{
return NULL;
--
2.39.2

2023-10-17 12:06:20

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 12/73] gpio: vf610: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/gpio/gpio-vf610.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index a89ae84a1fa0..2c22a31ffbdc 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -130,7 +130,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,
@@ -148,7 +148,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)
--
2.39.2

2023-10-17 12:06:22

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 08/73] gpio: aspeed: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andrew Jeffery <[email protected]>
Acked-by: Uwe Kleine-König <[email protected]>
---
drivers/gpio/gpio-aspeed.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 58f107194fda..d3aa1cfd4ace 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -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(chip->base + 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 */
--
2.39.2

2023-10-17 12:06:29

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 16/73] pinctrl: bcm: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
index bc7bb9876e57..fb98c3e14743 100644
--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
@@ -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)
--
2.39.2

2023-10-17 12:06:38

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 17/73] pinctrl: stm32: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index a73385a431de..11d9f07934bd 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -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;
}
--
2.39.2

2023-10-17 12:06:39

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 15/73] pinctrl: renesas: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
---
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(-)

diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c
index 5758daf94fe2..e7771a57e6d1 100644
--- a/drivers/pinctrl/renesas/gpio.c
+++ b/drivers/pinctrl/renesas/gpio.c
@@ -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)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index c7c6d912a975..22d4ab7d228c 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -1056,7 +1056,7 @@ static int rzg2l_gpio_request(struct gpio_chip *chip, unsigned int offset)
if (ret)
return ret;

- ret = pinctrl_gpio_request(chip->base + offset);
+ ret = pinctrl_gpio_request_new(chip, offset);
if (ret)
return ret;

@@ -1181,7 +1181,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)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
index 52aeafaba4b6..3d29c77a5aad 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
@@ -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
--
2.39.2

2023-10-17 12:06:58

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 19/73] pinctrl: starfive: jh7100: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
index 530fe340a9a1..22a2db8fa315 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
@@ -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)
--
2.39.2

2023-10-17 12:07:02

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 18/73] pinctrl: spear: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
---
drivers/pinctrl/spear/pinctrl-plgpio.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
index 722681e0b89b..7488f6394318 100644
--- a/drivers/pinctrl/spear/pinctrl-plgpio.c
+++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
@@ -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 */
--
2.39.2

2023-10-17 12:07:20

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 20/73] pinctrl: starfive: jh7110: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
index 640f827a9b2c..5557ef3fbeb2 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
@@ -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

2023-10-17 12:07:24

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 23/73] pinctrl: cirrus: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Acked-by: Charles Keepax <[email protected]>
---
drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 4 ++--
drivers/pinctrl/cirrus/pinctrl-lochnagar.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index c09646318419..097e4dcdda36 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -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)
diff --git a/drivers/pinctrl/cirrus/pinctrl-lochnagar.c b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
index 0b78cf611afe..f3c8a8c14e14 100644
--- a/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
+++ b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
@@ -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)
--
2.39.2

2023-10-17 12:07:26

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 26/73] pinctrl: mediatek: paris: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/mediatek/pinctrl-paris.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index b7cb5a1f1060..14b151aec2f9 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -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)
--
2.39.2

2023-10-17 12:07:29

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 25/73] pinctrl: mediatek: common: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 74b15952b742..fc046415b567 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -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)
--
2.39.2

2023-10-17 12:07:32

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 22/73] pinctrl: rk805: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-rk805.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rk805.c b/drivers/pinctrl/pinctrl-rk805.c
index 2639a9ee82cd..58e6dd932bc7 100644
--- a/drivers/pinctrl/pinctrl-rk805.c
+++ b/drivers/pinctrl/pinctrl-rk805.c
@@ -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)
--
2.39.2

2023-10-17 12:07:35

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 28/73] pinctrl: vt8500: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/vt8500/pinctrl-wmt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c
index 6fac30de1c6a..1a313295611e 100644
--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
@@ -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 = {
--
2.39.2

2023-10-17 12:07:35

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 27/73] pinctrl: axp209: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-axp209.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index 9f5b3ab8e184..d7f081f1d1f6 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -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)
--
2.39.2

2023-10-17 12:07:47

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 34/73] pinctrl: intel: lynxpoint: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Acked-by: Mika Westerberg <[email protected]>
---
drivers/pinctrl/intel/pinctrl-lynxpoint.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index d7bc9ef29fcc..91d228fead45 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -541,7 +541,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,
@@ -549,7 +549,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)
--
2.39.2

2023-10-17 12:07:52

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 33/73] pinctrl: intel: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Acked-by: Mika Westerberg <[email protected]>
---
drivers/pinctrl/intel/pinctrl-intel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 9731a3acb23c..f403eb78f355 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -992,14 +992,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 = {
--
2.39.2

2023-10-17 12:07:57

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 29/73] pinctrl: cy8c95x0: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/pinctrl-cy8c95x0.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c
index fae80b52a6fc..8c6006353515 100644
--- a/drivers/pinctrl/pinctrl-cy8c95x0.c
+++ b/drivers/pinctrl/pinctrl-cy8c95x0.c
@@ -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

2023-10-17 12:07:58

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 14/73] pinctrl: nuvoton: npcm8xx: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index da21f6a45888..0b6d6964087e 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -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)
--
2.39.2

2023-10-17 12:08:00

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 21/73] pinctrl: ocelot: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-ocelot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index f8ae2e974221..a6022d44ad6c 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -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 = {
--
2.39.2

2023-10-17 12:08:18

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 37/73] pinctrl: remove pinctrl_gpio_request()

From: Bartosz Golaszewski <[email protected]>

There are no more users of pinctrl_gpio_request() so remove it.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/core.c | 51 ++++++++++++++------------------
include/linux/pinctrl/consumer.h | 6 ----
2 files changed, 22 insertions(+), 35 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 4a03fc1c6ba0..46e5fe90718b 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -783,34 +783,6 @@ bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int 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
@@ -822,7 +794,28 @@ 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->base + offset, &pctldev,
+ &range);
+ if (ret) {
+ if (pinctrl_ready_for_gpio_range(gc->base + offset))
+ ret = 0;
+ return ret;
+ }
+
+ mutex_lock(&pctldev->mutex);
+
+ /* Convert to the pin controllers number space */
+ pin = gpio_to_pin(range, gc->base + offset);
+
+ ret = pinmux_request_gpio(pctldev, range, pin, gc->base + offset);
+
+ mutex_unlock(&pctldev->mutex);
+
+ return ret;
}
EXPORT_SYMBOL_GPL(pinctrl_gpio_request_new);

diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 3991271cc39f..83a414a347cf 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -27,7 +27,6 @@ struct pinctrl_state;

/* External interface to pin control */
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);
@@ -78,11 +77,6 @@ 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)
{
--
2.39.2

2023-10-17 12:08:20

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 38/73] pinctrl: remove pinctrl_gpio_free()

From: Bartosz Golaszewski <[email protected]>

There are no more users of pinctrl_gpio_free() so remove it.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/core.c | 41 +++++++++++++-------------------
include/linux/pinctrl/consumer.h | 5 ----
2 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 46e5fe90718b..5a1414bfeacc 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -819,29 +819,6 @@ int pinctrl_gpio_request_new(struct gpio_chip *gc, unsigned int 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;
- 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
@@ -853,7 +830,23 @@ 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->base + offset, &pctldev,
+ &range);
+ if (ret)
+ return;
+
+ mutex_lock(&pctldev->mutex);
+
+ /* Convert to the pin controllers number space */
+ pin = gpio_to_pin(range, gc->base + offset);
+
+ pinmux_free_gpio(pctldev, pin, range);
+
+ mutex_unlock(&pctldev->mutex);
}
EXPORT_SYMBOL_GPL(pinctrl_gpio_free_new);

diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 83a414a347cf..90b2f0b78c4b 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -28,7 +28,6 @@ struct pinctrl_state;
/* External interface to pin control */
bool pinctrl_gpio_can_use_line_new(struct gpio_chip *gc, unsigned int offset);
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,
@@ -83,10 +82,6 @@ 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)
{
--
2.39.2

2023-10-17 12:08:23

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 32/73] pinctrl: intel: cherryview: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Acked-by: Mika Westerberg <[email protected]>
---
drivers/pinctrl/intel/pinctrl-cherryview.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index b1d8f6136f99..f806b7ce086b 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1148,14 +1148,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 = {
--
2.39.2

2023-10-17 12:08:29

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 48/73] pinctrl: change the signature of pinctrl_gpio_direction()

From: Bartosz Golaszewski <[email protected]>

Modify pinctrl_gpio_direction() to be in line with public GPIO helpers
and take a pair of GPIO chip & offset as arguments.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/core.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index d4a615eb1c39..b92047af7b9f 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -850,14 +850,16 @@ void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset)
}
EXPORT_SYMBOL_GPL(pinctrl_gpio_free);

-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;

- ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
+ ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev,
+ &range);
if (ret) {
return ret;
}
@@ -865,7 +867,7 @@ static int pinctrl_gpio_direction(unsigned gpio, bool input)
mutex_lock(&pctldev->mutex);

/* Convert to the pin controllers number space */
- pin = gpio_to_pin(range, gpio);
+ pin = gpio_to_pin(range, gc->base + offset);
ret = pinmux_gpio_direction(pctldev, range, pin, input);

mutex_unlock(&pctldev->mutex);
@@ -884,7 +886,7 @@ static int pinctrl_gpio_direction(unsigned gpio, bool input)
*/
int pinctrl_gpio_direction_input(struct gpio_chip *gc, unsigned int offset)
{
- return pinctrl_gpio_direction(gc->base + offset, true);
+ return pinctrl_gpio_direction(gc, offset, true);
}
EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);

@@ -899,7 +901,7 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
*/
int pinctrl_gpio_direction_output(struct gpio_chip *gc, unsigned int offset)
{
- return pinctrl_gpio_direction(gc->base + offset, false);
+ return pinctrl_gpio_direction(gc, offset, false);
}
EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);

--
2.39.2

2023-10-17 12:08:29

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 43/73] treewide: rename pinctrl_gpio_request_new()

From: Bartosz Golaszewski <[email protected]>

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

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
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(-)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index d3aa1cfd4ace..af851c89cacc 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -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)
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index 35c65ff43f71..08c5427deb71 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -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)
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 47121e1a6d4e..8c98730a7ad2 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -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);

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 08951ddcd294..c974ba368d18 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -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)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 37c1df78437f..794408be7109 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2036,7 +2036,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);

diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
index fb98c3e14743..8162dd840933 100644
--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
@@ -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)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 20f4b655aa08..d200a887dc5d 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -784,7 +784,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
*
@@ -792,7 +792,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;
@@ -817,7 +817,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
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index 62134a7f0b4e..ad39b8c060b7 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -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;

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 0b6d6964087e..dd4532ae62bf 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -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;

diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c
index e7771a57e6d1..0c4f4d8d0891 100644
--- a/drivers/pinctrl/renesas/gpio.c
+++ b/drivers/pinctrl/renesas/gpio.c
@@ -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)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 22d4ab7d228c..c5d247d24374 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -1056,7 +1056,7 @@ static int rzg2l_gpio_request(struct gpio_chip *chip, unsigned int offset)
if (ret)
return ret;

- ret = pinctrl_gpio_request_new(chip, offset);
+ ret = pinctrl_gpio_request(chip, offset);
if (ret)
return ret;

diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
index 3d29c77a5aad..1ec0922f735c 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
@@ -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;

diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
index 7488f6394318..6d3b7ce1c35a 100644
--- a/drivers/pinctrl/spear/pinctrl-plgpio.c
+++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
@@ -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;

diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
index 22a2db8fa315..88e39f68ef25 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
@@ -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)
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
index 5557ef3fbeb2..c458c6fb992f 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
@@ -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)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 11d9f07934bd..dddbdc1a64c5 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -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)
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 4f9ead7f65d2..05b2dae05f24 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -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;
}
--
2.39.2

2023-10-17 12:08:33

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 42/73] treewide: rename pinctrl_gpio_can_use_line_new()

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/gpio/gpiolib-cdev.c | 2 +-
drivers/pinctrl/core.c | 4 ++--
include/linux/pinctrl/consumer.h | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index 54ee075410db..02ffda6c1e51 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -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);

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 881845395885..20f4b655aa08 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -755,7 +755,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_dev *pctldev;
struct pinctrl_gpio_range *range;
@@ -781,7 +781,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
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index aa3a7a7ca52d..4f9ead7f65d2 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -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;
}
--
2.39.2

2023-10-17 12:08:33

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 49/73] pinctrl: change the signature of pinctrl_get_device_gpio_range()

From: Bartosz Golaszewski <[email protected]>

Modify pinctrl_get_device_gpio_range() to be in line with public GPIO
helpers and take a pair of GPIO chip & offset as arguments.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/core.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index b92047af7b9f..80f1db0ec074 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -372,7 +372,8 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio) { return true; }

/**
* 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
*
@@ -381,7 +382,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)
{
@@ -393,7 +395,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->base + offset);
if (range) {
*outdev = pctldev;
*outrange = range;
@@ -767,7 +769,7 @@ bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset)
* we're probably dealing with GPIO driver
* without a backing pin controller - bail out.
*/
- if (pinctrl_get_device_gpio_range(gc->base + offset, &pctldev, &range))
+ if (pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range))
return true;

mutex_lock(&pctldev->mutex);
@@ -798,8 +800,7 @@ int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset)
struct pinctrl_dev *pctldev;
int ret, pin;

- ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev,
- &range);
+ ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
if (ret) {
if (pinctrl_ready_for_gpio_range(gc->base + offset))
ret = 0;
@@ -834,8 +835,7 @@ void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset)
struct pinctrl_dev *pctldev;
int ret, pin;

- ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev,
- &range);
+ ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
if (ret)
return;

@@ -858,8 +858,7 @@ static int pinctrl_gpio_direction(struct gpio_chip *gc, unsigned int offset,
int ret;
int pin;

- ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev,
- &range);
+ ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
if (ret) {
return ret;
}
@@ -923,8 +922,7 @@ int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
struct pinctrl_dev *pctldev;
int ret, pin;

- ret = pinctrl_get_device_gpio_range(gc->base + offset, &pctldev,
- &range);
+ ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
if (ret)
return ret;

--
2.39.2

2023-10-17 12:08:34

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 35/73] pinctrl: st: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Patrice Chotard <[email protected]>
---
drivers/pinctrl/pinctrl-st.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index c1f36b164ea5..ec763572ab3e 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -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;
}
--
2.39.2

2023-10-17 12:08:38

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 50/73] pinctrl: change the signature of pinctrl_match_gpio_range()

From: Bartosz Golaszewski <[email protected]>

Modify pinctrl_match_gpio_range() to be in line with public GPIO
helpers and take a pair of GPIO chip & offset as arguments.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/core.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 80f1db0ec074..ec78a75a5d7c 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -292,13 +292,15 @@ static inline int gpio_to_pin(struct pinctrl_gpio_range *range,
/**
* 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;

@@ -306,8 +308,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;
}
@@ -395,7 +397,7 @@ static int pinctrl_get_device_gpio_range(struct gpio_chip *gc,
list_for_each_entry(pctldev, &pinctrldev_list, node) {
struct pinctrl_gpio_range *range;

- range = pinctrl_match_gpio_range(pctldev, gc->base + offset);
+ range = pinctrl_match_gpio_range(pctldev, gc, offset);
if (range) {
*outdev = pctldev;
*outrange = range;
--
2.39.2

2023-10-17 12:08:43

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 55/73] pinctrl: intel: cherryview: drop the wrappers around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrappers around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/intel/pinctrl-cherryview.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index 067b0d344f0e..d1315cf027ce 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1146,11 +1146,6 @@ static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
return GPIO_LINE_DIRECTION_IN;
}

-static int chv_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int chv_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
int value)
{
@@ -1163,7 +1158,7 @@ static const struct gpio_chip chv_gpio_chip = {
.request = gpiochip_generic_request,
.free = gpiochip_generic_free,
.get_direction = chv_gpio_get_direction,
- .direction_input = chv_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = chv_gpio_direction_output,
.get = chv_gpio_get,
.set = chv_gpio_set,
--
2.39.2

2023-10-17 12:08:47

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 54/73] pinctrl: intel: drop the wrappers around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrappers around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/intel/pinctrl-intel.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 0f8e27d16929..f772be70e56d 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -990,11 +990,6 @@ static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
return GPIO_LINE_DIRECTION_OUT;
}

-static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
int value)
{
@@ -1007,7 +1002,7 @@ static const struct gpio_chip intel_gpio_chip = {
.request = gpiochip_generic_request,
.free = gpiochip_generic_free,
.get_direction = intel_gpio_get_direction,
- .direction_input = intel_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = intel_gpio_direction_output,
.get = intel_gpio_get,
.set = intel_gpio_set,
--
2.39.2

2023-10-17 12:08:52

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 53/73] pinctrl: intel: lynxpoint: drop the wrappers around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrappers around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/intel/pinctrl-lynxpoint.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index e6878e4cf20c..303aaca341ea 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -539,11 +539,6 @@ static void lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
raw_spin_unlock_irqrestore(&lg->lock, flags);
}

-static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int lp_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
int value)
{
@@ -799,7 +794,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
gc->owner = THIS_MODULE;
gc->request = gpiochip_generic_request;
gc->free = gpiochip_generic_free;
- gc->direction_input = lp_gpio_direction_input;
+ gc->direction_input = pinctrl_gpio_direction_input;
gc->direction_output = lp_gpio_direction_output;
gc->get = lp_gpio_get;
gc->set = lp_gpio_set;
--
2.39.2

2023-10-17 12:08:52

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 46/73] treewide: rename pinctrl_gpio_direction_output_new()

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
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(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 159a302486ac..a13f3c18ccd4 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -366,7 +366,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;

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index c60197d5fde0..91cea97255fa 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -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;
}
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 05afb67fd677..0bd339813110 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -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);
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index a9a00b28cc55..adfbed62eff1 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -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",
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index fd1c06abb5a7..e3427a6aecff 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -148,7 +148,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)
diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index e35964359381..1ba89cf279fb 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -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)
diff --git a/drivers/pinctrl/cirrus/pinctrl-lochnagar.c b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
index f3c8a8c14e14..014297a3fbd2 100644
--- a/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
+++ b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
@@ -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)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 242357f96238..0c2c18536242 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -889,8 +889,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
*
@@ -898,11 +897,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->base + 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
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index baf32a8156c4..067b0d344f0e 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1155,7 +1155,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 = {
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 2b0d418418f2..0f8e27d16929 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -999,7 +999,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 = {
diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index b4174829e1f9..e6878e4cf20c 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -549,7 +549,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)
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
index 5a5ec00e32ea..c3f33f96f920 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.c
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
@@ -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)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index b2dc3072050a..41e9847e3085 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -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)
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index d8c969e506ce..6392f1e05d02 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -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)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index d7ce67242248..51aeac7ecc79 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -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;

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index c22513e30068..140fdbbe8458 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -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;

diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c
index e77b180155f4..5ebd1939663f 100644
--- a/drivers/pinctrl/pinctrl-as3722.c
+++ b/drivers/pinctrl/pinctrl-as3722.c
@@ -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)
diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c
index 729c13a249ef..04285c930e94 100644
--- a/drivers/pinctrl/pinctrl-cy8c95x0.c
+++ b/drivers/pinctrl/pinctrl-cy8c95x0.c
@@ -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)
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index df36141edbf3..ca58c9db5c2c 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -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;
diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index d02d16084f33..96b4e9fceb78 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -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 = {
diff --git a/drivers/pinctrl/pinctrl-rk805.c b/drivers/pinctrl/pinctrl-rk805.c
index f0feb3a8e630..968f066eb9da 100644
--- a/drivers/pinctrl/pinctrl-rk805.c
+++ b/drivers/pinctrl/pinctrl-rk805.c
@@ -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)
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 3f6631716779..db511dbd50e5 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -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;
}
diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c
index 54346b7fcdef..a5136dacaaf2 100644
--- a/drivers/pinctrl/renesas/gpio.c
+++ b/drivers/pinctrl/renesas/gpio.c
@@ -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)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index cbe306f47c0a..917b87acbf0d 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -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;
}
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c
index 54cd556a16b8..639446bba373 100644
--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
@@ -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 = {
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 9531595d1abd..e7d660e98e86 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -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;
}
--
2.39.2

2023-10-17 12:08:58

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 52/73] pinctrl: change the signature of pinctrl_ready_for_gpio_range()

From: Bartosz Golaszewski <[email protected]>

Modify pinctrl_ready_for_gpio_range() to be in line with public GPIO
helpers and take a pair of GPIO chip & offset as arguments

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/core.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index da5d716f154d..932bbcdc0eb1 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -322,7 +322,8 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, struct gpio_chip *gc,
/**
* 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
@@ -333,19 +334,11 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, struct gpio_chip *gc,
* 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,
+ unsigned int offset)
{
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);

@@ -355,8 +348,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);
@@ -370,7 +363,11 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
return false;
}
#else
-static bool pinctrl_ready_for_gpio_range(unsigned gpio) { return true; }
+static inline bool
+pinctrl_ready_for_gpio_range(struct gpio_chip *gc, unsigned int offset)
+{
+ return true;
+}
#endif

/**
@@ -805,7 +802,7 @@ int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset)

ret = pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range);
if (ret) {
- if (pinctrl_ready_for_gpio_range(gc->base + offset))
+ if (pinctrl_ready_for_gpio_range(gc, offset))
ret = 0;
return ret;
}
--
2.39.2

2023-10-17 12:09:03

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 64/73] pinctrl: mediatek: common: drop the wrappers around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrappers around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 41e9847e3085..e79d66a04194 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -808,12 +808,6 @@ static const struct pinmux_ops mtk_pmx_ops = {
.gpio_request_enable = mtk_pmx_gpio_request_enable,
};

-static int mtk_gpio_direction_input(struct gpio_chip *chip,
- unsigned offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int mtk_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
@@ -898,7 +892,7 @@ static const struct gpio_chip mtk_gpio_chip = {
.request = gpiochip_generic_request,
.free = gpiochip_generic_free,
.get_direction = mtk_gpio_get_direction,
- .direction_input = mtk_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = mtk_gpio_direction_output,
.get = mtk_gpio_get,
.set = mtk_gpio_set,
--
2.39.2

2023-10-17 12:09:04

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 51/73] pinctrl: change the signature of gpio_to_pin()

From: Bartosz Golaszewski <[email protected]>

Modify gpio_to_pin() to be in line with public GPIO helpers and take
a pair of GPIO chip & offset as arguments.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/core.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index ec78a75a5d7c..da5d716f154d 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -269,7 +269,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
@@ -280,13 +281,13 @@ 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;
}

/**
@@ -777,7 +778,7 @@ bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset)
mutex_lock(&pctldev->mutex);

/* Convert to the pin controllers number space */
- pin = gpio_to_pin(range, gc->base + offset);
+ pin = gpio_to_pin(range, gc, offset);

result = pinmux_can_be_used_for_gpio(pctldev, pin);

@@ -812,7 +813,7 @@ int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset)
mutex_lock(&pctldev->mutex);

/* Convert to the pin controllers number space */
- pin = gpio_to_pin(range, gc->base + offset);
+ pin = gpio_to_pin(range, gc, offset);

ret = pinmux_request_gpio(pctldev, range, pin, gc->base + offset);

@@ -844,7 +845,7 @@ void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset)
mutex_lock(&pctldev->mutex);

/* Convert to the pin controllers number space */
- pin = gpio_to_pin(range, gc->base + offset);
+ pin = gpio_to_pin(range, gc, offset);

pinmux_free_gpio(pctldev, pin, range);

@@ -868,7 +869,7 @@ static int pinctrl_gpio_direction(struct gpio_chip *gc, unsigned int offset,
mutex_lock(&pctldev->mutex);

/* Convert to the pin controllers number space */
- pin = gpio_to_pin(range, gc->base + offset);
+ pin = gpio_to_pin(range, gc, offset);
ret = pinmux_gpio_direction(pctldev, range, pin, input);

mutex_unlock(&pctldev->mutex);
@@ -929,7 +930,7 @@ int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
return ret;

mutex_lock(&pctldev->mutex);
- pin = gpio_to_pin(range, gc->base + offset);
+ pin = gpio_to_pin(range, gc, offset);
ret = pinconf_set_config(pctldev, pin, configs, ARRAY_SIZE(configs));
mutex_unlock(&pctldev->mutex);

--
2.39.2

2023-10-17 12:09:05

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 63/73] pinctrl: mediatek: moore: drop the wrappers around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrappers around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/mediatek/pinctrl-moore.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
index c3f33f96f920..c3d59eddd994 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.c
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
@@ -510,11 +510,6 @@ static void mtk_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DO, !!value);
}

-static int mtk_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio)
-{
- return pinctrl_gpio_direction_input(chip, gpio);
-}
-
static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
int value)
{
@@ -569,7 +564,7 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw)
chip->parent = hw->dev;
chip->request = gpiochip_generic_request;
chip->free = gpiochip_generic_free;
- chip->direction_input = mtk_gpio_direction_input;
+ chip->direction_input = pinctrl_gpio_direction_input;
chip->direction_output = mtk_gpio_direction_output;
chip->get = mtk_gpio_get;
chip->set = mtk_gpio_set;
--
2.39.2

2023-10-17 12:09:09

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 58/73] pinctrl: as3722: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-as3722.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c
index 5ebd1939663f..6a5f23cf7a2a 100644
--- a/drivers/pinctrl/pinctrl-as3722.c
+++ b/drivers/pinctrl/pinctrl-as3722.c
@@ -500,11 +500,6 @@ static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
"GPIO_SIGNAL_OUT_REG update failed: %d\n", ret);
}

-static int as3722_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int as3722_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
@@ -526,7 +521,7 @@ static const struct gpio_chip as3722_gpio_chip = {
.free = gpiochip_generic_free,
.get = as3722_gpio_get,
.set = as3722_gpio_set,
- .direction_input = as3722_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = as3722_gpio_direction_output,
.to_irq = as3722_gpio_to_irq,
.can_sleep = true,
--
2.39.2

2023-10-17 12:09:11

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 62/73] pinctrl: rk805: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-rk805.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rk805.c b/drivers/pinctrl/pinctrl-rk805.c
index 968f066eb9da..56d916f2cee6 100644
--- a/drivers/pinctrl/pinctrl-rk805.c
+++ b/drivers/pinctrl/pinctrl-rk805.c
@@ -286,12 +286,6 @@ static void rk805_gpio_set(struct gpio_chip *chip,
offset, value);
}

-static int rk805_gpio_direction_input(struct gpio_chip *chip,
- unsigned int offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int rk805_gpio_direction_output(struct gpio_chip *chip,
unsigned int offset, int value)
{
@@ -330,7 +324,7 @@ static const struct gpio_chip rk805_gpio_chip = {
.get_direction = rk805_gpio_get_direction,
.get = rk805_gpio_get,
.set = rk805_gpio_set,
- .direction_input = rk805_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = rk805_gpio_direction_output,
.can_sleep = true,
.base = -1,
--
2.39.2

2023-10-17 12:09:14

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 24/73] pinctrl: mediatek: moore: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/mediatek/pinctrl-moore.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
index 889469c7ac26..dc41ffa31357 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.c
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
@@ -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)
--
2.39.2

2023-10-17 12:09:23

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 67/73] pinctrl: starfive: jh7100: drop wrappers around pinctrl_gpio_request/free()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_*() helpers now have signatures corresponding with those of
the GPIOLIB callbacks. We can drop the wrappers.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
index 7beed57d665a..ea70b8c61679 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
@@ -916,16 +916,6 @@ static struct pinctrl_desc starfive_desc = {
.custom_conf_items = starfive_pinconf_custom_conf_items,
};

-static int starfive_gpio_request(struct gpio_chip *gc, unsigned int gpio)
-{
- return pinctrl_gpio_request(gc, gpio);
-}
-
-static void starfive_gpio_free(struct gpio_chip *gc, unsigned int gpio)
-{
- pinctrl_gpio_free(gc, gpio);
-}
-
static int starfive_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
{
struct starfive_pinctrl *sfp = container_of(gc, struct starfive_pinctrl, gc);
@@ -1309,8 +1299,8 @@ static int starfive_probe(struct platform_device *pdev)

sfp->gc.label = dev_name(dev);
sfp->gc.owner = THIS_MODULE;
- sfp->gc.request = starfive_gpio_request;
- sfp->gc.free = starfive_gpio_free;
+ sfp->gc.request = pinctrl_gpio_request;
+ sfp->gc.free = pinctrl_gpio_free;
sfp->gc.get_direction = starfive_gpio_get_direction;
sfp->gc.direction_input = starfive_gpio_direction_input;
sfp->gc.direction_output = starfive_gpio_direction_output;
--
2.39.2

2023-10-17 12:09:26

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 59/73] pinctrl: cy8c95x0: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-cy8c95x0.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c
index 04285c930e94..adecb7d85da1 100644
--- a/drivers/pinctrl/pinctrl-cy8c95x0.c
+++ b/drivers/pinctrl/pinctrl-cy8c95x0.c
@@ -552,11 +552,6 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
return ret;
}

-static int cy8c95x0_gpio_direction_input(struct gpio_chip *gc, unsigned int off)
-{
- return pinctrl_gpio_direction_input(gc, off);
-}
-
static int cy8c95x0_gpio_direction_output(struct gpio_chip *gc,
unsigned int off, int val)
{
@@ -814,7 +809,7 @@ static int cy8c95x0_setup_gpiochip(struct cy8c95x0_pinctrl *chip)

gc->request = gpiochip_generic_request;
gc->free = gpiochip_generic_free;
- gc->direction_input = cy8c95x0_gpio_direction_input;
+ gc->direction_input = pinctrl_gpio_direction_input;
gc->direction_output = cy8c95x0_gpio_direction_output;
gc->get = cy8c95x0_gpio_get_value;
gc->set = cy8c95x0_gpio_set_value;
--
2.39.2

2023-10-17 12:09:27

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 61/73] pinctrl: axp209: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-axp209.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index a6eb3b866a23..2b4805e74eed 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -124,11 +124,6 @@ static int axp20x_gpio_get_reg(unsigned int offset)
return -EINVAL;
}

-static int axp20x_gpio_input(struct gpio_chip *chip, unsigned int offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
struct axp20x_pctl *pctl = gpiochip_get_data(chip);
@@ -474,7 +469,7 @@ static int axp20x_pctl_probe(struct platform_device *pdev)
pctl->chip.get = axp20x_gpio_get;
pctl->chip.get_direction = axp20x_gpio_get_direction;
pctl->chip.set = axp20x_gpio_set;
- pctl->chip.direction_input = axp20x_gpio_input;
+ pctl->chip.direction_input = pinctrl_gpio_direction_input;
pctl->chip.direction_output = axp20x_gpio_output;

pctl->desc = of_device_get_match_data(dev);
--
2.39.2

2023-10-17 12:09:30

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 71/73] pinctrl: nuvoton: npcm8xx: drop wrappers around pinctrl_gpio_request/free()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_*() helpers now have signatures corresponding with those of
the GPIOLIB callbacks. We can drop the wrappers.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 140fdbbe8458..a377d36b0eb0 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -205,11 +205,6 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
return bank->request(chip, offset);
}

-static void npcmgpio_gpio_free(struct gpio_chip *chip, unsigned int offset)
-{
- pinctrl_gpio_free(chip, offset);
-}
-
static void npcmgpio_irq_handler(struct irq_desc *desc)
{
unsigned long sts, en, bit;
@@ -2388,7 +2383,7 @@ static int npcm8xx_gpio_fw(struct npcm8xx_pinctrl *pctrl)
pctrl->gpio_bank[id].gc.direction_output = npcmgpio_direction_output;
pctrl->gpio_bank[id].request = pctrl->gpio_bank[id].gc.request;
pctrl->gpio_bank[id].gc.request = npcmgpio_gpio_request;
- pctrl->gpio_bank[id].gc.free = npcmgpio_gpio_free;
+ pctrl->gpio_bank[id].gc.free = pinctrl_gpio_free;
for (i = 0 ; i < NPCM8XX_DEBOUNCE_MAX ; i++)
pctrl->gpio_bank[id].debounce.set_val[i] = false;
pctrl->gpio_bank[id].gc.add_pin_ranges = npcmgpio_add_pin_ranges;
--
2.39.2

2023-10-17 12:09:42

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 70/73] pinctrl: nuvoton: npcm7xx: drop wrappers around pinctrl_gpio_request/free()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_*() helpers now have signatures corresponding with those of
the GPIOLIB callbacks. We can drop the wrappers.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index 51aeac7ecc79..1e658721aaba 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -208,12 +208,6 @@ static int npcmgpio_gpio_request(struct gpio_chip *chip, unsigned int offset)
return bank->request(chip, 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(chip, offset);
-}
-
static void npcmgpio_irq_handler(struct irq_desc *desc)
{
struct gpio_chip *gc;
@@ -1916,7 +1910,7 @@ static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl)
pctrl->gpio_bank[id].gc.direction_output = npcmgpio_direction_output;
pctrl->gpio_bank[id].request = pctrl->gpio_bank[id].gc.request;
pctrl->gpio_bank[id].gc.request = npcmgpio_gpio_request;
- pctrl->gpio_bank[id].gc.free = npcmgpio_gpio_free;
+ pctrl->gpio_bank[id].gc.free = pinctrl_gpio_free;
id++;
}

--
2.39.2

2023-10-17 12:09:44

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 60/73] pinctrl: vt8500: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/vt8500/pinctrl-wmt.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c
index 639446bba373..fce92111a32e 100644
--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
@@ -526,11 +526,6 @@ static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset,
wmt_clearbits(data, reg_data_out, BIT(bit));
}

-static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{
@@ -544,7 +539,7 @@ static const struct gpio_chip wmt_gpio_chip = {
.request = gpiochip_generic_request,
.free = gpiochip_generic_free,
.get_direction = wmt_gpio_get_direction,
- .direction_input = wmt_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = wmt_gpio_direction_output,
.get = wmt_gpio_get_value,
.set = wmt_gpio_set_value,
--
2.39.2

2023-10-17 12:09:52

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 72/73] pinctrl: em: drop the wrapper around pinctrl_gpio_request()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_request() now has the same signature as the wrapper around
it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/gpio/gpio-em.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index aa31c189d0ef..6c862c572322 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -227,11 +227,6 @@ static int em_gio_to_irq(struct gpio_chip *chip, unsigned offset)
return irq_create_mapping(gpio_to_priv(chip)->irq_domain, offset);
}

-static int em_gio_request(struct gpio_chip *chip, unsigned offset)
-{
- return pinctrl_gpio_request(chip, offset);
-}
-
static void em_gio_free(struct gpio_chip *chip, unsigned offset)
{
pinctrl_gpio_free(chip, offset);
@@ -311,7 +306,7 @@ static int em_gio_probe(struct platform_device *pdev)
gpio_chip->direction_output = em_gio_direction_output;
gpio_chip->set = em_gio_set;
gpio_chip->to_irq = em_gio_to_irq;
- gpio_chip->request = em_gio_request;
+ gpio_chip->request = pinctrl_gpio_request;
gpio_chip->free = em_gio_free;
gpio_chip->label = name;
gpio_chip->parent = dev;
--
2.39.2

2023-10-17 12:10:40

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 56/73] pinctrl: st: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop it.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-st.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index db511dbd50e5..1485573b523c 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -717,13 +717,6 @@ static void st_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
__st_gpio_set(bank, offset, value);
}

-static int st_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
-{
- pinctrl_gpio_direction_input(chip, offset);
-
- return 0;
-}
-
static int st_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
@@ -1330,7 +1323,7 @@ static int st_gpio_irq_request_resources(struct irq_data *d)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);

- st_gpio_direction_input(gc, d->hwirq);
+ pinctrl_gpio_direction_input(gc, d->hwirq);

return gpiochip_reqres_irq(gc, d->hwirq);
}
@@ -1488,7 +1481,7 @@ static const struct gpio_chip st_gpio_template = {
.free = gpiochip_generic_free,
.get = st_gpio_get,
.set = st_gpio_set,
- .direction_input = st_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = st_gpio_direction_output,
.get_direction = st_gpio_get_direction,
.ngpio = ST_GPIO_PINS_PER_BANK,
--
2.39.2

2023-10-17 12:11:09

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 65/73] pinctrl: cirrus: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index 1ba89cf279fb..012b0a3bad5a 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -506,11 +506,6 @@ static void cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset, int va
pm_runtime_put(priv->dev);
}

-static int cs42l43_gpio_direction_in(struct gpio_chip *chip, unsigned int offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
unsigned int offset, int value)
{
@@ -551,7 +546,7 @@ static int cs42l43_pin_probe(struct platform_device *pdev)

priv->gpio_chip.request = gpiochip_generic_request;
priv->gpio_chip.free = gpiochip_generic_free;
- priv->gpio_chip.direction_input = cs42l43_gpio_direction_in;
+ priv->gpio_chip.direction_input = pinctrl_gpio_direction_input;
priv->gpio_chip.direction_output = cs42l43_gpio_direction_out;
priv->gpio_chip.add_pin_ranges = cs42l43_gpio_add_pin_ranges;
priv->gpio_chip.get = cs42l43_gpio_get;
--
2.39.2

2023-10-17 12:20:46

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 44/73] treewide: rename pinctrl_gpio_free_new()

From: Bartosz Golaszewski <[email protected]>

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

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
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(-)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index af851c89cacc..4c417c8486dd 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -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,
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index 08c5427deb71..aa31c189d0ef 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -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.
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 8c98730a7ad2..6159fda38d5d 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -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
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index c974ba368d18..fcb3b474d1df 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -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);
}

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 794408be7109..53dce41d649a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2052,7 +2052,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);

diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
index 8162dd840933..fd5ce52d05b1 100644
--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
@@ -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)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index d200a887dc5d..6872614c4a95 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -820,7 +820,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
*
@@ -828,7 +828,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;
@@ -848,7 +848,7 @@ void pinctrl_gpio_free_new(struct gpio_chip *gc, unsigned int offset)

mutex_unlock(&pctldev->mutex);
}
-EXPORT_SYMBOL_GPL(pinctrl_gpio_free_new);
+EXPORT_SYMBOL_GPL(pinctrl_gpio_free);

static int pinctrl_gpio_direction(unsigned gpio, bool input)
{
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index ad39b8c060b7..ab7cfc1e66f0 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -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)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index dd4532ae62bf..78dbeef6af86 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -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)
diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c
index 0c4f4d8d0891..b39125a632b0 100644
--- a/drivers/pinctrl/renesas/gpio.c
+++ b/drivers/pinctrl/renesas/gpio.c
@@ -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,
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index c5d247d24374..9de350ad7e7d 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -1181,7 +1181,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)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
index 1ec0922f735c..21d7d5ac8c4a 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c
@@ -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
diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
index 6d3b7ce1c35a..a05570c7d833 100644
--- a/drivers/pinctrl/spear/pinctrl-plgpio.c
+++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
@@ -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 */
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
index 88e39f68ef25..7beed57d665a 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c
@@ -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)
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
index c458c6fb992f..695c8c0a6e8b 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
@@ -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,
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index dddbdc1a64c5..e4453fa58f9e 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -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)
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 05b2dae05f24..55b465edaff1 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -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)
{
}

--
2.39.2

2023-10-17 12:20:49

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 69/73] pinctrl: stm32: drop wrappers around pinctrl_gpio_free/input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_*() helpers now have signatures corresponding with those of
the GPIOLIB callbacks. We can drop the wrappers.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 917b87acbf0d..64e8201c7eac 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -220,11 +220,6 @@ static int stm32_gpio_request(struct gpio_chip *chip, unsigned offset)
return pinctrl_gpio_request(chip, offset);
}

-static void stm32_gpio_free(struct gpio_chip *chip, unsigned offset)
-{
- pinctrl_gpio_free(chip, offset);
-}
-
static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset)
{
struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
@@ -239,11 +234,6 @@ static void stm32_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
__stm32_gpio_set(bank, offset, value);
}

-static int stm32_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int stm32_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
@@ -316,10 +306,10 @@ static int stm32_gpio_init_valid_mask(struct gpio_chip *chip,

static const struct gpio_chip stm32_gpio_template = {
.request = stm32_gpio_request,
- .free = stm32_gpio_free,
+ .free = pinctrl_gpio_free,
.get = stm32_gpio_get,
.set = stm32_gpio_set,
- .direction_input = stm32_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = stm32_gpio_direction_output,
.to_irq = stm32_gpio_to_irq,
.get_direction = stm32_gpio_get_direction,
@@ -381,7 +371,7 @@ static int stm32_gpio_irq_request_resources(struct irq_data *irq_data)
struct stm32_pinctrl *pctl = dev_get_drvdata(bank->gpio_chip.parent);
int ret;

- ret = stm32_gpio_direction_input(&bank->gpio_chip, irq_data->hwirq);
+ ret = pinctrl_gpio_direction_input(&bank->gpio_chip, irq_data->hwirq);
if (ret)
return ret;

--
2.39.2

2023-10-17 12:20:51

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 40/73] pinctrl: remove pinctrl_gpio_direction_output()

From: Bartosz Golaszewski <[email protected]>

There are no more users of pinctrl_gpio_direction_output() so remove it.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/core.c | 9 +--------
include/linux/pinctrl/consumer.h | 6 ------
2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 80f565aac707..0d66b3d5e685 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -888,13 +888,6 @@ int pinctrl_gpio_direction_input_new(struct gpio_chip *gc, unsigned int 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);
-}
-EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
-
/**
* pinctrl_gpio_direction_output_new() - request a GPIO pin to go into output
* mode
@@ -907,7 +900,7 @@ 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->base + offset, false);
}
EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output_new);

diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 249bb28a52d6..e25e9b0599ac 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -31,7 +31,6 @@ 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,
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);
@@ -92,11 +91,6 @@ 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)
{
--
2.39.2

2023-10-17 12:21:12

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 41/73] pinctrl: remove pinctrl_gpio_set_config()

From: Bartosz Golaszewski <[email protected]>

There are no more users of pinctrl_gpio_set_config() so remove it.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/core.c | 38 ++++++++++++++------------------
include/linux/pinctrl/consumer.h | 6 -----
2 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 0d66b3d5e685..881845395885 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -904,27 +904,6 @@ int pinctrl_gpio_direction_output_new(struct gpio_chip *gc, unsigned int 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 };
- 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
@@ -938,7 +917,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->base + offset, &pctldev,
+ &range);
+ if (ret)
+ return ret;
+
+ mutex_lock(&pctldev->mutex);
+ pin = gpio_to_pin(range, gc->base + offset);
+ ret = pinconf_set_config(pctldev, pin, configs, ARRAY_SIZE(configs));
+ mutex_unlock(&pctldev->mutex);
+
+ return ret;
}
EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config_new);

diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index e25e9b0599ac..aa3a7a7ca52d 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -33,7 +33,6 @@ int pinctrl_gpio_direction_input_new(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(unsigned gpio, unsigned long config);
int pinctrl_gpio_set_config_new(struct gpio_chip *gc, unsigned int offset,
unsigned long config);

@@ -97,11 +96,6 @@ 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)
--
2.39.2

2023-10-17 12:21:21

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 73/73] pinctrl: tegra: drop the wrapper around pinctrl_gpio_request()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_request() now has the same signature as the wrapper around
it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/gpio/gpio-tegra.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index adfbed62eff1..ea5f9cc14bc4 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -137,11 +137,6 @@ static void tegra_gpio_disable(struct tegra_gpio_info *tgi, unsigned int gpio)
tegra_gpio_mask_write(tgi, GPIO_MSK_CNF(tgi, gpio), gpio, 0);
}

-static int tegra_gpio_request(struct gpio_chip *chip, unsigned int offset)
-{
- return pinctrl_gpio_request(chip, offset);
-}
-
static void tegra_gpio_free(struct gpio_chip *chip, unsigned int offset)
{
struct tegra_gpio_info *tgi = gpiochip_get_data(chip);
@@ -717,7 +712,7 @@ static int tegra_gpio_probe(struct platform_device *pdev)
}

tgi->gc.label = "tegra-gpio";
- tgi->gc.request = tegra_gpio_request;
+ tgi->gc.request = pinctrl_gpio_request;
tgi->gc.free = tegra_gpio_free;
tgi->gc.direction_input = tegra_gpio_direction_input;
tgi->gc.get = tegra_gpio_get;
--
2.39.2

2023-10-17 12:21:29

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 57/73] pinctrl: ingenic: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-ingenic.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index ca58c9db5c2c..ee718f6e2556 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -3560,12 +3560,6 @@ static int ingenic_gpio_get(struct gpio_chip *gc, unsigned int offset)
return (int) ingenic_gpio_get_value(jzgc, offset);
}

-static int ingenic_gpio_direction_input(struct gpio_chip *gc,
- unsigned int offset)
-{
- return pinctrl_gpio_direction_input(gc, offset);
-}
-
static int ingenic_gpio_direction_output(struct gpio_chip *gc,
unsigned int offset, int value)
{
@@ -3680,7 +3674,7 @@ static int ingenic_gpio_irq_request(struct irq_data *data)
irq_hw_number_t irq = irqd_to_hwirq(data);
int ret;

- ret = ingenic_gpio_direction_input(gpio_chip, irq);
+ ret = pinctrl_gpio_direction_input(gpio_chip, irq);
if (ret)
return ret;

@@ -4197,7 +4191,7 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc,

jzgc->gc.set = ingenic_gpio_set;
jzgc->gc.get = ingenic_gpio_get;
- jzgc->gc.direction_input = ingenic_gpio_direction_input;
+ jzgc->gc.direction_input = pinctrl_gpio_direction_input;
jzgc->gc.direction_output = ingenic_gpio_direction_output;
jzgc->gc.get_direction = ingenic_gpio_get_direction;
jzgc->gc.request = gpiochip_generic_request;
--
2.39.2

2023-10-17 12:21:45

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 47/73] treewide: rename pinctrl_gpio_set_config_new()

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
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(-)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 4c417c8486dd..04c03402db6d 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -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 */
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 53dce41d649a..729a30e494cd 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2065,7 +2065,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);

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 0c2c18536242..d4a615eb1c39 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -904,7 +904,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
@@ -913,7 +913,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 };
@@ -933,7 +933,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)
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index e7d660e98e86..73de70362b98 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -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;
--
2.39.2

2023-10-17 12:21:49

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 66/73] pinctrl: ocelot: drop the wrapper around pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_direction_input() now has the same signature as the
wrapper around it so we can drop them.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-ocelot.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index 96b4e9fceb78..52aadd6d72a8 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -1776,12 +1776,6 @@ static int ocelot_gpio_get_direction(struct gpio_chip *chip,
return GPIO_LINE_DIRECTION_IN;
}

-static int ocelot_gpio_direction_input(struct gpio_chip *chip,
- unsigned int offset)
-{
- return pinctrl_gpio_direction_input(chip, offset);
-}
-
static int ocelot_gpio_direction_output(struct gpio_chip *chip,
unsigned int offset, int value)
{
@@ -1804,7 +1798,7 @@ static const struct gpio_chip ocelot_gpiolib_chip = {
.set = ocelot_gpio_set,
.get = ocelot_gpio_get,
.get_direction = ocelot_gpio_get_direction,
- .direction_input = ocelot_gpio_direction_input,
+ .direction_input = pinctrl_gpio_direction_input,
.direction_output = ocelot_gpio_direction_output,
.owner = THIS_MODULE,
};
--
2.39.2

2023-10-17 12:21:59

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 30/73] pinctrl: as3722: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-as3722.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c
index 84b47a6cc3a6..205937f7f9a1 100644
--- a/drivers/pinctrl/pinctrl-as3722.c
+++ b/drivers/pinctrl/pinctrl-as3722.c
@@ -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)
--
2.39.2

2023-10-17 12:22:38

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 36/73] pinctrl: remove pinctrl_gpio_can_use_line()

From: Bartosz Golaszewski <[email protected]>

There are no more users of pinctrl_gpio_can_use_line() so remove it.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/core.c | 12 +++---------
include/linux/pinctrl/consumer.h | 6 ------
2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 6cd22829544c..4a03fc1c6ba0 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -755,7 +755,7 @@ 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;
@@ -767,13 +767,13 @@ 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->base + offset, &pctldev, &range))
return true;

mutex_lock(&pctldev->mutex);

/* Convert to the pin controllers number space */
- pin = gpio_to_pin(range, gpio);
+ pin = gpio_to_pin(range, gc->base + offset);

result = pinmux_can_be_used_for_gpio(pctldev, pin);

@@ -781,12 +781,6 @@ bool pinctrl_gpio_can_use_line(unsigned gpio)

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. */
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index c95c13983376..3991271cc39f 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -26,7 +26,6 @@ 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);
@@ -73,11 +72,6 @@ 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)
{
--
2.39.2

2023-10-17 12:23:03

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 68/73] pinctrl: starfive: jh7110: drop wrappers around pinctrl_gpio_request/free()

From: Bartosz Golaszewski <[email protected]>

pinctrl_gpio_*() helpers now have signatures corresponding with those of
the GPIOLIB callbacks. We can drop the wrappers.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
index 695c8c0a6e8b..9d71e8c13310 100644
--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
+++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
@@ -545,16 +545,6 @@ static const struct pinconf_ops jh7110_pinconf_ops = {
.is_generic = true,
};

-static int jh7110_gpio_request(struct gpio_chip *gc, unsigned int gpio)
-{
- return pinctrl_gpio_request(gc, gpio);
-}
-
-static void jh7110_gpio_free(struct gpio_chip *gc, unsigned int gpio)
-{
- pinctrl_gpio_free(gc, gpio);
-}
-
static int jh7110_gpio_get_direction(struct gpio_chip *gc,
unsigned int gpio)
{
@@ -940,8 +930,8 @@ int jh7110_pinctrl_probe(struct platform_device *pdev)

sfp->gc.label = dev_name(dev);
sfp->gc.owner = THIS_MODULE;
- sfp->gc.request = jh7110_gpio_request;
- sfp->gc.free = jh7110_gpio_free;
+ sfp->gc.request = pinctrl_gpio_request;
+ sfp->gc.free = pinctrl_gpio_free;
sfp->gc.get_direction = jh7110_gpio_get_direction;
sfp->gc.direction_input = jh7110_gpio_direction_input;
sfp->gc.direction_output = jh7110_gpio_direction_output;
--
2.39.2

2023-10-17 12:23:09

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 39/73] pinctrl: remove pinctrl_gpio_direction_input()

From: Bartosz Golaszewski <[email protected]>

There are no more users of pinctrl_gpio_direction_input() so remove it.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/core.c | 9 +--------
include/linux/pinctrl/consumer.h | 6 ------
2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 5a1414bfeacc..80f565aac707 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -873,13 +873,6 @@ static int pinctrl_gpio_direction(unsigned gpio, bool input)
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
@@ -891,7 +884,7 @@ 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->base + offset, true);
}
EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input_new);

diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 90b2f0b78c4b..249bb28a52d6 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -29,7 +29,6 @@ struct pinctrl_state;
bool pinctrl_gpio_can_use_line_new(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(unsigned gpio);
int pinctrl_gpio_direction_input_new(struct gpio_chip *gc,
unsigned int offset);
int pinctrl_gpio_direction_output(unsigned gpio);
@@ -87,11 +86,6 @@ 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)
{
--
2.39.2

2023-10-17 12:23:23

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 31/73] pinctrl: ingenic: use new pinctrl GPIO helpers

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/pinctrl/pinctrl-ingenic.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 2f220a47b749..5072fb907193 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -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;

--
2.39.2

2023-10-17 12:26:42

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 32/73] pinctrl: intel: cherryview: use new pinctrl GPIO helpers

On Tue, Oct 17, 2023 at 02:03:50PM +0200, Bartosz Golaszewski 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.

Just noticed, the Subj should be
"pinctrl: cherryview: use new pinctrl GPIO helpers" (no "intel:" part).


--
With Best Regards,
Andy Shevchenko


2023-10-17 12:27:08

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 34/73] pinctrl: intel: lynxpoint: use new pinctrl GPIO helpers

On Tue, Oct 17, 2023 at 02:03:52PM +0200, Bartosz Golaszewski 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.

Same here, no "intel:" part in the Subj.

--
With Best Regards,
Andy Shevchenko


2023-10-17 12:29:08

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 53/73] pinctrl: intel: lynxpoint: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 02:04:11PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <[email protected]>
>
> pinctrl_gpio_direction_input() now has the same signature as the
> wrappers around it so we can drop them.

W/o "intel:" part in the Subj
Reviewed-by: Andy Shevchenko <[email protected]>

--
With Best Regards,
Andy Shevchenko


2023-10-17 12:31:16

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 55/73] pinctrl: intel: cherryview: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 02:04:13PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <[email protected]>
>
> pinctrl_gpio_direction_input() now has the same signature as the
> wrappers around it so we can drop them.

W/o "intel:" part in the Subj
Reviewed-by: Andy Shevchenko <[email protected]>

--
With Best Regards,
Andy Shevchenko


2023-10-17 12:33:29

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v3 53/73] pinctrl: intel: lynxpoint: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 2:28 PM Andy Shevchenko
<[email protected]> wrote:
>
> On Tue, Oct 17, 2023 at 02:04:11PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <[email protected]>
> >
> > pinctrl_gpio_direction_input() now has the same signature as the
> > wrappers around it so we can drop them.
>
> W/o "intel:" part in the Subj
> Reviewed-by: Andy Shevchenko <[email protected]>

Unless something new comes up, I'll fix this in tree in order to not
spam the list anymore with these patch bombs.

Bart

>
> --
> With Best Regards,
> Andy Shevchenko
>
>

2023-10-17 12:41:58

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 54/73] pinctrl: intel: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 02:04:12PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <[email protected]>
>
> pinctrl_gpio_direction_input() now has the same signature as the
> wrappers around it so we can drop them.

Reviewed-by: Andy Shevchenko <[email protected]>

Now, for the sake of symmetry can you add (at least to the all
Intel drivers you modified in this series) the following:


int pinctrl_gpio_direction_output_with_value(struct gpio_chip *gc,
unsigned int offset, int value)
{
gc->set(gc, offset, value);
return pinctrl_gpio_direction_output(gc, offset);
}


?

And respectively in this driver

.direction_output = pincttl_gpio_direction_output_with_value,


--
With Best Regards,
Andy Shevchenko


2023-10-17 12:42:29

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH v3 45/73] treewide: rename pinctrl_gpio_direction_input_new()

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.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
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(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index c0ca0aa7b5cd..159a302486ac 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -346,7 +346,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;

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 2fd797b91270..c60197d5fde0 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -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;
}
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 3576793f0bd9..05afb67fd677 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -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);

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index fcb3b474d1df..a9a00b28cc55 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -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",
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 2c22a31ffbdc..fd1c06abb5a7 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -130,7 +130,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,
diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index 097e4dcdda36..e35964359381 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -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,
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 6872614c4a95..242357f96238 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -874,7 +874,7 @@ static int pinctrl_gpio_direction(unsigned gpio, 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
*
@@ -882,11 +882,11 @@ static int pinctrl_gpio_direction(unsigned gpio, 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->base + 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
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index f806b7ce086b..baf32a8156c4 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1148,7 +1148,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,
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index f403eb78f355..2b0d418418f2 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -992,7 +992,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,
diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index 91d228fead45..b4174829e1f9 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -541,7 +541,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,
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
index dc41ffa31357..5a5ec00e32ea 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.c
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
@@ -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,
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index fc046415b567..b2dc3072050a 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -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,
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index 14b151aec2f9..d8c969e506ce 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -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,
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index ab7cfc1e66f0..d7ce67242248 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -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;

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 78dbeef6af86..c22513e30068 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -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;

diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c
index 205937f7f9a1..e77b180155f4 100644
--- a/drivers/pinctrl/pinctrl-as3722.c
+++ b/drivers/pinctrl/pinctrl-as3722.c
@@ -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,
diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
index d7f081f1d1f6..a6eb3b866a23 100644
--- a/drivers/pinctrl/pinctrl-axp209.c
+++ b/drivers/pinctrl/pinctrl-axp209.c
@@ -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)
diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c
index 8c6006353515..729c13a249ef 100644
--- a/drivers/pinctrl/pinctrl-cy8c95x0.c
+++ b/drivers/pinctrl/pinctrl-cy8c95x0.c
@@ -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,
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 5072fb907193..df36141edbf3 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -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,
diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index a6022d44ad6c..d02d16084f33 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -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,
diff --git a/drivers/pinctrl/pinctrl-rk805.c b/drivers/pinctrl/pinctrl-rk805.c
index 58e6dd932bc7..f0feb3a8e630 100644
--- a/drivers/pinctrl/pinctrl-rk805.c
+++ b/drivers/pinctrl/pinctrl-rk805.c
@@ -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,
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index ec763572ab3e..3f6631716779 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -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;
}
diff --git a/drivers/pinctrl/renesas/gpio.c b/drivers/pinctrl/renesas/gpio.c
index b39125a632b0..54346b7fcdef 100644
--- a/drivers/pinctrl/renesas/gpio.c
+++ b/drivers/pinctrl/renesas/gpio.c
@@ -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,
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index e4453fa58f9e..cbe306f47c0a 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -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,
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c
index 1a313295611e..54cd556a16b8 100644
--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
@@ -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,
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 55b465edaff1..9531595d1abd 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -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;
}
--
2.39.2

2023-10-17 12:44:50

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v3 54/73] pinctrl: intel: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, 17 Oct 2023 at 14:41, Andy Shevchenko
<[email protected]> wrote:
>
> On Tue, Oct 17, 2023 at 02:04:12PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <[email protected]>
> >
> > pinctrl_gpio_direction_input() now has the same signature as the
> > wrappers around it so we can drop them.
>
> Reviewed-by: Andy Shevchenko <[email protected]>
>
> Now, for the sake of symmetry can you add (at least to the all
> Intel drivers you modified in this series) the following:
>

Good idea but this is v6.8 material, I don't want to extend this
series anymore at this point.

Bart

>
> int pinctrl_gpio_direction_output_with_value(struct gpio_chip *gc,
> unsigned int offset, int value)
> {
> gc->set(gc, offset, value);
> return pinctrl_gpio_direction_output(gc, offset);
> }
>
>
> ?
>
> And respectively in this driver
>
> .direction_output = pincttl_gpio_direction_output_with_value,
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

2023-10-17 12:46:38

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 59/73] pinctrl: cy8c95x0: drop the wrapper around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 02:04:17PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <[email protected]>
>
> pinctrl_gpio_direction_input() now has the same signature as the
> wrapper around it so we can drop them.

Reviewed-by: Andy Shevchenko <[email protected]>

with the same comment as per Intel drivers, i.e.
use pinctrl_gpio_direction_output_with_value().

--
With Best Regards,
Andy Shevchenko


2023-10-17 12:46:40

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 54/73] pinctrl: intel: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 02:44:25PM +0200, Bartosz Golaszewski wrote:
> On Tue, 17 Oct 2023 at 14:41, Andy Shevchenko
> <[email protected]> wrote:
> >
> > On Tue, Oct 17, 2023 at 02:04:12PM +0200, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <[email protected]>
> > >
> > > pinctrl_gpio_direction_input() now has the same signature as the
> > > wrappers around it so we can drop them.
> >
> > Reviewed-by: Andy Shevchenko <[email protected]>
> >
> > Now, for the sake of symmetry can you add (at least to the all
> > Intel drivers you modified in this series) the following:
>
> Good idea but this is v6.8 material, I don't want to extend this
> series anymore at this point.

Then let's postpone at least Intel and Cypress patches after v6.8-rc1 is out.

--
With Best Regards,
Andy Shevchenko


2023-10-17 12:55:42

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v3 54/73] pinctrl: intel: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 2:46 PM Andy Shevchenko
<[email protected]> wrote:
>
> On Tue, Oct 17, 2023 at 02:44:25PM +0200, Bartosz Golaszewski wrote:
> > On Tue, 17 Oct 2023 at 14:41, Andy Shevchenko
> > <[email protected]> wrote:
> > >
> > > On Tue, Oct 17, 2023 at 02:04:12PM +0200, Bartosz Golaszewski wrote:
> > > > From: Bartosz Golaszewski <[email protected]>
> > > >
> > > > pinctrl_gpio_direction_input() now has the same signature as the
> > > > wrappers around it so we can drop them.
> > >
> > > Reviewed-by: Andy Shevchenko <[email protected]>
> > >
> > > Now, for the sake of symmetry can you add (at least to the all
> > > Intel drivers you modified in this series) the following:
> >
> > Good idea but this is v6.8 material, I don't want to extend this
> > series anymore at this point.
>
> Then let's postpone at least Intel and Cypress patches after v6.8-rc1 is out.
>

But then we'd have to postpone the renaming and we'd be stuck with
both variants in the tree. This is suboptimal. We'd also have this
huge series spanning two subsystems for 3 months during the v6.8
release cycle in the tree causing conflicts and other issues.

I'd prefer to merge this during the v6.7 merge window and then we can
keep on improving it without affecting both trees. Linus will be
taking those subsequent patches as usual.

Linus, what do you think?

Bart

2023-10-17 13:17:49

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 54/73] pinctrl: intel: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 02:55:07PM +0200, Bartosz Golaszewski wrote:
> On Tue, Oct 17, 2023 at 2:46 PM Andy Shevchenko
> <[email protected]> wrote:
> >
> > On Tue, Oct 17, 2023 at 02:44:25PM +0200, Bartosz Golaszewski wrote:
> > > On Tue, 17 Oct 2023 at 14:41, Andy Shevchenko
> > > <[email protected]> wrote:
> > > >
> > > > On Tue, Oct 17, 2023 at 02:04:12PM +0200, Bartosz Golaszewski wrote:
> > > > > From: Bartosz Golaszewski <[email protected]>
> > > > >
> > > > > pinctrl_gpio_direction_input() now has the same signature as the
> > > > > wrappers around it so we can drop them.
> > > >
> > > > Reviewed-by: Andy Shevchenko <[email protected]>
> > > >
> > > > Now, for the sake of symmetry can you add (at least to the all
> > > > Intel drivers you modified in this series) the following:
> > >
> > > Good idea but this is v6.8 material, I don't want to extend this
> > > series anymore at this point.
> >
> > Then let's postpone at least Intel and Cypress patches after v6.8-rc1 is out.
>
> But then we'd have to postpone the renaming and we'd be stuck with
> both variants in the tree. This is suboptimal. We'd also have this
> huge series spanning two subsystems for 3 months during the v6.8
> release cycle in the tree causing conflicts and other issues.

I don't see how this is related. What I'm talking is only related to dropping
the wrappers in the drivers _after_ whatever you do with generic APIs.

> I'd prefer to merge this during the v6.7 merge window and then we can
> keep on improving it without affecting both trees. Linus will be
> taking those subsequent patches as usual.
>
> Linus, what do you think?

--
With Best Regards,
Andy Shevchenko


2023-10-17 15:11:04

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v3 54/73] pinctrl: intel: drop the wrappers around pinctrl_gpio_direction_input()

On Tue, Oct 17, 2023 at 3:16 PM Andy Shevchenko
<[email protected]> wrote:
>
> On Tue, Oct 17, 2023 at 02:55:07PM +0200, Bartosz Golaszewski wrote:
> > On Tue, Oct 17, 2023 at 2:46 PM Andy Shevchenko
> > <[email protected]> wrote:
> > >
> > > On Tue, Oct 17, 2023 at 02:44:25PM +0200, Bartosz Golaszewski wrote:
> > > > On Tue, 17 Oct 2023 at 14:41, Andy Shevchenko
> > > > <[email protected]> wrote:
> > > > >
> > > > > On Tue, Oct 17, 2023 at 02:04:12PM +0200, Bartosz Golaszewski wrote:
> > > > > > From: Bartosz Golaszewski <[email protected]>
> > > > > >
> > > > > > pinctrl_gpio_direction_input() now has the same signature as the
> > > > > > wrappers around it so we can drop them.
> > > > >
> > > > > Reviewed-by: Andy Shevchenko <[email protected]>
> > > > >
> > > > > Now, for the sake of symmetry can you add (at least to the all
> > > > > Intel drivers you modified in this series) the following:
> > > >
> > > > Good idea but this is v6.8 material, I don't want to extend this
> > > > series anymore at this point.
> > >
> > > Then let's postpone at least Intel and Cypress patches after v6.8-rc1 is out.
> >
> > But then we'd have to postpone the renaming and we'd be stuck with
> > both variants in the tree. This is suboptimal. We'd also have this
> > huge series spanning two subsystems for 3 months during the v6.8
> > release cycle in the tree causing conflicts and other issues.
>
> I don't see how this is related. What I'm talking is only related to dropping
> the wrappers in the drivers _after_ whatever you do with generic APIs.

Ah, I misunderstood you. Ok, I'll drop them from the tree.

Bart

2023-10-23 08:32:32

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v3 00/73] pinctrl: don't use GPIOLIB global numberspace in helpers

On Tue, Oct 17, 2023 at 2:04 PM Bartosz Golaszewski <[email protected]> wrote:

> As this is a big series and there already are conflicts between it and
> current pinctrl tree, I plan on sending it as a separate PR later in the
> merge window once the bulk of GPIO and pinctrl changes are already
> in master.

Acked-by: Linus Walleij <[email protected]>
on the whole series and the merging approach.

Yours,
Linus Walleij