Called when block device is being removed Called via __ledtrig_blkdev_disk_cleanup function pointer from ledtrig_blkdev_disk_cleanup() in ledtrig-blkdev-core.c Signed-off-by: Ian Pilcher <arequipeno@xxxxxxxxx> --- drivers/leds/trigger/ledtrig-blkdev.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/leds/trigger/ledtrig-blkdev.c b/drivers/leds/trigger/ledtrig-blkdev.c index 7edbc48050a5..1be9de431c08 100644 --- a/drivers/leds/trigger/ledtrig-blkdev.c +++ b/drivers/leds/trigger/ledtrig-blkdev.c @@ -465,3 +465,20 @@ static void blkdev_disk_delete(struct ledtrig_blkdev_led *const led, exit_unlock: mutex_unlock(&ledtrig_blkdev_mutex); } + + +/* + * + * Disassociate all LEDs from a block device (because it's going away) + * + */ + +static void blkdev_disk_cleanup(struct gendisk *const gd) +{ + struct ledtrig_blkdev_link *link; + struct hlist_node *next; + + hlist_for_each_entry_safe(link, next, + &gd->ledtrig->leds, disk_leds_node) + blkdev_disk_del_locked(link->led, link, gd->ledtrig); +} -- 2.31.1