hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/macintosh/windfarm_smu_sat.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Windfarm PowerMac thermal control. SMU "satellite" controller sensors.
34 *
45 * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>
5
- *
6
- * Released under the terms of the GNU GPL v2.
76 */
87
98 #include <linux/types.h>
....@@ -197,7 +196,7 @@
197196 struct wf_sat *sat;
198197 struct wf_sat_sensor *sens;
199198 const u32 *reg;
200
- const char *loc, *type;
199
+ const char *loc;
201200 u8 chip, core;
202201 struct device_node *child;
203202 int shift, cpu, index;
....@@ -217,10 +216,8 @@
217216
218217 vsens[0] = vsens[1] = -1;
219218 isens[0] = isens[1] = -1;
220
- child = NULL;
221
- while ((child = of_get_next_child(dev, child)) != NULL) {
219
+ for_each_child_of_node(dev, child) {
222220 reg = of_get_property(child, "reg", NULL);
223
- type = of_get_property(child, "device_type", NULL);
224221 loc = of_get_property(child, "location", NULL);
225222 if (reg == NULL || loc == NULL)
226223 continue;
....@@ -249,15 +246,15 @@
249246 continue;
250247 }
251248
252
- if (strcmp(type, "voltage-sensor") == 0) {
249
+ if (of_node_is_type(child, "voltage-sensor")) {
253250 name = "cpu-voltage";
254251 shift = 4;
255252 vsens[core] = index;
256
- } else if (strcmp(type, "current-sensor") == 0) {
253
+ } else if (of_node_is_type(child, "current-sensor")) {
257254 name = "cpu-current";
258255 shift = 8;
259256 isens[core] = index;
260
- } else if (strcmp(type, "temp-sensor") == 0) {
257
+ } else if (of_node_is_type(child, "temp-sensor")) {
261258 name = "cpu-temp";
262259 shift = 10;
263260 } else