Thread (17 messages) 17 messages, 5 authors, 2021-12-17

Re: [PATCH v1 1/3] gpio: Get rid of duplicate of_node assignment in the drivers

From: Linus Walleij <hidden>
Date: 2021-12-05 00:06:30
Also in: linux-arm-kernel, linux-mediatek, linux-omap, linux-pwm, linux-rockchip, linux-tegra, lkml

On Thu, Dec 2, 2021 at 10:17 PM Andy Shevchenko
[off-list ref] 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.
quoted hunk ↗ jump to hunk
+++ 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help