]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop()
authorAvri Altman <avri.altman@wdc.com>
Thu, 28 Nov 2024 07:25:42 +0000 (09:25 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 10 Dec 2024 02:45:53 +0000 (21:45 -0500)
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/c58e4fce-0a74-4469-ad16-f1edbd670728@acm.org/

Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20241128072542.219170-1-avri.altman@wdc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c

index 528a9f35cf376c34e6c4399ebad01cc883a24811..3dfaeba5b691aef9727fb4f70a0f950d08ec3c4d 100644 (file)
@@ -4768,20 +4768,14 @@ EXPORT_SYMBOL_GPL(ufshcd_make_hba_operational);
  */
 void ufshcd_hba_stop(struct ufs_hba *hba)
 {
-       unsigned long flags;
        int err;
 
-       /*
-        * Obtain the host lock to prevent that the controller is disabled
-        * while the UFS interrupt handler is active on another CPU.
-        */
-       spin_lock_irqsave(hba->host->host_lock, flags);
+       ufshcd_disable_irq(hba);
        ufshcd_writel(hba, CONTROLLER_DISABLE,  REG_CONTROLLER_ENABLE);
-       spin_unlock_irqrestore(hba->host->host_lock, flags);
-
        err = ufshcd_wait_for_register(hba, REG_CONTROLLER_ENABLE,
                                        CONTROLLER_ENABLE, CONTROLLER_DISABLE,
                                        10, 1);
+       ufshcd_enable_irq(hba);
        if (err)
                dev_err(hba->dev, "%s: Controller disable failed\n", __func__);
 }