hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/macintosh/rack-meter.c
....@@ -1,10 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * RackMac vu-meter driver
34 *
45 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
56 * <benh@kernel.crashing.org>
6
- *
7
- * Released under the term of the GNU GPL v2.
87 *
98 * Support the CPU-meter LEDs of the Xserve G5
109 *
....@@ -12,7 +11,6 @@
1211 * interface for fun. Also, the CPU-meter could be made nicer by being
1312 * a bit less "immediate" but giving instead a more average load over
1413 * time. Patches welcome :-)
15
- *
1614 */
1715 #undef DEBUG
1816
....@@ -83,13 +81,14 @@
8381 */
8482 static inline u64 get_cpu_idle_time(unsigned int cpu)
8583 {
84
+ struct kernel_cpustat *kcpustat = &kcpustat_cpu(cpu);
8685 u64 retval;
8786
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];
9089
9190 if (rackmeter_ignore_nice)
92
- retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE];
91
+ retval += kcpustat_field(kcpustat, CPUTIME_NICE, cpu);
9392
9493 return retval;
9594 }
....@@ -376,18 +375,19 @@
376375 pr_debug("rackmeter_probe()\n");
377376
378377 /* 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
+
382382 if (i2s == NULL) {
383383 pr_debug(" i2s-a child not found\n");
384384 goto bail;
385385 }
386386 /* 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"))
389389 break;
390
- if ((strcmp(np->name, "sound") == 0) &&
390
+ if (of_node_name_eq(np, "sound") &&
391391 of_get_property(np, "virtual", NULL) != NULL)
392392 break;
393393 }