summaryrefslogtreecommitdiff
path: root/drivers/nvme
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-08-22 12:42:24 +0300
committerChristoph Hellwig <hch@lst.de>2017-08-29 11:22:23 +0300
commit0a72bbba493bebd53fa78e6741b86a3003f070d6 (patch)
tree6a45cab1b33026b85cca57a5063fe0b5a3130c02 /drivers/nvme
parenta751da33945a2c94a0449d1005c3c973e5acfefb (diff)
downloadlinux-0a72bbba493bebd53fa78e6741b86a3003f070d6.tar.xz
nvme: allow calling nvme_change_ctrl_state from irq context
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <keith.busch@intel.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4c49ec4349bc..d63e1fcf4437 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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) {
@@ -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;
}