Commit 302e0901 authored by Xiaofei Tan's avatar Xiaofei Tan Committed by Martin K. Petersen

scsi: hisi_sas: use spin_lock_irqsave() for hisi_hba.lock

We used spin_lock() to grab hisi_hba.lock in two places where
spin_lock_irqsave() should be used, as hisi_hba.lock can be taken in
interrupt context.

This patch is to fix this.
Signed-off-by: default avatarXiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f692a677
...@@ -505,9 +505,10 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device) ...@@ -505,9 +505,10 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device)
{ {
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
struct hisi_sas_device *sas_dev = NULL; struct hisi_sas_device *sas_dev = NULL;
unsigned long flags;
int i; int i;
spin_lock(&hisi_hba->lock); spin_lock_irqsave(&hisi_hba->lock, flags);
for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) { for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) {
if (hisi_hba->devices[i].dev_type == SAS_PHY_UNUSED) { if (hisi_hba->devices[i].dev_type == SAS_PHY_UNUSED) {
int queue = i % hisi_hba->queue_count; int queue = i % hisi_hba->queue_count;
...@@ -524,7 +525,7 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device) ...@@ -524,7 +525,7 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device)
break; break;
} }
} }
spin_unlock(&hisi_hba->lock); spin_unlock_irqrestore(&hisi_hba->lock, flags);
return sas_dev; return sas_dev;
} }
......
...@@ -843,8 +843,9 @@ hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device) ...@@ -843,8 +843,9 @@ hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device)
struct hisi_sas_device *sas_dev = NULL; struct hisi_sas_device *sas_dev = NULL;
int i, sata_dev = dev_is_sata(device); int i, sata_dev = dev_is_sata(device);
int sata_idx = -1; int sata_idx = -1;
unsigned long flags;
spin_lock(&hisi_hba->lock); spin_lock_irqsave(&hisi_hba->lock, flags);
if (sata_dev) if (sata_dev)
if (!sata_index_alloc_v2_hw(hisi_hba, &sata_idx)) if (!sata_index_alloc_v2_hw(hisi_hba, &sata_idx))
...@@ -874,7 +875,7 @@ hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device) ...@@ -874,7 +875,7 @@ hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device)
} }
out: out:
spin_unlock(&hisi_hba->lock); spin_unlock_irqrestore(&hisi_hba->lock, flags);
return sas_dev; return sas_dev;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment