hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/leds/trigger/ledtrig-cpu.c
....@@ -1,22 +1,22 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ledtrig-cpu.c - LED trigger based on CPU activity
34 *
4
- * This LED trigger will be registered for each possible CPU and named as
5
- * cpu0, cpu1, cpu2, cpu3, etc.
5
+ * This LED trigger will be registered for first 8 CPUs and named
6
+ * as cpu0..cpu7. There's additional trigger called cpu that
7
+ * is on when any CPU is active.
8
+ *
9
+ * If you want support for arbitrary number of CPUs, make it one trigger,
10
+ * with additional sysfs file selecting which CPU to watch.
611 *
712 * It can be bound to any LED just like other triggers using either a
813 * board file or via sysfs interface.
914 *
1015 * An API named ledtrig_cpu is exported for any user, who want to add CPU
11
- * activity indication in their code
16
+ * activity indication in their code.
1217 *
1318 * Copyright 2011 Linus Walleij <linus.walleij@linaro.org>
1419 * Copyright 2011 - 2012 Bryan Wu <bryan.wu@canonical.com>
15
- *
16
- * This program is free software; you can redistribute it and/or modify
17
- * it under the terms of the GNU General Public License version 2 as
18
- * published by the Free Software Foundation.
19
- *
2020 */
2121
2222 #include <linux/kernel.h>
....@@ -149,6 +149,9 @@
149149 for_each_possible_cpu(cpu) {
150150 struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
151151
152
+ if (cpu >= 8)
153
+ continue;
154
+
152155 snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
153156
154157 led_trigger_register_simple(trig->name, &trig->_trig);