devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpuidle: Use of_property_present() for testing DT property presence
@ 2023-03-10 14:47 Rob Herring
  2023-03-10 17:46 ` Ulf Hansson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rob Herring @ 2023-03-10 14:47 UTC (permalink / raw)
  To: Ulf Hansson, Rafael J. Wysocki, Daniel Lezcano, Anup Patel,
	Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: devicetree, linux-pm, linux-arm-kernel, linux-kernel, linux-riscv

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. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/cpuidle/cpuidle-psci-domain.c | 2 +-
 drivers/cpuidle/cpuidle-riscv-sbi.c   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
index 6ad2954948a5..e875ddadc51b 100644
--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -165,7 +165,7 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
 	 * initialize a genpd/genpd-of-provider pair when it's found.
 	 */
 	for_each_child_of_node(np, node) {
-		if (!of_find_property(node, "#power-domain-cells", NULL))
+		if (!of_property_present(node, "#power-domain-cells"))
 			continue;
 
 		ret = psci_pd_init(node, use_osi);
diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
index be383f4b6855..1fab1abc6eb6 100644
--- a/drivers/cpuidle/cpuidle-riscv-sbi.c
+++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
@@ -497,7 +497,7 @@ static int sbi_genpd_probe(struct device_node *np)
 	 * initialize a genpd/genpd-of-provider pair when it's found.
 	 */
 	for_each_child_of_node(np, node) {
-		if (!of_find_property(node, "#power-domain-cells", NULL))
+		if (!of_property_present(node, "#power-domain-cells"))
 			continue;
 
 		ret = sbi_pd_init(node);
@@ -548,8 +548,8 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
 	for_each_possible_cpu(cpu) {
 		np = of_cpu_device_node_get(cpu);
 		if (np &&
-		    of_find_property(np, "power-domains", NULL) &&
-		    of_find_property(np, "power-domain-names", NULL)) {
+		    of_property_present(np, "power-domains") &&
+		    of_property_present(np, "power-domain-names")) {
 			continue;
 		} else {
 			sbi_cpuidle_use_osi = false;
-- 
2.39.2


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

* Re: [PATCH] cpuidle: Use of_property_present() for testing DT property presence
  2023-03-10 14:47 [PATCH] cpuidle: Use of_property_present() for testing DT property presence Rob Herring
@ 2023-03-10 17:46 ` Ulf Hansson
  2023-03-27 17:09   ` Rafael J. Wysocki
  2023-03-17  4:15 ` Anup Patel
  2023-05-08 14:41 ` patchwork-bot+linux-riscv
  2 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2023-03-10 17:46 UTC (permalink / raw)
  To: Rob Herring, Rafael J. Wysocki
  Cc: Daniel Lezcano, Anup Patel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, devicetree, linux-pm, linux-arm-kernel, linux-kernel,
	linux-riscv

On Fri, 10 Mar 2023 at 15:47, Rob Herring <robh@kernel.org> 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. As
> part of this, convert of_get_property/of_find_property calls to the
> recently added of_property_present() helper when we just want to test
> for presence of a property and nothing more.
>
> Signed-off-by: Rob Herring <robh@kernel.org>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Rafael, can you please pick this via your tree.

Kind regards
Uffe

> ---
>  drivers/cpuidle/cpuidle-psci-domain.c | 2 +-
>  drivers/cpuidle/cpuidle-riscv-sbi.c   | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index 6ad2954948a5..e875ddadc51b 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -165,7 +165,7 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
>          * initialize a genpd/genpd-of-provider pair when it's found.
>          */
>         for_each_child_of_node(np, node) {
> -               if (!of_find_property(node, "#power-domain-cells", NULL))
> +               if (!of_property_present(node, "#power-domain-cells"))
>                         continue;
>
>                 ret = psci_pd_init(node, use_osi);
> diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
> index be383f4b6855..1fab1abc6eb6 100644
> --- a/drivers/cpuidle/cpuidle-riscv-sbi.c
> +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
> @@ -497,7 +497,7 @@ static int sbi_genpd_probe(struct device_node *np)
>          * initialize a genpd/genpd-of-provider pair when it's found.
>          */
>         for_each_child_of_node(np, node) {
> -               if (!of_find_property(node, "#power-domain-cells", NULL))
> +               if (!of_property_present(node, "#power-domain-cells"))
>                         continue;
>
>                 ret = sbi_pd_init(node);
> @@ -548,8 +548,8 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
>         for_each_possible_cpu(cpu) {
>                 np = of_cpu_device_node_get(cpu);
>                 if (np &&
> -                   of_find_property(np, "power-domains", NULL) &&
> -                   of_find_property(np, "power-domain-names", NULL)) {
> +                   of_property_present(np, "power-domains") &&
> +                   of_property_present(np, "power-domain-names")) {
>                         continue;
>                 } else {
>                         sbi_cpuidle_use_osi = false;
> --
> 2.39.2
>

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

* Re: [PATCH] cpuidle: Use of_property_present() for testing DT property presence
  2023-03-10 14:47 [PATCH] cpuidle: Use of_property_present() for testing DT property presence Rob Herring
  2023-03-10 17:46 ` Ulf Hansson
@ 2023-03-17  4:15 ` Anup Patel
  2023-05-08 14:41 ` patchwork-bot+linux-riscv
  2 siblings, 0 replies; 5+ messages in thread
From: Anup Patel @ 2023-03-17  4:15 UTC (permalink / raw)
  To: Rob Herring
  Cc: Ulf Hansson, Rafael J. Wysocki, Daniel Lezcano, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, devicetree, linux-pm, linux-arm-kernel,
	linux-kernel, linux-riscv

On Fri, Mar 10, 2023 at 8:17 PM Rob Herring <robh@kernel.org> 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. As
> part of this, convert of_get_property/of_find_property calls to the
> recently added of_property_present() helper when we just want to test
> for presence of a property and nothing more.
>
> Signed-off-by: Rob Herring <robh@kernel.org>

For cpuidle-riscv-sbi:

Acked-by: Anup Patel <anup@brainfault.org>

Thanks,
Anup

> ---
>  drivers/cpuidle/cpuidle-psci-domain.c | 2 +-
>  drivers/cpuidle/cpuidle-riscv-sbi.c   | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index 6ad2954948a5..e875ddadc51b 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -165,7 +165,7 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
>          * initialize a genpd/genpd-of-provider pair when it's found.
>          */
>         for_each_child_of_node(np, node) {
> -               if (!of_find_property(node, "#power-domain-cells", NULL))
> +               if (!of_property_present(node, "#power-domain-cells"))
>                         continue;
>
>                 ret = psci_pd_init(node, use_osi);
> diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
> index be383f4b6855..1fab1abc6eb6 100644
> --- a/drivers/cpuidle/cpuidle-riscv-sbi.c
> +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
> @@ -497,7 +497,7 @@ static int sbi_genpd_probe(struct device_node *np)
>          * initialize a genpd/genpd-of-provider pair when it's found.
>          */
>         for_each_child_of_node(np, node) {
> -               if (!of_find_property(node, "#power-domain-cells", NULL))
> +               if (!of_property_present(node, "#power-domain-cells"))
>                         continue;
>
>                 ret = sbi_pd_init(node);
> @@ -548,8 +548,8 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
>         for_each_possible_cpu(cpu) {
>                 np = of_cpu_device_node_get(cpu);
>                 if (np &&
> -                   of_find_property(np, "power-domains", NULL) &&
> -                   of_find_property(np, "power-domain-names", NULL)) {
> +                   of_property_present(np, "power-domains") &&
> +                   of_property_present(np, "power-domain-names")) {
>                         continue;
>                 } else {
>                         sbi_cpuidle_use_osi = false;
> --
> 2.39.2
>

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

* Re: [PATCH] cpuidle: Use of_property_present() for testing DT property presence
  2023-03-10 17:46 ` Ulf Hansson
@ 2023-03-27 17:09   ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2023-03-27 17:09 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rob Herring, Rafael J. Wysocki, Daniel Lezcano, Anup Patel,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, devicetree, linux-pm,
	linux-arm-kernel, linux-kernel, linux-riscv

On Fri, Mar 10, 2023 at 6:47 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Fri, 10 Mar 2023 at 15:47, Rob Herring <robh@kernel.org> 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. As
> > part of this, convert of_get_property/of_find_property calls to the
> > recently added of_property_present() helper when we just want to test
> > for presence of a property and nothing more.
> >
> > Signed-off-by: Rob Herring <robh@kernel.org>
>
> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Rafael, can you please pick this via your tree.

Done (queued up for 6.4), thanks!

> > ---
> >  drivers/cpuidle/cpuidle-psci-domain.c | 2 +-
> >  drivers/cpuidle/cpuidle-riscv-sbi.c   | 6 +++---
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> > index 6ad2954948a5..e875ddadc51b 100644
> > --- a/drivers/cpuidle/cpuidle-psci-domain.c
> > +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> > @@ -165,7 +165,7 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
> >          * initialize a genpd/genpd-of-provider pair when it's found.
> >          */
> >         for_each_child_of_node(np, node) {
> > -               if (!of_find_property(node, "#power-domain-cells", NULL))
> > +               if (!of_property_present(node, "#power-domain-cells"))
> >                         continue;
> >
> >                 ret = psci_pd_init(node, use_osi);
> > diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
> > index be383f4b6855..1fab1abc6eb6 100644
> > --- a/drivers/cpuidle/cpuidle-riscv-sbi.c
> > +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
> > @@ -497,7 +497,7 @@ static int sbi_genpd_probe(struct device_node *np)
> >          * initialize a genpd/genpd-of-provider pair when it's found.
> >          */
> >         for_each_child_of_node(np, node) {
> > -               if (!of_find_property(node, "#power-domain-cells", NULL))
> > +               if (!of_property_present(node, "#power-domain-cells"))
> >                         continue;
> >
> >                 ret = sbi_pd_init(node);
> > @@ -548,8 +548,8 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
> >         for_each_possible_cpu(cpu) {
> >                 np = of_cpu_device_node_get(cpu);
> >                 if (np &&
> > -                   of_find_property(np, "power-domains", NULL) &&
> > -                   of_find_property(np, "power-domain-names", NULL)) {
> > +                   of_property_present(np, "power-domains") &&
> > +                   of_property_present(np, "power-domain-names")) {
> >                         continue;
> >                 } else {
> >                         sbi_cpuidle_use_osi = false;
> > --
> > 2.39.2
> >

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

* Re: [PATCH] cpuidle: Use of_property_present() for testing DT property presence
  2023-03-10 14:47 [PATCH] cpuidle: Use of_property_present() for testing DT property presence Rob Herring
  2023-03-10 17:46 ` Ulf Hansson
  2023-03-17  4:15 ` Anup Patel
@ 2023-05-08 14:41 ` patchwork-bot+linux-riscv
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-05-08 14:41 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-riscv, ulf.hansson, rafael, daniel.lezcano, anup,
	paul.walmsley, palmer, aou, devicetree, linux-pm,
	linux-arm-kernel, linux-kernel

Hello:

This patch was applied to riscv/linux.git (fixes)
by Rafael J. Wysocki <rafael.j.wysocki@intel.com>:

On Fri, 10 Mar 2023 08:47:03 -0600 you 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. As
> part of this, convert of_get_property/of_find_property calls to the
> recently added of_property_present() helper when we just want to test
> for presence of a property and nothing more.
> 
> [...]

Here is the summary with links:
  - cpuidle: Use of_property_present() for testing DT property presence
    https://git.kernel.org/riscv/c/f914bfdd7f84

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-05-08 14:42 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:47 [PATCH] cpuidle: Use of_property_present() for testing DT property presence Rob Herring
2023-03-10 17:46 ` Ulf Hansson
2023-03-27 17:09   ` Rafael J. Wysocki
2023-03-17  4:15 ` Anup Patel
2023-05-08 14:41 ` patchwork-bot+linux-riscv

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