forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/leds/trigger/ledtrig-activity.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Activity LED trigger
34 *
45 * Copyright (C) 2017 Willy Tarreau <w@1wt.eu>
56 * Partially based on Atsushi Nemoto's ledtrig-heartbeat.c.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118
129 #include <linux/init.h>
....@@ -60,11 +57,15 @@
6057 curr_used = 0;
6158
6259 for_each_possible_cpu(i) {
63
- curr_used += kcpustat_cpu(i).cpustat[CPUTIME_USER]
64
- + kcpustat_cpu(i).cpustat[CPUTIME_NICE]
65
- + kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]
66
- + kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]
67
- + kcpustat_cpu(i).cpustat[CPUTIME_IRQ];
60
+ struct kernel_cpustat kcpustat;
61
+
62
+ kcpustat_cpu_fetch(&kcpustat, i);
63
+
64
+ curr_used += kcpustat.cpustat[CPUTIME_USER]
65
+ + kcpustat.cpustat[CPUTIME_NICE]
66
+ + kcpustat.cpustat[CPUTIME_SYSTEM]
67
+ + kcpustat.cpustat[CPUTIME_SOFTIRQ]
68
+ + kcpustat.cpustat[CPUTIME_IRQ];
6869 cpus++;
6970 }
7071
....@@ -73,7 +74,7 @@
7374 * down to 16us, ensuring we won't overflow 32-bit computations below
7475 * even up to 3k CPUs, while keeping divides cheap on smaller systems.
7576 */
76
- curr_boot = ktime_get_boot_ns() * cpus;
77
+ curr_boot = ktime_get_boottime_ns() * cpus;
7778 diff_boot = (curr_boot - activity_data->last_boot) >> 16;
7879 diff_used = (curr_used - activity_data->last_used) >> 16;
7980 activity_data->last_boot = curr_boot;