[PATCH v2 03/15] leds: trigger: blkdev: Add functions needed by block changes
From: Ian Pilcher
Date: Thu Sep 09 2021 - 18:25:39 EST
Add ledtrig_blkdev_disk_init() and ledtrig_blkdev_disk_cleanup()
placeholders. (Function bodies depend on block subsystem changes
in next commit.)
Signed-off-by: Ian Pilcher <arequipeno@xxxxxxxxx>
---
drivers/leds/trigger/ledtrig-blkdev-core.c | 11 +++++++++++
include/linux/leds.h | 19 +++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/drivers/leds/trigger/ledtrig-blkdev-core.c b/drivers/leds/trigger/ledtrig-blkdev-core.c
index bd9e5f09b7e3..b0a455180b05 100644
--- a/drivers/leds/trigger/ledtrig-blkdev-core.c
+++ b/drivers/leds/trigger/ledtrig-blkdev-core.c
@@ -6,4 +6,15 @@
* Copyright 2021 Ian Pilcher <arequipeno@xxxxxxxxx>
*/
+#include <linux/leds.h>
+
#include "ledtrig-blkdev.h"
+
+/**
+ * ledtrig_blkdev_disk_cleanup - remove a block device from the blkdev LED
+ * trigger
+ * @gd: the disk to be removed
+ */
+void ledtrig_blkdev_disk_cleanup(struct gendisk *const gd)
+{
+}
diff --git a/include/linux/leds.h b/include/linux/leds.h
index a0b730be40ad..38fb8b6e68fe 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -10,6 +10,7 @@
#include <dt-bindings/leds/common.h>
#include <linux/device.h>
+#include <linux/genhd.h>
#include <linux/kernfs.h>
#include <linux/list.h>
#include <linux/mutex.h>
@@ -605,4 +606,22 @@ static inline void ledtrig_audio_set(enum led_audio type,
}
#endif
+#if IS_ENABLED(CONFIG_LEDS_TRIGGER_BLKDEV)
+/**
+ * ledtrig_blkdev_disk_init - initialize the ledtrig field of a new gendisk
+ * @gd: the gendisk to be initialized
+ */
+static inline void ledtrig_blkdev_disk_init(struct gendisk *const gd)
+{
+}
+void ledtrig_blkdev_disk_cleanup(struct gendisk *const gd);
+#else /* IS_ENABLED(CONFIG_LEDS_TRIGGER_BLKDEV) */
+static inline void ledtrig_blkdev_disk_init(const struct gendisk *gd)
+{
+}
+static inline void ledtrig_blkdev_disk_cleanup(const struct gendisk *gd)
+{
+}
+#endif /* IS_ENABLED(CONFIG_LEDS_TRIGGER_BLKDEV) */
+
#endif /* __LINUX_LEDS_H_INCLUDED */
--
2.31.1