* [PATCH v1 1/1] pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API
@ 2024-08-22 23:01 Andy Shevchenko
2024-08-23 7:23 ` Geert Uytterhoeven
2024-08-23 14:05 ` Lad, Prabhakar
0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-08-22 23:01 UTC (permalink / raw)
To: Geert Uytterhoeven, linux-renesas-soc, linux-gpio, linux-kernel
Cc: Linus Walleij, Andy Shevchenko
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 5e3d735a8570..73b55e096106 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -16,6 +16,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/seq_file.h>
#include <linux/spinlock.h>
@@ -2624,7 +2625,7 @@ static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl)
girq = &chip->irq;
gpio_irq_chip_set_chip(girq, &rzg2l_gpio_irqchip);
- girq->fwnode = of_node_to_fwnode(np);
+ girq->fwnode = dev_fwnode(pctrl->dev);
girq->parent_domain = parent_domain;
girq->child_to_parent_hwirq = rzg2l_gpio_child_to_parent_hwirq;
girq->populate_parent_alloc_arg = rzg2l_gpio_populate_parent_fwspec;
--
2.46.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API
2024-08-22 23:01 [PATCH v1 1/1] pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API Andy Shevchenko
@ 2024-08-23 7:23 ` Geert Uytterhoeven
2024-08-23 13:17 ` Andy Shevchenko
2024-08-23 14:05 ` Lad, Prabhakar
1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2024-08-23 7:23 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-renesas-soc, linux-gpio, linux-kernel, Linus Walleij,
Lad, Prabhakar
Hi Andy,
On Fri, Aug 23, 2024 at 1:01 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> of_node_to_fwnode() is a IRQ domain specific implementation of
> of_fwnode_handle(). Replace the former with more suitable API.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Thanks for your patch!
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -16,6 +16,7 @@
> #include <linux/of.h>
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/seq_file.h>
> #include <linux/spinlock.h>
>
> @@ -2624,7 +2625,7 @@ static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl)
>
> girq = &chip->irq;
> gpio_irq_chip_set_chip(girq, &rzg2l_gpio_irqchip);
> - girq->fwnode = of_node_to_fwnode(np);
> + girq->fwnode = dev_fwnode(pctrl->dev);
While this looks correct, the new call goes through many more hoops, and
is not a simple inline function.
Perhaps just &np->fwnode? ;-)
> girq->parent_domain = parent_domain;
> girq->child_to_parent_hwirq = rzg2l_gpio_child_to_parent_hwirq;
> girq->populate_parent_alloc_arg = rzg2l_gpio_populate_parent_fwspec;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API
2024-08-23 7:23 ` Geert Uytterhoeven
@ 2024-08-23 13:17 ` Andy Shevchenko
2024-08-29 12:51 ` Geert Uytterhoeven
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2024-08-23 13:17 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-renesas-soc, linux-gpio, linux-kernel, Linus Walleij,
Lad, Prabhakar
On Fri, Aug 23, 2024 at 10:23 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> On Fri, Aug 23, 2024 at 1:01 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > of_node_to_fwnode() is a IRQ domain specific implementation of
> > of_fwnode_handle(). Replace the former with more suitable API.
...
> > - girq->fwnode = of_node_to_fwnode(np);
> > + girq->fwnode = dev_fwnode(pctrl->dev);
>
> While this looks correct, the new call goes through many more hoops, and
> is not a simple inline function.
Maybe, but it's not a hot path anyway.
> Perhaps just &np->fwnode? ;-)
Definitely not for a couple of reasons:
- the explicit dereferencing may prevent from easier cleaning up and
moving the fwnode members around in the driver core
- the GPIO library internally doesn't use OF node directly, so the
code that call GPIO library would be better to follow that
Additionally one can call of_fwnode_handle(), but going here and there
with it makes no sense as it much cleaner to see that this fwnode
comes directly from the device. This is not obvious from the original
or any code that uses np.
After all the idea at minimum to isolate of_node_to_fwnode() from all,
but native IRQ chips (basically there are two big users: native IRQ
chips and PCI MSI).
P.S. Also note, it's _the only_ pin control driver that uses that API.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API
2024-08-22 23:01 [PATCH v1 1/1] pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API Andy Shevchenko
2024-08-23 7:23 ` Geert Uytterhoeven
@ 2024-08-23 14:05 ` Lad, Prabhakar
1 sibling, 0 replies; 5+ messages in thread
From: Lad, Prabhakar @ 2024-08-23 14:05 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Geert Uytterhoeven, linux-renesas-soc, linux-gpio, linux-kernel,
Linus Walleij
On Fri, Aug 23, 2024 at 12:42 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> of_node_to_fwnode() is a IRQ domain specific implementation of
> of_fwnode_handle(). Replace the former with more suitable API.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
> drivers/pinctrl/renesas/pinctrl-rzg2l.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cheers,
Prabhakar
> diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> index 5e3d735a8570..73b55e096106 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -16,6 +16,7 @@
> #include <linux/of.h>
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/seq_file.h>
> #include <linux/spinlock.h>
>
> @@ -2624,7 +2625,7 @@ static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl)
>
> girq = &chip->irq;
> gpio_irq_chip_set_chip(girq, &rzg2l_gpio_irqchip);
> - girq->fwnode = of_node_to_fwnode(np);
> + girq->fwnode = dev_fwnode(pctrl->dev);
> girq->parent_domain = parent_domain;
> girq->child_to_parent_hwirq = rzg2l_gpio_child_to_parent_hwirq;
> girq->populate_parent_alloc_arg = rzg2l_gpio_populate_parent_fwspec;
> --
> 2.46.0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API
2024-08-23 13:17 ` Andy Shevchenko
@ 2024-08-29 12:51 ` Geert Uytterhoeven
0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2024-08-29 12:51 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-renesas-soc, linux-gpio, linux-kernel, Linus Walleij,
Lad, Prabhakar
Hi Andy,
On Fri, Aug 23, 2024 at 3:17 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Fri, Aug 23, 2024 at 10:23 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Fri, Aug 23, 2024 at 1:01 AM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > > of_node_to_fwnode() is a IRQ domain specific implementation of
> > > of_fwnode_handle(). Replace the former with more suitable API.
>
> ...
>
> > > - girq->fwnode = of_node_to_fwnode(np);
> > > + girq->fwnode = dev_fwnode(pctrl->dev);
> >
> > While this looks correct, the new call goes through many more hoops, and
> > is not a simple inline function.
[...]
> P.S. Also note, it's _the only_ pin control driver that uses that API.
Thanks for the explanation!
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-pinctrl for v6.12.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-29 12:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 23:01 [PATCH v1 1/1] pinctrl: renesas: rzg2l: Replace of_node_to_fwnode() with more suitable API Andy Shevchenko
2024-08-23 7:23 ` Geert Uytterhoeven
2024-08-23 13:17 ` Andy Shevchenko
2024-08-29 12:51 ` Geert Uytterhoeven
2024-08-23 14:05 ` Lad, Prabhakar
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).