lkml.org 
[lkml]   [2017]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] nvme: make controller 'state' sysfs attribute pollable
Date
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
\
 
 \ /
  Last update: 2017-09-20 12:41    [W:0.059 / U:0.612 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site