[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hx_zQj+JHdgkvHaq4C_UVqNAH_8ANF-v4fEmRWKyRCMA@mail.gmail.com>
Date: Mon, 27 Mar 2023 19:09:30 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Rob Herring <robh@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Anup Patel <anup@...infault.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>, devicetree@...r.kernel.org,
linux-pm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org
Subject: Re: [PATCH] cpuidle: Use of_property_present() for testing DT
property presence
On Fri, Mar 10, 2023 at 6:47 PM Ulf Hansson <ulf.hansson@...aro.org> wrote:
>
> On Fri, 10 Mar 2023 at 15:47, Rob Herring <robh@...nel.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@...nel.org>
>
> Acked-by: Ulf Hansson <ulf.hansson@...aro.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
> >
Powered by blists - more mailing lists