[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210914201713.14922-3-arequipeno@gmail.com>
Date: Tue, 14 Sep 2021 15:17:12 -0500
From: Ian Pilcher <arequipeno@...il.com>
To: axboe@...nel.dk, pavel@....cz
Cc: linux-leds@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
kabel@...nel.org, chaitanyak@...dia.com
Subject: [PATCH v3 2/3] block: export block_class for use by the blkdev LED trigger
Export block_class to the LEDTRIG_BLKDEV namespace.
The block device (blkdev) LED trigger periodically checks the activity
counters of block devices and blinks LEDs to reflect that activity.
The specific block device(s) checked can be configured through a
sysfs API. Once an LED has been associated with the blkdev trigger,
the LED can be "linked" to a block device by writing that device's
name to the LED's link_device attribute. For example:
echo sda > /sys/class/leds/<led>/link_device
When a block device name is written to the sysfs attribute, the
trigger uses class_find_device_by_name() to resolve the actual
block_device structure:
dev = class_find_device_by_name(&block_class, name);
Exporting the block_class symbol makes it possible to build the LED
trigger as a module.
Signed-off-by: Ian Pilcher <arequipeno@...il.com>
---
block/genhd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/genhd.c b/block/genhd.c
index 7b6e5e1cf956..ebea496bc283 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1076,6 +1076,7 @@ struct class block_class = {
.name = "block",
.dev_uevent = block_uevent,
};
+EXPORT_SYMBOL_NS_GPL(block_class, LEDTRIG_BLKDEV);
static char *block_devnode(struct device *dev, umode_t *mode,
kuid_t *uid, kgid_t *gid)
--
2.31.1
Powered by blists - more mailing lists