diff options
author | Bart Van Assche | 2022-04-19 15:58:03 -0700 |
---|---|---|
committer | Martin K. Petersen | 2022-04-25 23:23:03 -0400 |
commit | 3fb20fcd93fe5a1580355f1ea73f6daed1712f06 (patch) | |
tree | 2392adf19b7f2740688d7152b69dc8cf52ab83cb | |
parent | 21c2e3418d07955c7b87fc3f75688cb1c2b04a32 (diff) |
scsi: ufs: Remove locking from around single register writes
Single register writes are atomic and hence do not need to be surrounded by
locking. Additionally, MMIO writes are typically posted asynchronously.
Hence, there is no guarantee that these have finished by the time the
spin_unlock*() call has finished. See also the nonposted-mmio property of
the Open Firmware tree. See also pci_iomap().
Link: https://lore.kernel.org/r/20220419225811.4127248-21-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/ufs/ufs-mediatek.c | 8 | ||||
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 4 |
2 files changed, 0 insertions, 12 deletions
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c index 9a4474210627..2b26acc74efb 100644 --- a/drivers/scsi/ufs/ufs-mediatek.c +++ b/drivers/scsi/ufs/ufs-mediatek.c @@ -171,7 +171,6 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba, enum ufs_notify_change_status status) { struct ufs_mtk_host *host = ufshcd_get_variant(hba); - unsigned long flags; if (status == PRE_CHANGE) { if (host->unipro_lpm) { @@ -185,12 +184,8 @@ static int ufs_mtk_hce_enable_notify(struct ufs_hba *hba, ufs_mtk_crypto_enable(hba); if (host->caps & UFS_MTK_CAP_DISABLE_AH8) { - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, - flags); - hba->capabilities &= ~MASK_AUTO_HIBERN8_SUPPORT; hba->ahit = 0; } @@ -994,13 +989,10 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm) static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba) { - unsigned long flags; int ret; /* disable auto-hibern8 */ - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, flags); /* wait host return to idle state when auto-hibern8 off */ ufs_mtk_wait_idle_state(hba, 5); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index ef39d26afa90..254dd1e568dd 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4207,14 +4207,10 @@ EXPORT_SYMBOL_GPL(ufshcd_auto_hibern8_update); void ufshcd_auto_hibern8_enable(struct ufs_hba *hba) { - unsigned long flags; - if (!ufshcd_is_auto_hibern8_supported(hba)) return; - spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_writel(hba, hba->ahit, REG_AUTO_HIBERNATE_IDLE_TIMER); - spin_unlock_irqrestore(hba->host->host_lock, flags); } /** |