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@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..ad49d92713fb 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..bd9e5f09b7e3 --- /dev/null +++ b/drivers/leds/trigger/ledtrig-blkdev-core.c @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/* + * Block device LED trigger - 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..b615a8bf38e2 --- /dev/null +++ b/drivers/leds/trigger/ledtrig-blkdev.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/* + * Block device LED trigger - 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..6264d8a9201b --- /dev/null +++ b/drivers/leds/trigger/ledtrig-blkdev.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * Block device LED trigger + * + * Copyright 2021 Ian Pilcher <arequipeno@xxxxxxxxx> + */ + +#ifndef __LEDTRIG_BLKDEV_H +#define __LEDTRIG_BLKDEV_H + +#endif /* __LEDTRIG_BLKDEV_H */ -- 2.31.1