Skip to content

Commit

Permalink
nvme: allow calling nvme_change_ctrl_state from irq context
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
  • Loading branch information
Christoph Hellwig committed Aug 29, 2017
1 parent a751da3 commit 0a72bbb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
enum nvme_ctrl_state new_state)
{
enum nvme_ctrl_state old_state;
unsigned long flags;
bool changed = false;

spin_lock_irq(&ctrl->lock);
spin_lock_irqsave(&ctrl->lock, flags);

old_state = ctrl->state;
switch (new_state) {
Expand Down Expand Up @@ -239,7 +240,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
if (changed)
ctrl->state = new_state;

spin_unlock_irq(&ctrl->lock);
spin_unlock_irqrestore(&ctrl->lock, flags);

return changed;
}
Expand Down

0 comments on commit 0a72bbb

Please sign in to comment.