* [PATCH v1 1/2] pinctrl: bcm: bcm2835: Switch to use ->add_pin_ranges()
@ 2023-01-12 16:38 Andy Shevchenko
2023-01-12 16:38 ` [PATCH v1 2/2] gpiolib: of: Remove no more used ->of_gpio_ranges_fallback() Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2023-01-12 16:38 UTC (permalink / raw)
To: Bartosz Golaszewski, Dmitry Torokhov, Linus Walleij, linux-gpio,
linux-kernel, linux-rpi-kernel, linux-arm-kernel
Cc: Bartosz Golaszewski, Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Andy Shevchenko
Yeah, while the ->add_pin_ranges() shouldn't be used by DT drivers,
this one requires it to support quite old firmware descriptions that
do not have gpio-ranges property.
The change allows to clean up GPIO library from OF specifics.
There is no functional change intended.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 7857e612a100..fea1d1bcb389 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -358,16 +358,18 @@ static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
return 0;
}
-static int bcm2835_of_gpio_ranges_fallback(struct gpio_chip *gc,
- struct device_node *np)
+static int bcm2835_add_pin_ranges_fallback(struct gpio_chip *gc)
{
+ struct bcm2835_pinctrl *pc = gpiochip_get_data(gc);
+ struct device_node *np = dev_of_node(&gc->gpiodev->dev);
struct pinctrl_dev *pctldev = of_pinctrl_get(np);
- of_node_put(np);
-
if (!pctldev)
return 0;
+ if (of_property_read_bool(np, "gpio-ranges"))
+ return 0;
+
gpiochip_add_pin_range(gc, pinctrl_dev_get_devname(pctldev), 0, 0,
gc->ngpio);
@@ -388,7 +390,7 @@ static const struct gpio_chip bcm2835_gpio_chip = {
.base = -1,
.ngpio = BCM2835_NUM_GPIOS,
.can_sleep = false,
- .of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback,
+ .add_pin_ranges = bcm2835_add_pin_ranges_fallback,
};
static const struct gpio_chip bcm2711_gpio_chip = {
@@ -405,7 +407,7 @@ static const struct gpio_chip bcm2711_gpio_chip = {
.base = -1,
.ngpio = BCM2711_NUM_GPIOS,
.can_sleep = false,
- .of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback,
+ .add_pin_ranges = bcm2835_add_pin_ranges_fallback,
};
static void bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc,
--
2.39.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v1 2/2] gpiolib: of: Remove no more used ->of_gpio_ranges_fallback()
2023-01-12 16:38 [PATCH v1 1/2] pinctrl: bcm: bcm2835: Switch to use ->add_pin_ranges() Andy Shevchenko
@ 2023-01-12 16:38 ` Andy Shevchenko
2023-01-16 9:33 ` Bartosz Golaszewski
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2023-01-12 16:38 UTC (permalink / raw)
To: Bartosz Golaszewski, Dmitry Torokhov, Linus Walleij, linux-gpio,
linux-kernel, linux-rpi-kernel, linux-arm-kernel
Cc: Bartosz Golaszewski, Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Andy Shevchenko
Since the only one and last user of the ->of_gpio_ranges_fallback()
gone, remove the callback completely. New platforms must use the
gpio-ranges property.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib-of.c | 5 -----
include/linux/gpio/driver.h | 11 -----------
2 files changed, 16 deletions(-)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 72d8a3da31e3..266352b1a966 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -980,11 +980,6 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
if (!np)
return 0;
- if (!of_property_read_bool(np, "gpio-ranges") &&
- chip->of_gpio_ranges_fallback) {
- return chip->of_gpio_ranges_fallback(chip, np);
- }
-
group_names = of_find_property(np, group_names_propname, NULL);
for (;; index++) {
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index ddc7a14a274f..29c283919f8a 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -522,17 +522,6 @@ struct gpio_chip {
int (*of_xlate)(struct gpio_chip *gc,
const struct of_phandle_args *gpiospec, u32 *flags);
- /**
- * @of_gpio_ranges_fallback:
- *
- * Optional hook for the case that no gpio-ranges property is defined
- * within the device tree node "np" (usually DT before introduction
- * of gpio-ranges). So this callback is helpful to provide the
- * necessary backward compatibility for the pin ranges.
- */
- int (*of_gpio_ranges_fallback)(struct gpio_chip *gc,
- struct device_node *np);
-
#endif /* CONFIG_OF_GPIO */
};
--
2.39.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1 2/2] gpiolib: of: Remove no more used ->of_gpio_ranges_fallback()
2023-01-12 16:38 ` [PATCH v1 2/2] gpiolib: of: Remove no more used ->of_gpio_ranges_fallback() Andy Shevchenko
@ 2023-01-16 9:33 ` Bartosz Golaszewski
0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2023-01-16 9:33 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Dmitry Torokhov, Linus Walleij, linux-gpio,
linux-kernel, linux-rpi-kernel, linux-arm-kernel,
Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list
On Thu, Jan 12, 2023 at 5:38 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Since the only one and last user of the ->of_gpio_ranges_fallback()
> gone, remove the callback completely. New platforms must use the
> gpio-ranges property.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-16 9:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 16:38 [PATCH v1 1/2] pinctrl: bcm: bcm2835: Switch to use ->add_pin_ranges() Andy Shevchenko
2023-01-12 16:38 ` [PATCH v1 2/2] gpiolib: of: Remove no more used ->of_gpio_ranges_fallback() Andy Shevchenko
2023-01-16 9:33 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).