| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Windfarm PowerMac thermal control. FCU fan control |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2012 Benjamin Herrenschmidt, IBM Corp. |
|---|
| 5 | | - * |
|---|
| 6 | | - * Released under the term of the GNU GPL v2. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | #undef DEBUG |
|---|
| 9 | 8 | |
|---|
| .. | .. |
|---|
| 425 | 424 | { "CPU B 2", "cpu-fan-b-1", }, |
|---|
| 426 | 425 | { "CPU B 3", "cpu-fan-c-1", }, |
|---|
| 427 | 426 | }; |
|---|
| 428 | | - struct device_node *np = NULL, *fcu = pv->i2c->dev.of_node; |
|---|
| 427 | + struct device_node *np, *fcu = pv->i2c->dev.of_node; |
|---|
| 429 | 428 | int i; |
|---|
| 430 | 429 | |
|---|
| 431 | 430 | DBG("Looking up FCU controls in device-tree...\n"); |
|---|
| 432 | 431 | |
|---|
| 433 | | - while ((np = of_get_next_child(fcu, np)) != NULL) { |
|---|
| 432 | + for_each_child_of_node(fcu, np) { |
|---|
| 434 | 433 | int id, type = -1; |
|---|
| 435 | 434 | const char *loc; |
|---|
| 436 | 435 | const char *name; |
|---|
| 437 | 436 | const u32 *reg; |
|---|
| 438 | 437 | |
|---|
| 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)); |
|---|
| 440 | 439 | |
|---|
| 441 | 440 | /* 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")) |
|---|
| 444 | 443 | 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")) |
|---|
| 447 | 446 | type = FCU_FAN_PWM; |
|---|
| 448 | 447 | /* Only care about fans for now */ |
|---|
| 449 | 448 | if (type == -1) |
|---|
| .. | .. |
|---|
| 469 | 468 | else |
|---|
| 470 | 469 | id = ((*reg) - 0x30) / 2; |
|---|
| 471 | 470 | 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); |
|---|
| 475 | 472 | break; |
|---|
| 476 | 473 | } |
|---|
| 477 | 474 | wf_fcu_add_fan(pv, name, type, id); |
|---|