Skip to content

Commit bda649b

Browse files
committed
Merge tag 'renesas-arm-soc-for-v6.4-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel into soc/arm
Renesas ARM SoC updates for v6.4 - Use of_cpu_node_to_id() to read CPU node 'reg'. * tag 'renesas-arm-soc-for-v6.4-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel: ARM: sh-mobile: Use of_cpu_node_to_id() to read CPU node 'reg' Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents a8739ac + 6050cb1 commit bda649b

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

arch/arm/mach-shmobile/platsmp-apmu.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/init.h>
1111
#include <linux/io.h>
1212
#include <linux/ioport.h>
13+
#include <linux/of.h>
1314
#include <linux/of_address.h>
1415
#include <linux/smp.h>
1516
#include <linux/suspend.h>
@@ -210,41 +211,36 @@ static void apmu_parse_dt(void (*fn)(struct resource *res, int cpu, int bit))
210211
struct device_node *np_apmu, *np_cpu;
211212
struct resource res;
212213
int bit, index;
213-
u32 id;
214214

215215
for_each_matching_node(np_apmu, apmu_ids) {
216216
/* only enable the cluster that includes the boot CPU */
217217
bool is_allowed = false;
218218

219219
for (bit = 0; bit < CONFIG_NR_CPUS; bit++) {
220220
np_cpu = of_parse_phandle(np_apmu, "cpus", bit);
221-
if (np_cpu) {
222-
if (!of_property_read_u32(np_cpu, "reg", &id)) {
223-
if (id == cpu_logical_map(0)) {
224-
is_allowed = true;
225-
of_node_put(np_cpu);
226-
break;
227-
}
228-
229-
}
221+
if (!np_cpu)
222+
break;
223+
if (of_cpu_node_to_id(np_cpu) == 0) {
224+
is_allowed = true;
230225
of_node_put(np_cpu);
226+
break;
231227
}
228+
of_node_put(np_cpu);
232229
}
233230
if (!is_allowed)
234231
continue;
235232

236233
for (bit = 0; bit < CONFIG_NR_CPUS; bit++) {
237234
np_cpu = of_parse_phandle(np_apmu, "cpus", bit);
238-
if (np_cpu) {
239-
if (!of_property_read_u32(np_cpu, "reg", &id)) {
240-
index = get_logical_index(id);
241-
if ((index >= 0) &&
242-
!of_address_to_resource(np_apmu,
243-
0, &res))
244-
fn(&res, index, bit);
245-
}
246-
of_node_put(np_cpu);
247-
}
235+
if (!np_cpu)
236+
break;
237+
238+
index = of_cpu_node_to_id(np_cpu);
239+
if ((index >= 0) &&
240+
!of_address_to_resource(np_apmu, 0, &res))
241+
fn(&res, index, bit);
242+
243+
of_node_put(np_cpu);
248244
}
249245
}
250246
}

0 commit comments

Comments
 (0)