public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	Avri Altman <avri.altman@wdc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Peter Wang <peter.wang@mediatek.com>,
	Bean Huo <beanhuo@micron.com>,
	Daejun Park <daejun7.park@samsung.com>
Subject: [PATCH v2 20/29] scsi: ufs: Remove locking from around single register writes
Date: Tue, 12 Apr 2022 11:18:44 -0700	[thread overview]
Message-ID: <20220412181853.3715080-21-bvanassche@acm.org> (raw)
In-Reply-To: <20220412181853.3715080-1-bvanassche@acm.org>

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().

Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufs-mediatek.c | 8 --------
 drivers/scsi/ufs/ufshcd.c       | 4 ----
 2 files changed, 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 37527865e26b..d1c3f6291538 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);
 }
 
  /**

  parent reply	other threads:[~2022-04-12 18:22 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 18:18 [PATCH v2 00/29] UFS patches for kernel v5.19 Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 01/29] scsi: ufs: Fix a spelling error in a source code comment Bart Van Assche
2022-04-13  5:18   ` Avri Altman
2022-04-12 18:18 ` [PATCH v2 02/29] scsi: ufs: Declare ufshcd_wait_for_register() static Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 03/29] scsi: ufs: Remove superfluous boolean conversions Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 04/29] scsi: ufs: Simplify statements that return a boolean Bart Van Assche
2022-04-13  2:33   ` Keoseong Park
2022-04-13  3:20     ` Bart Van Assche
2022-04-13  5:18       ` Keoseong Park
2022-04-12 18:18 ` [PATCH v2 05/29] scsi: ufs: Remove ufshcd_lrb.sense_bufflen Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 06/29] scsi: ufs: Remove ufshcd_lrb.sense_buffer Bart Van Assche
2022-04-13  5:23   ` Avri Altman
2022-04-12 18:18 ` [PATCH v2 07/29] scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup() Bart Van Assche
2022-04-12 21:26   ` Eric Biggers
2022-04-13  0:08     ` Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 08/29] scsi: ufs: Remove the UFS_FIX() and END_FIX() macros Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 09/29] scsi: ufs: Rename struct ufs_dev_fix into ufs_dev_quirk Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 10/29] scsi: ufs: Declare the quirks array const Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 11/29] scsi: ufs: Invert the return value of ufshcd_is_hba_active() Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 12/29] scsi: ufs: Remove unused constants and code Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 13/29] scsi: ufs: Switch to aggregate initialization Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 14/29] scsi: ufs: Make the config_scaling_param calls type safe Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 15/29] scsi: ufs: Remove the driver version Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 16/29] scsi: ufs: Rename sdev_ufs_device into ufs_device_wlun Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 17/29] scsi: ufs: Use an SPDX license identifier in the Kconfig file Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 18/29] scsi: ufs: Remove paths from source code comments Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 19/29] scsi: ufs: Remove the TRUE and FALSE definitions Bart Van Assche
2022-04-14 11:56   ` Avri Altman
2022-04-12 18:18 ` Bart Van Assche [this message]
2022-04-12 18:18 ` [PATCH v2 21/29] scsi: ufs: Introduce ufshcd_clkgate_delay_set() Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 22/29] scsi: ufs: qcom: Fix ufs_qcom_resume() Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 23/29] scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives Bart Van Assche
2022-04-12 21:30   ` Eric Biggers
2022-04-12 18:18 ` [PATCH v2 24/29] scsi: ufs: Fix kernel-doc syntax in ufshcd.h Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 25/29] scsi: ufs: Minimize #include directives Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 26/29] scsi: ufs: Split the ufshcd.h header file Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 27/29] scsi: ufs: Move the struct ufs_ref_clk definition Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 28/29] scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition Bart Van Assche
2022-04-19 21:00   ` Bean Huo
2022-04-19 21:48     ` Bart Van Assche
2022-04-12 18:32 ` [PATCH v2 29/29] scsi: ufs: Split the drivers/scsi/ufs directory Bart Van Assche
2022-04-18 17:11   ` Bart Van Assche
2022-04-19  8:25     ` Bean Huo
2022-04-19 20:28       ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220412181853.3715080-21-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=daejun7.park@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=matthias.bgg@gmail.com \
    --cc=peter.wang@mediatek.com \
    --cc=stanley.chu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox