* [PATCH v1 2/3] gpio: Setup parent device and get rid of unnecessary of_node assignment
2021-12-02 21:08 [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Andy Shevchenko
@ 2021-12-02 21:08 ` Andy Shevchenko
2021-12-02 21:08 ` [PATCH v1 3/3] gpio: Propagate firmware node from a parent device Andy Shevchenko
` (5 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-12-02 21:08 UTC (permalink / raw)
To: Andy Shevchenko, Marc Zyngier, Matti Vaittinen,
Sergio Paracuellos, Chunyan Zhang, Bartosz Golaszewski,
Baruch Siach, Uwe Kleine-König, Tony Lindgren,
Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, linux-gpio, linux-kernel,
patches, bcm-kernel-feedback-list, linux-power, linux-arm-kernel,
linux-mediatek, linux-pwm, linux-omap, linux-unisoc,
linux-rockchip, linux-stm32, linux-tegra
Cc: Ray Jui, Florian Fainelli, Scott Branden, Gregory Fong,
Eugeniy Paltsev, Keerthy, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vladimir Zapolskiy, Matthias Brugger, Thierry Reding, Lee Jones,
Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
Robert Jarzmik, Manivannan Sadhasivam, Heiko Stuebner,
Ludovic Desroches, Maxime Coquelin, Alexandre Torgue,
Jonathan Hunter
Some of the drivers do not set parent device. This may lead to obstacles
during debugging or understanding the device relations from the Linux
point of view. Assign parent device for GPIO chips created by these
drivers.
While at it, let GPIO library to assign of_node from the parent device.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-bcm-kona.c | 2 +-
drivers/gpio/gpio-creg-snps.c | 2 +-
drivers/gpio/gpio-lpc32xx.c | 2 +-
drivers/gpio/gpio-pxa.c | 8 +++-----
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
index d329a143f5ec..e84474494429 100644
--- a/drivers/gpio/gpio-bcm-kona.c
+++ b/drivers/gpio/gpio-bcm-kona.c
@@ -606,7 +606,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
kona_gpio->pdev = pdev;
platform_set_drvdata(pdev, kona_gpio);
- chip->of_node = dev->of_node;
+ chip->parent = dev;
chip->ngpio = kona_gpio->num_bank * GPIO_PER_BANK;
kona_gpio->irq_domain = irq_domain_add_linear(dev->of_node,
diff --git a/drivers/gpio/gpio-creg-snps.c b/drivers/gpio/gpio-creg-snps.c
index 1d0827e79703..789384c6e178 100644
--- a/drivers/gpio/gpio-creg-snps.c
+++ b/drivers/gpio/gpio-creg-snps.c
@@ -163,12 +163,12 @@ static int creg_gpio_probe(struct platform_device *pdev)
spin_lock_init(&hcg->lock);
+ hcg->gc.parent = dev;
hcg->gc.label = dev_name(dev);
hcg->gc.base = -1;
hcg->gc.ngpio = ngpios;
hcg->gc.set = creg_gpio_set;
hcg->gc.direction_output = creg_gpio_dir_out;
- hcg->gc.of_node = dev->of_node;
ret = devm_gpiochip_add_data(dev, &hcg->gc, hcg);
if (ret)
diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c
index 4e626c4235c2..d2b65cfb336e 100644
--- a/drivers/gpio/gpio-lpc32xx.c
+++ b/drivers/gpio/gpio-lpc32xx.c
@@ -512,10 +512,10 @@ static int lpc32xx_gpio_probe(struct platform_device *pdev)
return PTR_ERR(reg_base);
for (i = 0; i < ARRAY_SIZE(lpc32xx_gpiochip); i++) {
+ lpc32xx_gpiochip[i].chip.parent = &pdev->dev;
if (pdev->dev.of_node) {
lpc32xx_gpiochip[i].chip.of_xlate = lpc32xx_of_xlate;
lpc32xx_gpiochip[i].chip.of_gpio_n_cells = 3;
- lpc32xx_gpiochip[i].chip.of_node = pdev->dev.of_node;
lpc32xx_gpiochip[i].reg_base = reg_base;
}
devm_gpiochip_add_data(&pdev->dev, &lpc32xx_gpiochip[i].chip,
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 382468e294e1..c7fbfa3ae43b 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -343,8 +343,7 @@ static int pxa_gpio_of_xlate(struct gpio_chip *gc,
}
#endif
-static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio,
- struct device_node *np, void __iomem *regbase)
+static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio, void __iomem *regbase)
{
int i, gpio, nbanks = DIV_ROUND_UP(ngpio, 32);
struct pxa_gpio_bank *bank;
@@ -354,6 +353,7 @@ static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio,
if (!pchip->banks)
return -ENOMEM;
+ pchip->chip.parent = pchip->dev;
pchip->chip.label = "gpio-pxa";
pchip->chip.direction_input = pxa_gpio_direction_input;
pchip->chip.direction_output = pxa_gpio_direction_output;
@@ -365,7 +365,6 @@ static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio,
pchip->chip.free = gpiochip_generic_free;
#ifdef CONFIG_OF_GPIO
- pchip->chip.of_node = np;
pchip->chip.of_xlate = pxa_gpio_of_xlate;
pchip->chip.of_gpio_n_cells = 2;
#endif
@@ -675,8 +674,7 @@ static int pxa_gpio_probe(struct platform_device *pdev)
}
/* Initialize GPIO chips */
- ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, pdev->dev.of_node,
- gpio_reg_base);
+ ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, gpio_reg_base);
if (ret) {
clk_put(clk);
return ret;
--
2.33.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v1 3/3] gpio: Propagate firmware node from a parent device
2021-12-02 21:08 [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Andy Shevchenko
2021-12-02 21:08 ` [PATCH v1 2/3] gpio: Setup parent device and get rid of unnecessary of_node assignment Andy Shevchenko
@ 2021-12-02 21:08 ` Andy Shevchenko
2021-12-03 8:40 ` [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Bartosz Golaszewski
` (4 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-12-02 21:08 UTC (permalink / raw)
To: Andy Shevchenko, Marc Zyngier, Matti Vaittinen,
Sergio Paracuellos, Chunyan Zhang, Bartosz Golaszewski,
Baruch Siach, Uwe Kleine-König, Tony Lindgren,
Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, linux-gpio, linux-kernel,
patches, bcm-kernel-feedback-list, linux-power, linux-arm-kernel,
linux-mediatek, linux-pwm, linux-omap, linux-unisoc,
linux-rockchip, linux-stm32, linux-tegra
Cc: Ray Jui, Florian Fainelli, Scott Branden, Gregory Fong,
Eugeniy Paltsev, Keerthy, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vladimir Zapolskiy, Matthias Brugger, Thierry Reding, Lee Jones,
Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
Robert Jarzmik, Manivannan Sadhasivam, Heiko Stuebner,
Ludovic Desroches, Maxime Coquelin, Alexandre Torgue,
Jonathan Hunter
When creating MFD platform devices the firmware node is left unset.
This, in particular, prevents GPIO library to use it for different
purposes. Propagate firmware node from the parent device and let
GPIO library do the right thing.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-arizona.c | 5 ++---
drivers/gpio/gpio-tps6586x.c | 5 ++---
drivers/gpio/gpio-tps65910.c | 6 +++---
drivers/gpio/gpio-twl6040.c | 5 ++---
drivers/gpio/gpio-wm831x.c | 5 ++---
5 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c
index 2bc173c352ce..02f9ae19cd44 100644
--- a/drivers/gpio/gpio-arizona.c
+++ b/drivers/gpio/gpio-arizona.c
@@ -151,6 +151,8 @@ static int arizona_gpio_probe(struct platform_device *pdev)
struct arizona_gpio *arizona_gpio;
int ret;
+ device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
+
arizona_gpio = devm_kzalloc(&pdev->dev, sizeof(*arizona_gpio),
GFP_KERNEL);
if (!arizona_gpio)
@@ -159,9 +161,6 @@ static int arizona_gpio_probe(struct platform_device *pdev)
arizona_gpio->arizona = arizona;
arizona_gpio->gpio_chip = template_chip;
arizona_gpio->gpio_chip.parent = &pdev->dev;
-#ifdef CONFIG_OF_GPIO
- arizona_gpio->gpio_chip.of_node = arizona->dev->of_node;
-#endif
switch (arizona->type) {
case WM5102:
diff --git a/drivers/gpio/gpio-tps6586x.c b/drivers/gpio/gpio-tps6586x.c
index da0304b764a5..c5713524b581 100644
--- a/drivers/gpio/gpio-tps6586x.c
+++ b/drivers/gpio/gpio-tps6586x.c
@@ -77,6 +77,8 @@ static int tps6586x_gpio_probe(struct platform_device *pdev)
struct tps6586x_platform_data *pdata;
struct tps6586x_gpio *tps6586x_gpio;
+ device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
+
pdata = dev_get_platdata(pdev->dev.parent);
tps6586x_gpio = devm_kzalloc(&pdev->dev,
sizeof(*tps6586x_gpio), GFP_KERNEL);
@@ -97,9 +99,6 @@ static int tps6586x_gpio_probe(struct platform_device *pdev)
tps6586x_gpio->gpio_chip.get = tps6586x_gpio_get;
tps6586x_gpio->gpio_chip.to_irq = tps6586x_gpio_to_irq;
-#ifdef CONFIG_OF_GPIO
- tps6586x_gpio->gpio_chip.of_node = pdev->dev.parent->of_node;
-#endif
if (pdata && pdata->gpio_base)
tps6586x_gpio->gpio_chip.base = pdata->gpio_base;
else
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c
index 7fa8c841081f..321e6945f0be 100644
--- a/drivers/gpio/gpio-tps65910.c
+++ b/drivers/gpio/gpio-tps65910.c
@@ -111,6 +111,8 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
int ret;
int i;
+ device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
+
tps65910_gpio = devm_kzalloc(&pdev->dev,
sizeof(*tps65910_gpio), GFP_KERNEL);
if (!tps65910_gpio)
@@ -137,9 +139,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
tps65910_gpio->gpio_chip.set = tps65910_gpio_set;
tps65910_gpio->gpio_chip.get = tps65910_gpio_get;
tps65910_gpio->gpio_chip.parent = &pdev->dev;
-#ifdef CONFIG_OF_GPIO
- tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node;
-#endif
+
if (pdata && pdata->gpio_base)
tps65910_gpio->gpio_chip.base = pdata->gpio_base;
else
diff --git a/drivers/gpio/gpio-twl6040.c b/drivers/gpio/gpio-twl6040.c
index 648fb418d775..6c3fbf382dba 100644
--- a/drivers/gpio/gpio-twl6040.c
+++ b/drivers/gpio/gpio-twl6040.c
@@ -80,6 +80,8 @@ static int gpo_twl6040_probe(struct platform_device *pdev)
struct twl6040 *twl6040 = dev_get_drvdata(twl6040_core_dev);
int ret;
+ device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
+
twl6040gpo_chip.base = -1;
if (twl6040_get_revid(twl6040) < TWL6041_REV_ES2_0)
@@ -88,9 +90,6 @@ static int gpo_twl6040_probe(struct platform_device *pdev)
twl6040gpo_chip.ngpio = 1; /* twl6041 have 1 GPO */
twl6040gpo_chip.parent = &pdev->dev;
-#ifdef CONFIG_OF_GPIO
- twl6040gpo_chip.of_node = twl6040_core_dev->of_node;
-#endif
ret = devm_gpiochip_add_data(&pdev->dev, &twl6040gpo_chip, NULL);
if (ret < 0) {
diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c
index 9cf1e5ebb352..7eaf8a28638c 100644
--- a/drivers/gpio/gpio-wm831x.c
+++ b/drivers/gpio/gpio-wm831x.c
@@ -262,6 +262,8 @@ static int wm831x_gpio_probe(struct platform_device *pdev)
struct wm831x_pdata *pdata = &wm831x->pdata;
struct wm831x_gpio *wm831x_gpio;
+ device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
+
wm831x_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm831x_gpio),
GFP_KERNEL);
if (wm831x_gpio == NULL)
@@ -275,9 +277,6 @@ static int wm831x_gpio_probe(struct platform_device *pdev)
wm831x_gpio->gpio_chip.base = pdata->gpio_base;
else
wm831x_gpio->gpio_chip.base = -1;
-#ifdef CONFIG_OF_GPIO
- wm831x_gpio->gpio_chip.of_node = wm831x->dev->of_node;
-#endif
return devm_gpiochip_add_data(&pdev->dev, &wm831x_gpio->gpio_chip, wm831x_gpio);
}
--
2.33.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-02 21:08 [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Andy Shevchenko
2021-12-02 21:08 ` [PATCH v1 2/3] gpio: Setup parent device and get rid of unnecessary of_node assignment Andy Shevchenko
2021-12-02 21:08 ` [PATCH v1 3/3] gpio: Propagate firmware node from a parent device Andy Shevchenko
@ 2021-12-03 8:40 ` Bartosz Golaszewski
2021-12-03 12:25 ` Andy Shevchenko
2021-12-05 0:06 ` Linus Walleij
` (3 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Bartosz Golaszewski @ 2021-12-03 8:40 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Marc Zyngier, Matti Vaittinen, Sergio Paracuellos, Chunyan Zhang,
Baruch Siach, Uwe Kleine-König, Tony Lindgren,
Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, patches, bcm-kernel-feedback-list,
linux-power, Linux ARM, moderated list:ARM/Mediatek SoC...,
linux-pwm, Linux-OMAP, linux-unisoc,
open list:ARM/Rockchip SoC...,
linux-stm32, linux-tegra, Ray Jui, Florian Fainelli,
Scott Branden, Gregory Fong, Eugeniy Paltsev, Keerthy,
Orson Zhai, Baolin Wang, Chunyan Zhang, Vladimir Zapolskiy,
Matthias Brugger, Thierry Reding, Lee Jones, Grygorii Strashko,
Santosh Shilimkar, Kevin Hilman, Robert Jarzmik,
Manivannan Sadhasivam, Heiko Stuebner, Ludovic Desroches,
Maxime Coquelin, Alexandre Torgue, Jonathan Hunter
On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> GPIO library does copy the of_node from the parent device of
> the GPIO chip, there is no need to repeat this in the individual
> drivers. Remove these assignment all at once.
>
> For the details one may look into the of_gpio_dev_init() implementation.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
I have a bad feeling about this but I've gone through the drivers in
this patch and it seems like you don't update any of the drivers that
use multiple child OF nodes so I can't really point out any obvious
bug.
I have another change I'm working on that's related, let me send it shortly.
Bart
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-03 8:40 ` [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Bartosz Golaszewski
@ 2021-12-03 12:25 ` Andy Shevchenko
0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-12-03 12:25 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Marc Zyngier, Matti Vaittinen, Sergio Paracuellos, Chunyan Zhang,
Baruch Siach, Uwe Kleine-König, Tony Lindgren,
Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, patches, bcm-kernel-feedback-list,
linux-power, Linux ARM, moderated list:ARM/Mediatek SoC...,
linux-pwm, Linux-OMAP, linux-unisoc,
open list:ARM/Rockchip SoC...,
linux-stm32, linux-tegra, Ray Jui, Florian Fainelli,
Scott Branden, Gregory Fong, Eugeniy Paltsev, Keerthy,
Orson Zhai, Baolin Wang, Chunyan Zhang, Vladimir Zapolskiy,
Matthias Brugger, Thierry Reding, Lee Jones, Grygorii Strashko,
Santosh Shilimkar, Kevin Hilman, Robert Jarzmik,
Manivannan Sadhasivam, Heiko Stuebner, Ludovic Desroches,
Maxime Coquelin, Alexandre Torgue, Jonathan Hunter
On Fri, Dec 03, 2021 at 09:40:55AM +0100, Bartosz Golaszewski wrote:
> On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > GPIO library does copy the of_node from the parent device of
> > the GPIO chip, there is no need to repeat this in the individual
> > drivers. Remove these assignment all at once.
> >
> > For the details one may look into the of_gpio_dev_init() implementation.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
>
> I have a bad feeling about this but I've gone through the drivers in
> this patch and it seems like you don't update any of the drivers that
> use multiple child OF nodes so I can't really point out any obvious
> bug.
Yes, like I said it's just a series to kick off the conversion.
I left the corner cases to the last.
> I have another change I'm working on that's related, let me send it shortly.
Do you mean it should be attached to the series?
--
With Best Regards,
Andy Shevchenko
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-02 21:08 [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Andy Shevchenko
` (2 preceding siblings ...)
2021-12-03 8:40 ` [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Bartosz Golaszewski
@ 2021-12-05 0:06 ` Linus Walleij
2021-12-06 13:11 ` Andy Shevchenko
2021-12-07 8:03 ` Uwe Kleine-König
` (2 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2021-12-05 0:06 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Marc Zyngier, Matti Vaittinen, Sergio Paracuellos, Chunyan Zhang,
Bartosz Golaszewski, Baruch Siach, Uwe Kleine-König,
Tony Lindgren, Nicolas Saenz Julienne, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, linux-gpio, linux-kernel,
patches, bcm-kernel-feedback-list, linux-power, linux-arm-kernel,
linux-mediatek, linux-pwm, linux-omap, linux-unisoc,
linux-rockchip, linux-stm32, linux-tegra, Ray Jui,
Florian Fainelli, Scott Branden, Gregory Fong, Eugeniy Paltsev,
Keerthy, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vladimir Zapolskiy, Matthias Brugger, Thierry Reding, Lee Jones,
Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
Robert Jarzmik, Manivannan Sadhasivam, Heiko Stuebner,
Ludovic Desroches, Maxime Coquelin, Alexandre Torgue,
Jonathan Hunter
On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> GPIO library does copy the of_node from the parent device of
> the GPIO chip, there is no need to repeat this in the individual
> drivers. Remove these assignment all at once.
>
> For the details one may look into the of_gpio_dev_init() implementation.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This is definitely a patch in the right direction, as Bart says
it can be a bit dangerous, the outliers are those drivers that
assign the .dev to something completely different than the
the dev where the of_node is copied from.
The idea was definitely always to only assign it in the core
*unless* there is a reason to have a completely different
of_node for some reason.
> +++ b/drivers/gpio/gpio-rda.c
> @@ -240,8 +240,6 @@ static int rda_gpio_probe(struct platform_device *pdev)
> rda_gpio->chip.label = dev_name(dev);
> rda_gpio->chip.ngpio = ngpios;
> rda_gpio->chip.base = -1;
> - rda_gpio->chip.parent = dev;
> - rda_gpio->chip.of_node = np;
Mention in the commit message that in this driver
you also drop the the .parent assignment because the
core will handle it.
Yours,
Linus Walleij
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-05 0:06 ` Linus Walleij
@ 2021-12-06 13:11 ` Andy Shevchenko
2021-12-06 13:19 ` Bartosz Golaszewski
0 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2021-12-06 13:11 UTC (permalink / raw)
To: Linus Walleij
Cc: Marc Zyngier, Matti Vaittinen, Sergio Paracuellos, Chunyan Zhang,
Bartosz Golaszewski, Baruch Siach, Uwe Kleine-König,
Tony Lindgren, Nicolas Saenz Julienne, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, linux-gpio, linux-kernel,
patches, bcm-kernel-feedback-list, linux-power, linux-arm-kernel,
linux-mediatek, linux-pwm, linux-omap, linux-unisoc,
linux-rockchip, linux-stm32, linux-tegra, Ray Jui,
Florian Fainelli, Scott Branden, Gregory Fong, Eugeniy Paltsev,
Keerthy, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vladimir Zapolskiy, Matthias Brugger, Thierry Reding, Lee Jones,
Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
Robert Jarzmik, Manivannan Sadhasivam, Heiko Stuebner,
Ludovic Desroches, Maxime Coquelin, Alexandre Torgue,
Jonathan Hunter
On Sun, Dec 05, 2021 at 01:06:07AM +0100, Linus Walleij wrote:
> On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>
> > GPIO library does copy the of_node from the parent device of
> > the GPIO chip, there is no need to repeat this in the individual
> > drivers. Remove these assignment all at once.
> >
> > For the details one may look into the of_gpio_dev_init() implementation.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> This is definitely a patch in the right direction, as Bart says
> it can be a bit dangerous, the outliers are those drivers that
> assign the .dev to something completely different than the
> the dev where the of_node is copied from.
I carefully checked these all and this patch series is only for the cases
when I'm sure it's the same device, which is used as parent, and its of_node
supplied.
> The idea was definitely always to only assign it in the core
> *unless* there is a reason to have a completely different
> of_node for some reason.
>
> > +++ b/drivers/gpio/gpio-rda.c
> > @@ -240,8 +240,6 @@ static int rda_gpio_probe(struct platform_device *pdev)
> > rda_gpio->chip.label = dev_name(dev);
> > rda_gpio->chip.ngpio = ngpios;
> > rda_gpio->chip.base = -1;
> > - rda_gpio->chip.parent = dev;
> > - rda_gpio->chip.of_node = np;
>
> Mention in the commit message that in this driver
> you also drop the the .parent assignment because the
> core will handle it.
Okay, I will update it. Also I'll update to the last codebase (dunno if Bart
is going to pull the IB from Lee where one of the drivers is gone: da53cc634cea
("gpio: bd70528 Drop BD70528 support").
--
With Best Regards,
Andy Shevchenko
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-06 13:11 ` Andy Shevchenko
@ 2021-12-06 13:19 ` Bartosz Golaszewski
0 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2021-12-06 13:19 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, Marc Zyngier, Matti Vaittinen, Sergio Paracuellos,
Chunyan Zhang, Baruch Siach, Uwe Kleine-König,
Tony Lindgren, Nicolas Saenz Julienne, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, patches, bcm-kernel-feedback-list,
linux-power, Linux ARM, moderated list:ARM/Mediatek SoC...,
linux-pwm, Linux-OMAP, linux-unisoc,
open list:ARM/Rockchip SoC...,
linux-stm32, linux-tegra, Ray Jui, Florian Fainelli,
Scott Branden, Gregory Fong, Eugeniy Paltsev, Keerthy,
Orson Zhai, Baolin Wang, Chunyan Zhang, Vladimir Zapolskiy,
Matthias Brugger, Thierry Reding, Lee Jones, Grygorii Strashko,
Santosh Shilimkar, Kevin Hilman, Robert Jarzmik,
Manivannan Sadhasivam, Heiko Stuebner, Ludovic Desroches,
Maxime Coquelin, Alexandre Torgue, Jonathan Hunter
On Mon, Dec 6, 2021 at 2:13 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Sun, Dec 05, 2021 at 01:06:07AM +0100, Linus Walleij wrote:
> > On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> >
> > > GPIO library does copy the of_node from the parent device of
> > > the GPIO chip, there is no need to repeat this in the individual
> > > drivers. Remove these assignment all at once.
> > >
> > > For the details one may look into the of_gpio_dev_init() implementation.
> > >
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > This is definitely a patch in the right direction, as Bart says
> > it can be a bit dangerous, the outliers are those drivers that
> > assign the .dev to something completely different than the
> > the dev where the of_node is copied from.
>
> I carefully checked these all and this patch series is only for the cases
> when I'm sure it's the same device, which is used as parent, and its of_node
> supplied.
>
> > The idea was definitely always to only assign it in the core
> > *unless* there is a reason to have a completely different
> > of_node for some reason.
> >
> > > +++ b/drivers/gpio/gpio-rda.c
> > > @@ -240,8 +240,6 @@ static int rda_gpio_probe(struct platform_device *pdev)
> > > rda_gpio->chip.label = dev_name(dev);
> > > rda_gpio->chip.ngpio = ngpios;
> > > rda_gpio->chip.base = -1;
> > > - rda_gpio->chip.parent = dev;
> > > - rda_gpio->chip.of_node = np;
> >
> > Mention in the commit message that in this driver
> > you also drop the the .parent assignment because the
> > core will handle it.
>
> Okay, I will update it. Also I'll update to the last codebase (dunno if Bart
> is going to pull the IB from Lee where one of the drivers is gone: da53cc634cea
> ("gpio: bd70528 Drop BD70528 support").
>
I didn't plan to, just drop it from your patch.
Bart
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-02 21:08 [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Andy Shevchenko
` (3 preceding siblings ...)
2021-12-05 0:06 ` Linus Walleij
@ 2021-12-07 8:03 ` Uwe Kleine-König
2021-12-07 8:05 ` Baruch Siach
2021-12-13 13:50 ` Bartosz Golaszewski
2021-12-17 16:54 ` Bartosz Golaszewski
6 siblings, 1 reply; 14+ messages in thread
From: Uwe Kleine-König @ 2021-12-07 8:03 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Marc Zyngier, Matti Vaittinen, Sergio Paracuellos, Chunyan Zhang,
Bartosz Golaszewski, Baruch Siach, Tony Lindgren,
Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, linux-gpio, linux-kernel,
patches, bcm-kernel-feedback-list, linux-power, linux-arm-kernel,
linux-mediatek, linux-pwm, linux-omap, linux-unisoc,
linux-rockchip, linux-stm32, linux-tegra, Ray Jui,
Florian Fainelli, Scott Branden, Gregory Fong, Eugeniy Paltsev,
Keerthy, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vladimir Zapolskiy, Matthias Brugger, Thierry Reding, Lee Jones,
Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
Robert Jarzmik, Manivannan Sadhasivam, Heiko Stuebner,
Ludovic Desroches, Maxime Coquelin, Alexandre Torgue,
Jonathan Hunter
[-- Attachment #1.1: Type: text/plain, Size: 384 bytes --]
Hello Andy,
you Cc: linux-pwm and the pwm maintainers in this series. I don't spot
anything pwm specific here (apart from touching gpio-mvebu which also
contains a PWM driver). Do I miss something?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-07 8:03 ` Uwe Kleine-König
@ 2021-12-07 8:05 ` Baruch Siach
2021-12-07 10:43 ` Andy Shevchenko
0 siblings, 1 reply; 14+ messages in thread
From: Baruch Siach @ 2021-12-07 8:05 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Andy Shevchenko, Marc Zyngier, Matti Vaittinen,
Sergio Paracuellos, Chunyan Zhang, Bartosz Golaszewski,
Tony Lindgren, Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, linux-gpio, linux-kernel,
patches, bcm-kernel-feedback-list, linux-power, linux-arm-kernel,
linux-mediatek, linux-pwm, linux-omap, linux-unisoc,
linux-rockchip, linux-stm32, linux-tegra, Ray Jui,
Florian Fainelli, Scott Branden, Gregory Fong, Eugeniy Paltsev,
Keerthy, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vladimir Zapolskiy, Matthias Brugger, Thierry Reding, Lee Jones,
Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
Robert Jarzmik, Manivannan Sadhasivam, Heiko Stuebner,
Ludovic Desroches, Maxime Coquelin, Alexandre Torgue,
Jonathan Hunter
Hi Uwe,
On Tue, Dec 07 2021, Uwe Kleine-König wrote:
> Hello Andy,
>
> you Cc: linux-pwm and the pwm maintainers in this series. I don't spot
> anything pwm specific here (apart from touching gpio-mvebu which also
> contains a PWM driver). Do I miss something?
That's probably because of drivers/gpio/gpio-mvebu.c that appears in the
MAINTAINERS PWM entry.
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-07 8:05 ` Baruch Siach
@ 2021-12-07 10:43 ` Andy Shevchenko
0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-12-07 10:43 UTC (permalink / raw)
To: Baruch Siach
Cc: Uwe Kleine-König, Marc Zyngier, Matti Vaittinen,
Sergio Paracuellos, Chunyan Zhang, Bartosz Golaszewski,
Tony Lindgren, Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, linux-gpio, linux-kernel,
patches, bcm-kernel-feedback-list, linux-power, linux-arm-kernel,
linux-mediatek, linux-pwm, linux-omap, linux-unisoc,
linux-rockchip, linux-stm32, linux-tegra, Ray Jui,
Florian Fainelli, Scott Branden, Gregory Fong, Eugeniy Paltsev,
Keerthy, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vladimir Zapolskiy, Matthias Brugger, Thierry Reding, Lee Jones,
Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
Robert Jarzmik, Manivannan Sadhasivam, Heiko Stuebner,
Ludovic Desroches, Maxime Coquelin, Alexandre Torgue,
Jonathan Hunter
On Tue, Dec 07, 2021 at 10:05:08AM +0200, Baruch Siach wrote:
> On Tue, Dec 07 2021, Uwe Kleine-König wrote:
> > Hello Andy,
> >
> > you Cc: linux-pwm and the pwm maintainers in this series. I don't spot
> > anything pwm specific here (apart from touching gpio-mvebu which also
> > contains a PWM driver). Do I miss something?
Thanks for your eagle eye! For the record I don't do this list manually,
I used the get_maintainer.pl's heuristics [1]. Usually it gives me more
than 95% correct prediction, so I believe here is no smoke without flame
(and it seems what Baruch discovered as well).
> That's probably because of drivers/gpio/gpio-mvebu.c that appears in the
> MAINTAINERS PWM entry.
[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh
--
With Best Regards,
Andy Shevchenko
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-02 21:08 [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Andy Shevchenko
` (4 preceding siblings ...)
2021-12-07 8:03 ` Uwe Kleine-König
@ 2021-12-13 13:50 ` Bartosz Golaszewski
2021-12-13 14:04 ` Andy Shevchenko
2021-12-17 16:54 ` Bartosz Golaszewski
6 siblings, 1 reply; 14+ messages in thread
From: Bartosz Golaszewski @ 2021-12-13 13:50 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Marc Zyngier, Matti Vaittinen, Sergio Paracuellos, Chunyan Zhang,
Baruch Siach, Uwe Kleine-König, Tony Lindgren,
Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, patches, bcm-kernel-feedback-list,
linux-power, Linux ARM, moderated list:ARM/Mediatek SoC...,
open list:PWM SUBSYSTEM, Linux-OMAP, linux-unisoc,
open list:ARM/Rockchip SoC...,
linux-stm32, linux-tegra, Ray Jui, Florian Fainelli,
Scott Branden, Gregory Fong, Eugeniy Paltsev, Keerthy,
Orson Zhai, Baolin Wang, Chunyan Zhang, Vladimir Zapolskiy,
Matthias Brugger, Thierry Reding, Lee Jones, Grygorii Strashko,
Santosh Shilimkar, Kevin Hilman, Robert Jarzmik,
Manivannan Sadhasivam, Heiko Stuebner, Ludovic Desroches,
Maxime Coquelin, Alexandre Torgue, Jonathan Hunter
On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> GPIO library does copy the of_node from the parent device of
> the GPIO chip, there is no need to repeat this in the individual
> drivers. Remove these assignment all at once.
>
> For the details one may look into the of_gpio_dev_init() implementation.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
If there are no objections, I am willing to apply this to give it some
time in next and get the work on dropping the OF APIs from gpiolib
going.
Bart
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-13 13:50 ` Bartosz Golaszewski
@ 2021-12-13 14:04 ` Andy Shevchenko
0 siblings, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-12-13 14:04 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Marc Zyngier, Matti Vaittinen, Sergio Paracuellos, Chunyan Zhang,
Baruch Siach, Uwe Kleine-König, Tony Lindgren,
Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, patches, bcm-kernel-feedback-list,
linux-power, Linux ARM, moderated list:ARM/Mediatek SoC...,
open list:PWM SUBSYSTEM, Linux-OMAP, linux-unisoc,
open list:ARM/Rockchip SoC...,
linux-stm32, linux-tegra, Ray Jui, Florian Fainelli,
Scott Branden, Gregory Fong, Eugeniy Paltsev, Keerthy,
Orson Zhai, Baolin Wang, Chunyan Zhang, Vladimir Zapolskiy,
Matthias Brugger, Thierry Reding, Lee Jones, Grygorii Strashko,
Santosh Shilimkar, Kevin Hilman, Robert Jarzmik,
Manivannan Sadhasivam, Heiko Stuebner, Ludovic Desroches,
Maxime Coquelin, Alexandre Torgue, Jonathan Hunter
On Mon, Dec 13, 2021 at 02:50:57PM +0100, Bartosz Golaszewski wrote:
> On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > GPIO library does copy the of_node from the parent device of
> > the GPIO chip, there is no need to repeat this in the individual
> > drivers. Remove these assignment all at once.
> >
> > For the details one may look into the of_gpio_dev_init() implementation.
> If there are no objections, I am willing to apply this to give it some
> time in next and get the work on dropping the OF APIs from gpiolib
> going.
There was a v2 sent out.
Message-Id: <20211206131852.74746-1-andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers
2021-12-02 21:08 [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers Andy Shevchenko
` (5 preceding siblings ...)
2021-12-13 13:50 ` Bartosz Golaszewski
@ 2021-12-17 16:54 ` Bartosz Golaszewski
6 siblings, 0 replies; 14+ messages in thread
From: Bartosz Golaszewski @ 2021-12-17 16:54 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Marc Zyngier, Matti Vaittinen, Sergio Paracuellos, Chunyan Zhang,
Baruch Siach, Uwe Kleine-König, Tony Lindgren,
Nicolas Saenz Julienne, Linus Walleij, Jianqun Xu,
Alexandru Ardelean, Thierry Reding, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, patches, bcm-kernel-feedback-list,
linux-power, Linux ARM, moderated list:ARM/Mediatek SoC...,
open list:PWM SUBSYSTEM, Linux-OMAP, linux-unisoc,
open list:ARM/Rockchip SoC...,
linux-stm32, linux-tegra, Ray Jui, Florian Fainelli,
Scott Branden, Gregory Fong, Eugeniy Paltsev, Keerthy,
Orson Zhai, Baolin Wang, Chunyan Zhang, Vladimir Zapolskiy,
Matthias Brugger, Thierry Reding, Lee Jones, Grygorii Strashko,
Santosh Shilimkar, Kevin Hilman, Robert Jarzmik,
Manivannan Sadhasivam, Heiko Stuebner, Ludovic Desroches,
Maxime Coquelin, Alexandre Torgue, Jonathan Hunter
On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> GPIO library does copy the of_node from the parent device of
> the GPIO chip, there is no need to repeat this in the individual
> drivers. Remove these assignment all at once.
>
> For the details one may look into the of_gpio_dev_init() implementation.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Queued the series for next, thanks!
Bart
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 14+ messages in thread