linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Pilcher <arequipeno@gmail.com>
To: axboe@kernel.dk, pavel@ucw.cz
Cc: linux-leds@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	kabel@kernel.org, chaitanyak@nvidia.com
Subject: [PATCH v3 2/3] block: export block_class for use by the blkdev LED trigger
Date: Tue, 14 Sep 2021 15:17:12 -0500	[thread overview]
Message-ID: <20210914201713.14922-3-arequipeno@gmail.com> (raw)
In-Reply-To: <20210914201713.14922-1-arequipeno@gmail.com>

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@gmail.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


  parent reply	other threads:[~2021-09-14 20:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 20:17 [PATCH v3 0/3] Introduce block device LED trigger Ian Pilcher
2021-09-14 20:17 ` [PATCH v3 1/3] docs: Add block device (blkdev) LED trigger documentation Ian Pilcher
2021-09-14 20:17 ` Ian Pilcher [this message]
2021-09-15  7:07   ` [PATCH v3 2/3] block: export block_class for use by the blkdev LED trigger Christoph Hellwig
2021-09-14 20:17 ` [PATCH v3 3/3] leds: trigger: Add block device " Ian Pilcher
2021-09-15  5:24   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210914201713.14922-3-arequipeno@gmail.com \
    --to=arequipeno@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=chaitanyak@nvidia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kabel@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).