.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * cpc925_edac.c, EDAC driver for IBM CPC925 Bridge and Memory Controller. |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2008 Wind River Systems, Inc. |
---|
5 | 6 | * |
---|
6 | 7 | * Authors: Cao Qingtao <qingtao.cao@windriver.com> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
11 | | - * |
---|
12 | | - * This program is distributed in the hope that it will be useful, |
---|
13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
15 | | - * See the GNU General Public License for more details. |
---|
16 | | - * |
---|
17 | | - * You should have received a copy of the GNU General Public License |
---|
18 | | - * along with this program; if not, write to the Free Software |
---|
19 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
20 | 8 | */ |
---|
21 | 9 | |
---|
22 | 10 | #include <linux/module.h> |
---|
.. | .. |
---|
593 | 581 | /******************** CPU err device********************************/ |
---|
594 | 582 | static u32 cpc925_cpu_mask_disabled(void) |
---|
595 | 583 | { |
---|
596 | | - struct device_node *cpus; |
---|
597 | | - struct device_node *cpunode = NULL; |
---|
| 584 | + struct device_node *cpunode; |
---|
598 | 585 | static u32 mask = 0; |
---|
599 | 586 | |
---|
600 | 587 | /* use cached value if available */ |
---|
.. | .. |
---|
603 | 590 | |
---|
604 | 591 | mask = APIMASK_ADI0 | APIMASK_ADI1; |
---|
605 | 592 | |
---|
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) { |
---|
| 593 | + for_each_of_cpu_node(cpunode) { |
---|
613 | 594 | 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 | | - |
---|
620 | 595 | if (reg == NULL || *reg > 2) { |
---|
621 | 596 | cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode); |
---|
622 | 597 | continue; |
---|
.. | .. |
---|
632 | 607 | cpc925_printk(KERN_WARNING, |
---|
633 | 608 | "Assuming PI id is equal to CPU MPIC id!\n"); |
---|
634 | 609 | } |
---|
635 | | - |
---|
636 | | - of_node_put(cpunode); |
---|
637 | | - of_node_put(cpus); |
---|
638 | 610 | |
---|
639 | 611 | return mask; |
---|
640 | 612 | } |
---|