forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/edac/cpc925_edac.c
....@@ -1,22 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * cpc925_edac.c, EDAC driver for IBM CPC925 Bridge and Memory Controller.
34 *
45 * Copyright (c) 2008 Wind River Systems, Inc.
56 *
67 * 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
208 */
219
2210 #include <linux/module.h>
....@@ -593,8 +581,7 @@
593581 /******************** CPU err device********************************/
594582 static u32 cpc925_cpu_mask_disabled(void)
595583 {
596
- struct device_node *cpus;
597
- struct device_node *cpunode = NULL;
584
+ struct device_node *cpunode;
598585 static u32 mask = 0;
599586
600587 /* use cached value if available */
....@@ -603,20 +590,8 @@
603590
604591 mask = APIMASK_ADI0 | APIMASK_ADI1;
605592
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) {
613594 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
-
620595 if (reg == NULL || *reg > 2) {
621596 cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode);
622597 continue;
....@@ -632,9 +607,6 @@
632607 cpc925_printk(KERN_WARNING,
633608 "Assuming PI id is equal to CPU MPIC id!\n");
634609 }
635
-
636
- of_node_put(cpunode);
637
- of_node_put(cpus);
638610
639611 return mask;
640612 }