.. | .. |
---|
| 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> |
---|
.. | .. |
---|
197 | 196 | struct wf_sat *sat; |
---|
198 | 197 | struct wf_sat_sensor *sens; |
---|
199 | 198 | const u32 *reg; |
---|
200 | | - const char *loc, *type; |
---|
| 199 | + const char *loc; |
---|
201 | 200 | u8 chip, core; |
---|
202 | 201 | struct device_node *child; |
---|
203 | 202 | int shift, cpu, index; |
---|
.. | .. |
---|
217 | 216 | |
---|
218 | 217 | vsens[0] = vsens[1] = -1; |
---|
219 | 218 | 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) { |
---|
222 | 220 | reg = of_get_property(child, "reg", NULL); |
---|
223 | | - type = of_get_property(child, "device_type", NULL); |
---|
224 | 221 | loc = of_get_property(child, "location", NULL); |
---|
225 | 222 | if (reg == NULL || loc == NULL) |
---|
226 | 223 | continue; |
---|
.. | .. |
---|
249 | 246 | continue; |
---|
250 | 247 | } |
---|
251 | 248 | |
---|
252 | | - if (strcmp(type, "voltage-sensor") == 0) { |
---|
| 249 | + if (of_node_is_type(child, "voltage-sensor")) { |
---|
253 | 250 | name = "cpu-voltage"; |
---|
254 | 251 | shift = 4; |
---|
255 | 252 | vsens[core] = index; |
---|
256 | | - } else if (strcmp(type, "current-sensor") == 0) { |
---|
| 253 | + } else if (of_node_is_type(child, "current-sensor")) { |
---|
257 | 254 | name = "cpu-current"; |
---|
258 | 255 | shift = 8; |
---|
259 | 256 | isens[core] = index; |
---|
260 | | - } else if (strcmp(type, "temp-sensor") == 0) { |
---|
| 257 | + } else if (of_node_is_type(child, "temp-sensor")) { |
---|
261 | 258 | name = "cpu-temp"; |
---|
262 | 259 | shift = 10; |
---|
263 | 260 | } else |
---|