hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
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>
....@@ -172,6 +171,7 @@
172171
173172 if (sat->nr >= 0)
174173 sats[sat->nr] = NULL;
174
+ of_node_put(sat->node);
175175 kfree(sat);
176176 }
177177
....@@ -197,7 +197,7 @@
197197 struct wf_sat *sat;
198198 struct wf_sat_sensor *sens;
199199 const u32 *reg;
200
- const char *loc, *type;
200
+ const char *loc;
201201 u8 chip, core;
202202 struct device_node *child;
203203 int shift, cpu, index;
....@@ -217,10 +217,8 @@
217217
218218 vsens[0] = vsens[1] = -1;
219219 isens[0] = isens[1] = -1;
220
- child = NULL;
221
- while ((child = of_get_next_child(dev, child)) != NULL) {
220
+ for_each_child_of_node(dev, child) {
222221 reg = of_get_property(child, "reg", NULL);
223
- type = of_get_property(child, "device_type", NULL);
224222 loc = of_get_property(child, "location", NULL);
225223 if (reg == NULL || loc == NULL)
226224 continue;
....@@ -249,15 +247,15 @@
249247 continue;
250248 }
251249
252
- if (strcmp(type, "voltage-sensor") == 0) {
250
+ if (of_node_is_type(child, "voltage-sensor")) {
253251 name = "cpu-voltage";
254252 shift = 4;
255253 vsens[core] = index;
256
- } else if (strcmp(type, "current-sensor") == 0) {
254
+ } else if (of_node_is_type(child, "current-sensor")) {
257255 name = "cpu-current";
258256 shift = 8;
259257 isens[core] = index;
260
- } else if (strcmp(type, "temp-sensor") == 0) {
258
+ } else if (of_node_is_type(child, "temp-sensor")) {
261259 name = "cpu-temp";
262260 shift = 10;
263261 } else