linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: Use of_property_read_bool() for boolean properties
@ 2023-03-10 14:46 Rob Herring
  2023-03-13  8:25 ` Philippe Mathieu-Daudé
  2023-03-14 16:18 ` Thomas Bogendoerfer
  0 siblings, 2 replies; 5+ messages in thread
From: Rob Herring @ 2023-03-10 14:46 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: devicetree, linux-mips, linux-kernel

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: Rob Herring <robh@kernel.org>
---
 arch/mips/pci/pci-lantiq.c | 2 +-
 arch/mips/pci/pci-rt3883.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index d967e4c0cf24..79e29bf42a24 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -118,7 +118,7 @@ static int ltq_pci_startup(struct platform_device *pdev)
 
 	/* and enable the clocks */
 	clk_enable(clk_pci);
-	if (of_find_property(node, "lantiq,external-clock", NULL))
+	if (of_property_read_bool(node, "lantiq,external-clock"))
 		clk_enable(clk_external);
 	else
 		clk_disable(clk_external);
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c
index d59888aaed81..4ac68a534e4f 100644
--- a/arch/mips/pci/pci-rt3883.c
+++ b/arch/mips/pci/pci-rt3883.c
@@ -419,7 +419,7 @@ static int rt3883_pci_probe(struct platform_device *pdev)
 
 	/* find the interrupt controller child node */
 	for_each_child_of_node(np, child) {
-		if (of_get_property(child, "interrupt-controller", NULL)) {
+		if (of_property_read_bool(child, "interrupt-controller")) {
 			rpc->intc_of_node = child;
 			break;
 		}
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mips: Use of_property_read_bool() for boolean properties
  2023-03-10 14:46 [PATCH] mips: Use of_property_read_bool() for boolean properties Rob Herring
@ 2023-03-13  8:25 ` Philippe Mathieu-Daudé
  2023-03-13 10:59   ` Jonas Gorski
  2023-03-14 15:20   ` Rob Herring
  2023-03-14 16:18 ` Thomas Bogendoerfer
  1 sibling, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-03-13  8:25 UTC (permalink / raw)
  To: Rob Herring, Thomas Bogendoerfer; +Cc: devicetree, linux-mips, linux-kernel

Hi Rob,

On 10/3/23 15:46, Rob Herring wrote:
> It is preferred to use typed property access functions (i.e.
> of_property_read_<type> functions) rather than low-level
> of_get_property/of_find_property functions for reading properties.
> Convert reading boolean properties to to of_property_read_bool().
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>   arch/mips/pci/pci-lantiq.c | 2 +-
>   arch/mips/pci/pci-rt3883.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
> index d967e4c0cf24..79e29bf42a24 100644
> --- a/arch/mips/pci/pci-lantiq.c
> +++ b/arch/mips/pci/pci-lantiq.c
> @@ -118,7 +118,7 @@ static int ltq_pci_startup(struct platform_device *pdev)
>   
>   	/* and enable the clocks */
>   	clk_enable(clk_pci);
> -	if (of_find_property(node, "lantiq,external-clock", NULL))
> +	if (of_property_read_bool(node, "lantiq,external-clock"))

Just curious, is this property correct? I can't find it and wonder if
this is dead code (always disabling the clock)... I'm probably missing
something obvious :/

>   		clk_enable(clk_external);
>   	else
>   		clk_disable(clk_external);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mips: Use of_property_read_bool() for boolean properties
  2023-03-13  8:25 ` Philippe Mathieu-Daudé
@ 2023-03-13 10:59   ` Jonas Gorski
  2023-03-14 15:20   ` Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Jonas Gorski @ 2023-03-13 10:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Rob Herring, Thomas Bogendoerfer, devicetree, linux-mips, linux-kernel

Hi,

On Mon, 13 Mar 2023 at 09:31, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Hi Rob,
>
> On 10/3/23 15:46, Rob Herring wrote:
> > It is preferred to use typed property access functions (i.e.
> > of_property_read_<type> functions) rather than low-level
> > of_get_property/of_find_property functions for reading properties.
> > Convert reading boolean properties to to of_property_read_bool().
> >
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> >   arch/mips/pci/pci-lantiq.c | 2 +-
> >   arch/mips/pci/pci-rt3883.c | 2 +-
> >   2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
> > index d967e4c0cf24..79e29bf42a24 100644
> > --- a/arch/mips/pci/pci-lantiq.c
> > +++ b/arch/mips/pci/pci-lantiq.c
> > @@ -118,7 +118,7 @@ static int ltq_pci_startup(struct platform_device *pdev)
> >
> >       /* and enable the clocks */
> >       clk_enable(clk_pci);
> > -     if (of_find_property(node, "lantiq,external-clock", NULL))
> > +     if (of_property_read_bool(node, "lantiq,external-clock"))
>
> Just curious, is this property correct? I can't find it and wonder if
> this is dead code (always disabling the clock)... I'm probably missing
> something obvious :/
>
> >               clk_enable(clk_external);
> >       else
> >               clk_disable(clk_external);

The (whole) binding does seem to be undocumented, at least a quick
grep didn't find anything for "lantiq,pci-xway" in bindings :-/

The property itself is used in OpenWrt though, e.g.
https://github.com/openwrt/openwrt/blob/master/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/danube_arcadyan_arv7518pw.dts#L209

Regards
Jonas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mips: Use of_property_read_bool() for boolean properties
  2023-03-13  8:25 ` Philippe Mathieu-Daudé
  2023-03-13 10:59   ` Jonas Gorski
@ 2023-03-14 15:20   ` Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2023-03-14 15:20 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Thomas Bogendoerfer, devicetree, linux-mips, linux-kernel

On Mon, Mar 13, 2023 at 3:25 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> Hi Rob,
>
> On 10/3/23 15:46, Rob Herring wrote:
> > It is preferred to use typed property access functions (i.e.
> > of_property_read_<type> functions) rather than low-level
> > of_get_property/of_find_property functions for reading properties.
> > Convert reading boolean properties to to of_property_read_bool().
> >
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> >   arch/mips/pci/pci-lantiq.c | 2 +-
> >   arch/mips/pci/pci-rt3883.c | 2 +-
> >   2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
> > index d967e4c0cf24..79e29bf42a24 100644
> > --- a/arch/mips/pci/pci-lantiq.c
> > +++ b/arch/mips/pci/pci-lantiq.c
> > @@ -118,7 +118,7 @@ static int ltq_pci_startup(struct platform_device *pdev)
> >
> >       /* and enable the clocks */
> >       clk_enable(clk_pci);
> > -     if (of_find_property(node, "lantiq,external-clock", NULL))
> > +     if (of_property_read_bool(node, "lantiq,external-clock"))
>
> Just curious, is this property correct?

Shrug. I can only tell from how it is used here and because we have
other similar properties used to select a clock.

> I can't find it and wonder if
> this is dead code (always disabling the clock)... I'm probably missing
> something obvious :/

If you don't use the external clock, then you disable it. Seems sensible to me.

>
> >               clk_enable(clk_external);
> >       else
> >               clk_disable(clk_external);
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mips: Use of_property_read_bool() for boolean properties
  2023-03-10 14:46 [PATCH] mips: Use of_property_read_bool() for boolean properties Rob Herring
  2023-03-13  8:25 ` Philippe Mathieu-Daudé
@ 2023-03-14 16:18 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Bogendoerfer @ 2023-03-14 16:18 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-mips, linux-kernel

On Fri, Mar 10, 2023 at 08:46:56AM -0600, Rob Herring wrote:
> It is preferred to use typed property access functions (i.e.
> of_property_read_<type> functions) rather than low-level
> of_get_property/of_find_property functions for reading properties.
> Convert reading boolean properties to to of_property_read_bool().
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  arch/mips/pci/pci-lantiq.c | 2 +-
>  arch/mips/pci/pci-rt3883.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-14 16:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 14:46 [PATCH] mips: Use of_property_read_bool() for boolean properties Rob Herring
2023-03-13  8:25 ` Philippe Mathieu-Daudé
2023-03-13 10:59   ` Jonas Gorski
2023-03-14 15:20   ` Rob Herring
2023-03-14 16:18 ` Thomas Bogendoerfer

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).