@@ -13,9 +13,16 @@
void blk_ledtrig_init(void);
+static inline void blk_ledtrig_disk_init(struct gendisk *const gd)
+{
+ gd->ledtrig = NULL;
+ mutex_init(&gd->ledtrig_mutex);
+}
+
#else // CONFIG_BLK_LED_TRIGGERS
static inline void blk_ledtrig_init(void) {}
+static inline void blk_ledtrig_disk_init(const struct gendisk *gd) {}
#endif // CONFIG_BLK_LED_TRIGGERS
@@ -540,6 +540,7 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
disk_add_events(disk);
blk_integrity_add(disk);
+ blk_ledtrig_disk_init(disk);
}
void device_add_disk(struct device *parent, struct gendisk *disk,
@@ -169,6 +169,10 @@ struct gendisk {
#if IS_ENABLED(CONFIG_CDROM)
struct cdrom_device_info *cdi;
#endif
+#ifdef CONFIG_BLK_LED_TRIGGERS
+ struct blk_ledtrig *ledtrig;
+ struct mutex ledtrig_mutex;
+#endif /* CONFIG_BLK_LED_TRIGGERS */
int node_id;
struct badblocks *bb;
struct lockdep_map lockdep_map;
* Initialize trigger info when device is added. Signed-off-by: Ian Pilcher <arequipeno@gmail.com> --- block/blk-ledtrig.h | 7 +++++++ block/genhd.c | 1 + include/linux/genhd.h | 4 ++++ 3 files changed, 12 insertions(+)