.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Windfarm PowerMac thermal control. SMU "satellite" controller sensors. |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org> |
---|
5 | | - * |
---|
6 | | - * Released under the terms of the GNU GPL v2. |
---|
7 | 6 | */ |
---|
8 | 7 | |
---|
9 | 8 | #include <linux/types.h> |
---|
.. | .. |
---|
172 | 171 | |
---|
173 | 172 | if (sat->nr >= 0) |
---|
174 | 173 | sats[sat->nr] = NULL; |
---|
| 174 | + of_node_put(sat->node); |
---|
175 | 175 | kfree(sat); |
---|
176 | 176 | } |
---|
177 | 177 | |
---|
.. | .. |
---|
197 | 197 | struct wf_sat *sat; |
---|
198 | 198 | struct wf_sat_sensor *sens; |
---|
199 | 199 | const u32 *reg; |
---|
200 | | - const char *loc, *type; |
---|
| 200 | + const char *loc; |
---|
201 | 201 | u8 chip, core; |
---|
202 | 202 | struct device_node *child; |
---|
203 | 203 | int shift, cpu, index; |
---|
.. | .. |
---|
217 | 217 | |
---|
218 | 218 | vsens[0] = vsens[1] = -1; |
---|
219 | 219 | 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) { |
---|
222 | 221 | reg = of_get_property(child, "reg", NULL); |
---|
223 | | - type = of_get_property(child, "device_type", NULL); |
---|
224 | 222 | loc = of_get_property(child, "location", NULL); |
---|
225 | 223 | if (reg == NULL || loc == NULL) |
---|
226 | 224 | continue; |
---|
.. | .. |
---|
249 | 247 | continue; |
---|
250 | 248 | } |
---|
251 | 249 | |
---|
252 | | - if (strcmp(type, "voltage-sensor") == 0) { |
---|
| 250 | + if (of_node_is_type(child, "voltage-sensor")) { |
---|
253 | 251 | name = "cpu-voltage"; |
---|
254 | 252 | shift = 4; |
---|
255 | 253 | vsens[core] = index; |
---|
256 | | - } else if (strcmp(type, "current-sensor") == 0) { |
---|
| 254 | + } else if (of_node_is_type(child, "current-sensor")) { |
---|
257 | 255 | name = "cpu-current"; |
---|
258 | 256 | shift = 8; |
---|
259 | 257 | isens[core] = index; |
---|
260 | | - } else if (strcmp(type, "temp-sensor") == 0) { |
---|
| 258 | + } else if (of_node_is_type(child, "temp-sensor")) { |
---|
261 | 259 | name = "cpu-temp"; |
---|
262 | 260 | shift = 10; |
---|
263 | 261 | } else |
---|