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 declatarions Add Kconfig options - CONFIG_LEDTRIG_BLKDEV (visible, tristate) and CONFIG_LEDTRIG_BLKDEV_CORE (hidden, boolean) Make CONFIG_LEDTRIG_BLKDEV select CONFIG_LEDTRIG_BLKDEV_CORE, so built-in portion of the trigger is enabled when trigger is built-in or modular Signed-off-by: Ian Pilcher <arequipeno@xxxxxxxxx> --- 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 diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig index 1f1d57288085..7c31be355349 100644 --- a/drivers/leds/trigger/Kconfig +++ b/drivers/leds/trigger/Kconfig @@ -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 diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile index 25c4db97cdd4..3732eeb86775 100644 --- a/drivers/leds/trigger/Makefile +++ b/drivers/leds/trigger/Makefile @@ -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 diff --git a/drivers/leds/trigger/ledtrig-blkdev-core.c b/drivers/leds/trigger/ledtrig-blkdev-core.c new file mode 100644 index 000000000000..a126c7fc0f9f --- /dev/null +++ b/drivers/leds/trigger/ledtrig-blkdev-core.c @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/* + * Block device LED triggers - built-in components + * + * Copyright 2021 Ian Pilcher <arequipeno@xxxxxxxxx> + */ + +#include "ledtrig-blkdev.h" diff --git a/drivers/leds/trigger/ledtrig-blkdev.c b/drivers/leds/trigger/ledtrig-blkdev.c new file mode 100644 index 000000000000..8cbeb80697ae --- /dev/null +++ b/drivers/leds/trigger/ledtrig-blkdev.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/* + * Block device LED triggers - modular components + * + * Copyright 2021 Ian Pilcher <arequipeno@xxxxxxxxx> + */ + +#include <linux/module.h> + +#include "ledtrig-blkdev.h" + +MODULE_DESCRIPTION("Block device LED trigger"); +MODULE_AUTHOR("Ian Pilcher <arequipeno@xxxxxxxxx>"); +MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(LEDTRIG_BLKDEV); diff --git a/drivers/leds/trigger/ledtrig-blkdev.h b/drivers/leds/trigger/ledtrig-blkdev.h new file mode 100644 index 000000000000..50b44461d4ab --- /dev/null +++ b/drivers/leds/trigger/ledtrig-blkdev.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * Block device LED triggers + * + * Copyright 2021 Ian Pilcher <arequipeno@xxxxxxxxx> + */ + +#ifndef __LEDTRIG_BLKDEV_H +#define __LEDTRIG_BLKDEV_H + +#endif /* __LEDTRIG_BLKDEV_H */ -- 2.31.1