Skip to content

Commit b9a663c

Browse files
robherringvireshk
authored andcommitted
cpufreq: pmac32: Use of_property_read_reg() to parse "reg"
Use the recently added of_property_read_reg() helper to get the untranslated "reg" address value. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent aa01dd7 commit b9a663c

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/cpufreq/pmac32-cpufreq.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/device.h>
2525
#include <linux/hardirq.h>
2626
#include <linux/of.h>
27+
#include <linux/of_address.h>
2728

2829
#include <asm/machdep.h>
2930
#include <asm/irq.h>
@@ -378,18 +379,16 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
378379

379380
static u32 read_gpio(struct device_node *np)
380381
{
381-
const u32 *reg = of_get_property(np, "reg", NULL);
382-
u32 offset;
382+
u64 offset;
383383

384-
if (reg == NULL)
384+
if (of_property_read_reg(np, 0, &offset, NULL) < 0)
385385
return 0;
386386
/* That works for all keylargos but shall be fixed properly
387387
* some day... The problem is that it seems we can't rely
388388
* on the "reg" property of the GPIO nodes, they are either
389389
* relative to the base of KeyLargo or to the base of the
390390
* GPIO space, and the device-tree doesn't help.
391391
*/
392-
offset = *reg;
393392
if (offset < KEYLARGO_GPIO_LEVELS0)
394393
offset += KEYLARGO_GPIO_LEVELS0;
395394
return offset;

0 commit comments

Comments
 (0)