linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: make controller 'state' sysfs attribute pollable
@ 2017-09-20 10:40 Johannes Thumshirn
  2017-09-20 10:49 ` Sagi Grimberg
  2017-09-20 14:59 ` Christoph Hellwig
  0 siblings, 2 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2017-09-20 10:40 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Keith Busch
  Cc: Hannes Reinecke, Linux NVMe Mailinglist, Linux Kernel Mailinglist,
	Johannes Thumshirn

Notify sysfs about changes of a nvme controller so user-space can watch the
file via poll() or select() in order to react to a state change.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/host/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index acc816b67582..064d973f1e22 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -237,8 +237,10 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
 		break;
 	}
 
-	if (changed)
+	if (changed) {
 		ctrl->state = new_state;
+		sysfs_notify(&ctrl->dev->kobj, NULL, "state");
+	}
 
 	spin_unlock_irqrestore(&ctrl->lock, flags);
 
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-09-25 12:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20 10:40 [PATCH] nvme: make controller 'state' sysfs attribute pollable Johannes Thumshirn
2017-09-20 10:49 ` Sagi Grimberg
2017-09-20 14:59 ` Christoph Hellwig
2017-09-21  5:19   ` Johannes Thumshirn
2017-09-21 14:10     ` Christoph Hellwig
2017-09-25  5:37     ` Sagi Grimberg
2017-09-25  5:59       ` Hannes Reinecke
2017-09-25  7:09         ` Sagi Grimberg
2017-09-25  8:23           ` Hannes Reinecke
2017-09-25 12:52             ` Christoph Hellwig
2017-09-21 12:47   ` Guan Junxiong
2017-09-25  5:36     ` Sagi Grimberg

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).