cpufreq: pmac32: Use of_property_read_reg() to parse "reg"

Message ID 20230609183111.1765507-1-robh@kernel.org
State New
Headers
Series cpufreq: pmac32: Use of_property_read_reg() to parse "reg" |

Commit Message

Rob Herring June 9, 2023, 6:31 p.m. UTC
  Use the recently added of_property_read_reg() helper to get the
untranslated "reg" address value.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/cpufreq/pmac32-cpufreq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
  

Comments

Rob Herring June 30, 2023, 9:02 p.m. UTC | #1
On Fri, Jun 9, 2023 at 12:31 PM Rob Herring <robh@kernel.org> wrote:
>
> Use the recently added of_property_read_reg() helper to get the
> untranslated "reg" address value.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/cpufreq/pmac32-cpufreq.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Ping!

>
> diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
> index ec75e79659ac..f53635ba16c1 100644
> --- a/drivers/cpufreq/pmac32-cpufreq.c
> +++ b/drivers/cpufreq/pmac32-cpufreq.c
> @@ -378,10 +378,9 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
>
>  static u32 read_gpio(struct device_node *np)
>  {
> -       const u32 *reg = of_get_property(np, "reg", NULL);
> -       u32 offset;
> +       u64 offset;
>
> -       if (reg == NULL)
> +       if (of_property_read_reg(np, 0, &offset, NULL) < 0)
>                 return 0;
>         /* That works for all keylargos but shall be fixed properly
>          * some day... The problem is that it seems we can't rely
> --
> 2.39.2
>
  
Viresh Kumar July 3, 2023, 3:01 a.m. UTC | #2
On 09-06-23, 12:31, Rob Herring wrote:
> Use the recently added of_property_read_reg() helper to get the
> untranslated "reg" address value.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/cpufreq/pmac32-cpufreq.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
> index ec75e79659ac..f53635ba16c1 100644
> --- a/drivers/cpufreq/pmac32-cpufreq.c
> +++ b/drivers/cpufreq/pmac32-cpufreq.c
> @@ -378,10 +378,9 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  
>  static u32 read_gpio(struct device_node *np)
>  {
> -	const u32 *reg = of_get_property(np, "reg", NULL);
> -	u32 offset;
> +	u64 offset;
>  
> -	if (reg == NULL)
> +	if (of_property_read_reg(np, 0, &offset, NULL) < 0)
>  		return 0;
>  	/* That works for all keylargos but shall be fixed properly
>  	 * some day... The problem is that it seems we can't rely

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
  
Rob Herring Aug. 23, 2023, 7:07 p.m. UTC | #3
On Sun, Jul 2, 2023 at 10:01 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 09-06-23, 12:31, Rob Herring wrote:
> > Use the recently added of_property_read_reg() helper to get the
> > untranslated "reg" address value.
> >
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> >  drivers/cpufreq/pmac32-cpufreq.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
> > index ec75e79659ac..f53635ba16c1 100644
> > --- a/drivers/cpufreq/pmac32-cpufreq.c
> > +++ b/drivers/cpufreq/pmac32-cpufreq.c
> > @@ -378,10 +378,9 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
> >
> >  static u32 read_gpio(struct device_node *np)
> >  {
> > -     const u32 *reg = of_get_property(np, "reg", NULL);
> > -     u32 offset;
> > +     u64 offset;
> >
> > -     if (reg == NULL)
> > +     if (of_property_read_reg(np, 0, &offset, NULL) < 0)
> >               return 0;
> >       /* That works for all keylargos but shall be fixed properly
> >        * some day... The problem is that it seems we can't rely
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Is someone going to apply this?

Rob
  

Patch

diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
index ec75e79659ac..f53635ba16c1 100644
--- a/drivers/cpufreq/pmac32-cpufreq.c
+++ b/drivers/cpufreq/pmac32-cpufreq.c
@@ -378,10 +378,9 @@  static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
 static u32 read_gpio(struct device_node *np)
 {
-	const u32 *reg = of_get_property(np, "reg", NULL);
-	u32 offset;
+	u64 offset;
 
-	if (reg == NULL)
+	if (of_property_read_reg(np, 0, &offset, NULL) < 0)
 		return 0;
 	/* That works for all keylargos but shall be fixed properly
 	 * some day... The problem is that it seems we can't rely