diff mbox series

[v1] scsi: ufs: qcom: Hold the mutex lock when config ESI

Message ID 1689065327-45039-1-git-send-email-quic_ziqichen@quicinc.com
State New
Headers show
Series [v1] scsi: ufs: qcom: Hold the mutex lock when config ESI | expand

Commit Message

Ziqi Chen July 11, 2023, 8:48 a.m. UTC
Lock the MSI descriptor storage of a device when config ESI.
Otherwise we would meet plenty of warnings during boot up.

Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
---
 drivers/ufs/host/ufs-qcom.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Martin K. Petersen July 23, 2023, 7:25 p.m. UTC | #1
Ziqi,

> Lock the MSI descriptor storage of a device when config ESI. Otherwise
> we would meet plenty of warnings during boot up.

Applied to 6.6/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index f36bcdb..d29e63e 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -1680,6 +1680,7 @@  static int ufs_qcom_config_esi(struct ufs_hba *hba)
 		goto out;
 	}
 
+	msi_lock_descs(hba->dev);
 	msi_for_each_desc(desc, hba->dev, MSI_DESC_ALL) {
 		ret = devm_request_irq(hba->dev, desc->irq,
 				       ufs_qcom_mcq_esi_handler,
@@ -1691,14 +1692,17 @@  static int ufs_qcom_config_esi(struct ufs_hba *hba)
 			break;
 		}
 	}
+	msi_unlock_descs(hba->dev);
 
 	if (ret) {
 		/* Rewind */
+		msi_lock_descs(hba->dev);
 		msi_for_each_desc(desc, hba->dev, MSI_DESC_ALL) {
 			if (desc == failed_desc)
 				break;
 			devm_free_irq(hba->dev, desc->irq, hba);
 		}
+		msi_unlock_descs(hba->dev);
 		platform_msi_domain_free_irqs(hba->dev);
 	} else {
 		if (host->hw_ver.major == 6 && host->hw_ver.minor == 0 &&