@@ -153,4 +153,22 @@ config LEDS_TRIGGER_TTY
When build as a module this driver will be called ledtrig-tty.
+config LEDS_TRIGGER_BLKDEV
+ tristate "LED Trigger for block devices"
+ depends on BLOCK
+ select LEDS_TRIGGER_BLKDEV_CORE
+ help
+ The blkdev LED trigger allows LEDs to be controlled by block device
+ activity (reads and writes).
+
+ See Documentation/leds/ledtrig-blkdev.rst.
+
+config LEDS_TRIGGER_BLKDEV_CORE
+ bool
+ depends on LEDS_TRIGGER_BLKDEV
+ help
+ This enables the portion of the block device LED trigger that must
+ be built-in to the kernel, even when the trigger is built as a
+ module.
+
endif # LEDS_TRIGGERS
@@ -16,3 +16,5 @@ obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o
obj-$(CONFIG_LEDS_TRIGGER_PATTERN) += ledtrig-pattern.o
obj-$(CONFIG_LEDS_TRIGGER_AUDIO) += ledtrig-audio.o
obj-$(CONFIG_LEDS_TRIGGER_TTY) += ledtrig-tty.o
+obj-$(CONFIG_LEDS_TRIGGER_BLKDEV) += ledtrig-blkdev.o
+obj-$(CONFIG_LEDS_TRIGGER_BLKDEV_CORE) += ledtrig-blkdev-core.o
new file mode 100644
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/*
+ * Block device LED trigger - built-in components
+ *
+ * Copyright 2021 Ian Pilcher <arequipeno@gmail.com>
+ */
+
+#include "ledtrig-blkdev.h"
new file mode 100644
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/*
+ * Block device LED trigger - modular components
+ *
+ * Copyright 2021 Ian Pilcher <arequipeno@gmail.com>
+ */
+
+#include <linux/module.h>
+
+#include "ledtrig-blkdev.h"
+
+MODULE_DESCRIPTION("Block device LED trigger");
+MODULE_AUTHOR("Ian Pilcher <arequipeno@gmail.com>");
+MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(LEDTRIG_BLKDEV);
new file mode 100644
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * Block device LED trigger
+ *
+ * Copyright 2021 Ian Pilcher <arequipeno@gmail.com>
+ */
+
+#ifndef __LEDTRIG_BLKDEV_H
+#define __LEDTRIG_BLKDEV_H
+
+#endif /* __LEDTRIG_BLKDEV_H */
Add files: * ledtrig-blkdev-core.c - trigger components that are always built-in * ledtrig-blkdev.c - trigger components that can be built as a module * ledtrig-blkdev.h - common declarations Add Kconfig options - CONFIG_LEDS_TRIGGER_BLKDEV (visible, tristate) and CONFIG_LEDS_TRIGGER_BLKDEV_CORE (hidden, boolean) Make CONFIG_LEDS_TRIGGER_BLKDEV select CONFIG_LEDS_TRIGGER_BLKDEV_CORE, so built-in portion of the trigger is enabled when trigger is either built-in or modular Signed-off-by: Ian Pilcher <arequipeno@gmail.com> --- drivers/leds/trigger/Kconfig | 18 ++++++++++++++++++ drivers/leds/trigger/Makefile | 2 ++ drivers/leds/trigger/ledtrig-blkdev-core.c | 9 +++++++++ drivers/leds/trigger/ledtrig-blkdev.c | 16 ++++++++++++++++ drivers/leds/trigger/ledtrig-blkdev.h | 12 ++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 drivers/leds/trigger/ledtrig-blkdev-core.c create mode 100644 drivers/leds/trigger/ledtrig-blkdev.c create mode 100644 drivers/leds/trigger/ledtrig-blkdev.h