.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * RackMac vu-meter driver |
---|
3 | 4 | * |
---|
4 | 5 | * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp. |
---|
5 | 6 | * <benh@kernel.crashing.org> |
---|
6 | | - * |
---|
7 | | - * Released under the term of the GNU GPL v2. |
---|
8 | 7 | * |
---|
9 | 8 | * Support the CPU-meter LEDs of the Xserve G5 |
---|
10 | 9 | * |
---|
.. | .. |
---|
12 | 11 | * interface for fun. Also, the CPU-meter could be made nicer by being |
---|
13 | 12 | * a bit less "immediate" but giving instead a more average load over |
---|
14 | 13 | * time. Patches welcome :-) |
---|
15 | | - * |
---|
16 | 14 | */ |
---|
17 | 15 | #undef DEBUG |
---|
18 | 16 | |
---|
.. | .. |
---|
83 | 81 | */ |
---|
84 | 82 | static inline u64 get_cpu_idle_time(unsigned int cpu) |
---|
85 | 83 | { |
---|
| 84 | + struct kernel_cpustat *kcpustat = &kcpustat_cpu(cpu); |
---|
86 | 85 | u64 retval; |
---|
87 | 86 | |
---|
88 | | - retval = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE] + |
---|
89 | | - kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; |
---|
| 87 | + retval = kcpustat->cpustat[CPUTIME_IDLE] + |
---|
| 88 | + kcpustat->cpustat[CPUTIME_IOWAIT]; |
---|
90 | 89 | |
---|
91 | 90 | if (rackmeter_ignore_nice) |
---|
92 | | - retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE]; |
---|
| 91 | + retval += kcpustat_field(kcpustat, CPUTIME_NICE, cpu); |
---|
93 | 92 | |
---|
94 | 93 | return retval; |
---|
95 | 94 | } |
---|
.. | .. |
---|
376 | 375 | pr_debug("rackmeter_probe()\n"); |
---|
377 | 376 | |
---|
378 | 377 | /* Get i2s-a node */ |
---|
379 | | - while ((i2s = of_get_next_child(mdev->ofdev.dev.of_node, i2s)) != NULL) |
---|
380 | | - if (strcmp(i2s->name, "i2s-a") == 0) |
---|
381 | | - break; |
---|
| 378 | + for_each_child_of_node(mdev->ofdev.dev.of_node, i2s) |
---|
| 379 | + if (of_node_name_eq(i2s, "i2s-a")) |
---|
| 380 | + break; |
---|
| 381 | + |
---|
382 | 382 | if (i2s == NULL) { |
---|
383 | 383 | pr_debug(" i2s-a child not found\n"); |
---|
384 | 384 | goto bail; |
---|
385 | 385 | } |
---|
386 | 386 | /* Get lightshow or virtual sound */ |
---|
387 | | - while ((np = of_get_next_child(i2s, np)) != NULL) { |
---|
388 | | - if (strcmp(np->name, "lightshow") == 0) |
---|
| 387 | + for_each_child_of_node(i2s, np) { |
---|
| 388 | + if (of_node_name_eq(np, "lightshow")) |
---|
389 | 389 | break; |
---|
390 | | - if ((strcmp(np->name, "sound") == 0) && |
---|
| 390 | + if (of_node_name_eq(np, "sound") && |
---|
391 | 391 | of_get_property(np, "virtual", NULL) != NULL) |
---|
392 | 392 | break; |
---|
393 | 393 | } |
---|