提交 0a72bbba 编写于 作者: C Christoph Hellwig

nvme: allow calling nvme_change_ctrl_state from irq context

Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NKeith Busch <keith.busch@intel.com>
Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
上级 a751da33
...@@ -176,9 +176,10 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, ...@@ -176,9 +176,10 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
enum nvme_ctrl_state new_state) enum nvme_ctrl_state new_state)
{ {
enum nvme_ctrl_state old_state; enum nvme_ctrl_state old_state;
unsigned long flags;
bool changed = false; bool changed = false;
spin_lock_irq(&ctrl->lock); spin_lock_irqsave(&ctrl->lock, flags);
old_state = ctrl->state; old_state = ctrl->state;
switch (new_state) { switch (new_state) {
...@@ -239,7 +240,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, ...@@ -239,7 +240,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
if (changed) if (changed)
ctrl->state = new_state; ctrl->state = new_state;
spin_unlock_irq(&ctrl->lock); spin_unlock_irqrestore(&ctrl->lock, flags);
return changed; return changed;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册