From ebebd5ef5f9d27da59161e1976804810d45fc733 Mon Sep 17 00:00:00 2001 From: Manivannan Sadhasivam Date: Wed, 4 May 2022 14:12:11 +0530 Subject: [PATCH] UPSTREAM: scsi: ufs: core: Remove redundant wmb() in ufshcd_send_command() The wmb() inside ufshcd_send_command() is added to make sure that the doorbell is committed immediately. This leads to couple of expectations: 1. The doorbell write should complete before the function return. 2. The doorbell write should not cross the function boundary. 2nd expectation is fullfilled by the Linux memory model as there is a guarantee that the critical section won't cross the unlock (release) operation. 1st expectation is not really needed here as there is no following read/ write that depends on the doorbell to be complete implicitly. Even if the doorbell write is in a CPUs Write Buffer (WB), wmb() won't flush it. And there is no real need of a WB flush here as well. So let's get rid of the wmb() that seems redundant. Link: https://lore.kernel.org/r/20220504084212.11605-5-manivannan.sadhasivam@linaro.org Reviewed-by: Bart Van Assche Reviewed-by: Bjorn Andersson Acked-by: Bean Huo Signed-off-by: Manivannan Sadhasivam Signed-off-by: Martin K. Petersen Bug: 234653003 (cherry picked from commit 23803bacaab47eafcd3a13ab607b5aa7b0debaaf) Change-Id: I237ad3fec8301aa9d17c508b1c50bff019eeae6d Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 82c5422a5d52..ac86823c8abc 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2189,9 +2189,6 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) __set_bit(task_tag, &hba->outstanding_reqs); ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL); spin_unlock_irqrestore(&hba->outstanding_lock, flags); - - /* Make sure that doorbell is committed immediately */ - wmb(); } /**