Skip to content

Commit 9db7a47

Browse files
avri-altman-sndkmartinkpetersen
authored andcommitted
scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop()
This change is motivated by Bart's suggestion in [1], which enables to further reduce the SCSI host lock usage in the UFS driver. The reason why it makes sense, because although the legacy interrupt is disabled by some but not all ufshcd_hba_stop() callers, it is safe to nest disable_irq() calls as it checks the irq depth. [1] https://lore.kernel.org/linux-scsi/[email protected]/ Suggested-by: Bart Van Assche <[email protected]> Signed-off-by: Avri Altman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 2486e60 commit 9db7a47

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4768,20 +4768,14 @@ EXPORT_SYMBOL_GPL(ufshcd_make_hba_operational);
47684768
*/
47694769
void ufshcd_hba_stop(struct ufs_hba *hba)
47704770
{
4771-
unsigned long flags;
47724771
int err;
47734772

4774-
/*
4775-
* Obtain the host lock to prevent that the controller is disabled
4776-
* while the UFS interrupt handler is active on another CPU.
4777-
*/
4778-
spin_lock_irqsave(hba->host->host_lock, flags);
4773+
ufshcd_disable_irq(hba);
47794774
ufshcd_writel(hba, CONTROLLER_DISABLE, REG_CONTROLLER_ENABLE);
4780-
spin_unlock_irqrestore(hba->host->host_lock, flags);
4781-
47824775
err = ufshcd_wait_for_register(hba, REG_CONTROLLER_ENABLE,
47834776
CONTROLLER_ENABLE, CONTROLLER_DISABLE,
47844777
10, 1);
4778+
ufshcd_enable_irq(hba);
47854779
if (err)
47864780
dev_err(hba->dev, "%s: Controller disable failed\n", __func__);
47874781
}

0 commit comments

Comments
 (0)