Skip to content

Commit 37dc218

Browse files
committed
edac: cpc925: use for_each_of_cpu_node iterator
Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This has the side effect of defaulting to iterating using "cpu" node names in preference to the deprecated (for FDT) device_type == "cpu". The error messages are removed in the process as it's not the driver's job to be checking cpu nodes. Any problems with cpu nodes should be noticed by the architecture code. Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: linux-edac@vger.kernel.org Acked-by: Borislav Petkov <bp@suse.de> Signed-off-by: Rob Herring <robh@kernel.org>
1 parent 76ec23b commit 37dc218

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

drivers/edac/cpc925_edac.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci)
593593
/******************** CPU err device********************************/
594594
static u32 cpc925_cpu_mask_disabled(void)
595595
{
596-
struct device_node *cpus;
597-
struct device_node *cpunode = NULL;
596+
struct device_node *cpunode;
598597
static u32 mask = 0;
599598

600599
/* use cached value if available */
@@ -603,20 +602,8 @@ static u32 cpc925_cpu_mask_disabled(void)
603602

604603
mask = APIMASK_ADI0 | APIMASK_ADI1;
605604

606-
cpus = of_find_node_by_path("/cpus");
607-
if (cpus == NULL) {
608-
cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
609-
return 0;
610-
}
611-
612-
while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
605+
for_each_of_cpu_node(cpunode) {
613606
const u32 *reg = of_get_property(cpunode, "reg", NULL);
614-
615-
if (strcmp(cpunode->type, "cpu")) {
616-
cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);
617-
continue;
618-
}
619-
620607
if (reg == NULL || *reg > 2) {
621608
cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode);
622609
continue;
@@ -633,9 +620,6 @@ static u32 cpc925_cpu_mask_disabled(void)
633620
"Assuming PI id is equal to CPU MPIC id!\n");
634621
}
635622

636-
of_node_put(cpunode);
637-
of_node_put(cpus);
638-
639623
return mask;
640624
}
641625

0 commit comments

Comments
 (0)