[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210809033217.1113444-9-arequipeno@gmail.com>
Date: Sun, 8 Aug 2021 22:32:15 -0500
From: Ian Pilcher <arequipeno@...il.com>
To: linux-block@...r.kernel.org, linux-leds@...r.kernel.org
Cc: axboe@...nel.dk, pavel@....cz, linux-kernel@...r.kernel.org,
kernelnewbies@...nelnewbies.org
Subject: [RFC PATCH v2 08/10] block: Add init function for block device LED trigger
Register the blkdev LED trigger
Signed-off-by: Ian Pilcher <arequipeno@...il.com>
---
block/blk-ledtrig.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/block/blk-ledtrig.c b/block/blk-ledtrig.c
index d02f32205985..14b1d33a2953 100644
--- a/block/blk-ledtrig.c
+++ b/block/blk-ledtrig.c
@@ -406,3 +406,38 @@ static ssize_t blk_ledtrig_blink_store(struct device *const dev,
return count;
}
+
+
+/*
+ *
+ * Initialization - register the trigger
+ *
+ */
+
+static struct attribute *blk_ledtrig_attrs[] = {
+ &blk_ledtrig_attr_blink_on.attr,
+ &blk_ledtrig_attr_blink_off.attr,
+ NULL
+};
+
+static const struct attribute_group blk_ledtrig_attr_group = {
+ .attrs = blk_ledtrig_attrs,
+};
+
+static const struct attribute_group *blk_ledtrig_attr_groups[] = {
+ &blk_ledtrig_attr_group,
+ NULL
+};
+
+static struct led_trigger blk_ledtrig_trigger = {
+ .name = "blkdev",
+ .activate = blk_ledtrig_activate,
+ .deactivate = blk_ledtrig_deactivate,
+ .groups = blk_ledtrig_attr_groups,
+};
+
+static int __init blk_ledtrig_init(void)
+{
+ return led_trigger_register(&blk_ledtrig_trigger);
+}
+device_initcall(blk_ledtrig_init);
--
2.31.1
Powered by blists - more mailing lists