Commit 37dc218b authored by Rob Herring's avatar Rob Herring

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: default avatarBorislav Petkov <bp@suse.de>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent 76ec23b1
...@@ -593,8 +593,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci) ...@@ -593,8 +593,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci)
/******************** CPU err device********************************/ /******************** CPU err device********************************/
static u32 cpc925_cpu_mask_disabled(void) static u32 cpc925_cpu_mask_disabled(void)
{ {
struct device_node *cpus; struct device_node *cpunode;
struct device_node *cpunode = NULL;
static u32 mask = 0; static u32 mask = 0;
/* use cached value if available */ /* use cached value if available */
...@@ -603,20 +602,8 @@ static u32 cpc925_cpu_mask_disabled(void) ...@@ -603,20 +602,8 @@ static u32 cpc925_cpu_mask_disabled(void)
mask = APIMASK_ADI0 | APIMASK_ADI1; mask = APIMASK_ADI0 | APIMASK_ADI1;
cpus = of_find_node_by_path("/cpus"); for_each_of_cpu_node(cpunode) {
if (cpus == NULL) {
cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
return 0;
}
while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
const u32 *reg = of_get_property(cpunode, "reg", NULL); const u32 *reg = of_get_property(cpunode, "reg", NULL);
if (strcmp(cpunode->type, "cpu")) {
cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);
continue;
}
if (reg == NULL || *reg > 2) { if (reg == NULL || *reg > 2) {
cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode); cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode);
continue; continue;
...@@ -633,9 +620,6 @@ static u32 cpc925_cpu_mask_disabled(void) ...@@ -633,9 +620,6 @@ static u32 cpc925_cpu_mask_disabled(void)
"Assuming PI id is equal to CPU MPIC id!\n"); "Assuming PI id is equal to CPU MPIC id!\n");
} }
of_node_put(cpunode);
of_node_put(cpus);
return mask; return mask;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment