hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/macintosh/windfarm_fcu_controls.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Windfarm PowerMac thermal control. FCU fan control
34 *
45 * Copyright 2012 Benjamin Herrenschmidt, IBM Corp.
5
- *
6
- * Released under the term of the GNU GPL v2.
76 */
87 #undef DEBUG
98
....@@ -425,25 +424,25 @@
425424 { "CPU B 2", "cpu-fan-b-1", },
426425 { "CPU B 3", "cpu-fan-c-1", },
427426 };
428
- struct device_node *np = NULL, *fcu = pv->i2c->dev.of_node;
427
+ struct device_node *np, *fcu = pv->i2c->dev.of_node;
429428 int i;
430429
431430 DBG("Looking up FCU controls in device-tree...\n");
432431
433
- while ((np = of_get_next_child(fcu, np)) != NULL) {
432
+ for_each_child_of_node(fcu, np) {
434433 int id, type = -1;
435434 const char *loc;
436435 const char *name;
437436 const u32 *reg;
438437
439
- DBG(" control: %s, type: %s\n", np->name, np->type);
438
+ DBG(" control: %pOFn, type: %s\n", np, of_node_get_device_type(np));
440439
441440 /* Detect control type */
442
- if (!strcmp(np->type, "fan-rpm-control") ||
443
- !strcmp(np->type, "fan-rpm"))
441
+ if (of_node_is_type(np, "fan-rpm-control") ||
442
+ of_node_is_type(np, "fan-rpm"))
444443 type = FCU_FAN_RPM;
445
- if (!strcmp(np->type, "fan-pwm-control") ||
446
- !strcmp(np->type, "fan-pwm"))
444
+ if (of_node_is_type(np, "fan-pwm-control") ||
445
+ of_node_is_type(np, "fan-pwm"))
447446 type = FCU_FAN_PWM;
448447 /* Only care about fans for now */
449448 if (type == -1)
....@@ -469,9 +468,7 @@
469468 else
470469 id = ((*reg) - 0x30) / 2;
471470 if (id > 7) {
472
- pr_warning("wf_fcu: Can't parse "
473
- "fan ID in device-tree for %pOF\n",
474
- np);
471
+ pr_warn("wf_fcu: Can't parse fan ID in device-tree for %pOF\n", np);
475472 break;
476473 }
477474 wf_fcu_add_fan(pv, name, type, id);