From bdd3b389ad05933dccf5e361f5aaaabd2df4f22c Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Thu, 23 Jul 2020 11:45:24 -0700 Subject: [PATCH] scsi: ufs-qcom: Skip getting fsm state in dme context Getting fsm state needs a dme command. It'd lead to a deadlock if timeout of dme command leads to dumping of fsm state which would again try to acquire the uic_cmd_mutex. Change-Id: I04ad7b6eececd085189ddc59154fc81e68874dc3 Signed-off-by: Asutosh Das --- drivers/scsi/ufs/ufs-qcom.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index cd7ef3bb98b1..eecafc519746 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -3079,6 +3079,14 @@ static void ufs_qcom_print_utp_hci_testbus(struct ufs_hba *hba) static void ufshcd_print_fsm_state(struct ufs_hba *hba) { int err = 0, tx_fsm_val = 0, rx_fsm_val = 0; + unsigned long flags; + + spin_lock_irqsave(hba->host->host_lock, flags); + if (hba->active_uic_cmd) { + spin_unlock_irqrestore(hba->host->host_lock, flags); + return; + } + spin_unlock_irqrestore(hba->host->host_lock, flags); err = ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE,