All of lore.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>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Bean Huo <beanhuo@micron.com>, Avri Altman <avri.altman@wdc.com>,
	Daejun Park <daejun7.park@samsung.com>,
	Can Guo <cang@codeaurora.org>,
	Asutosh Das <asutoshd@codeaurora.org>
Subject: [PATCH 16/29] scsi: ufs: Rename sdev_ufs_device into ufs_device_wlun
Date: Thu, 31 Mar 2022 15:34:11 -0700	[thread overview]
Message-ID: <20220331223424.1054715-17-bvanassche@acm.org> (raw)
In-Reply-To: <20220331223424.1054715-1-bvanassche@acm.org>

The new name reflects the role of this member variable better: a WLUN
through which the power mode of the UFS device is controlled.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufshcd.c | 48 +++++++++++++++++++--------------------
 drivers/scsi/ufs/ufshcd.h | 17 ++++++--------
 2 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9d433d2c616d..c36658d97774 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -540,7 +540,7 @@ static void ufshcd_print_tmrs(struct ufs_hba *hba, unsigned long bitmap)
 
 static void ufshcd_print_host_state(struct ufs_hba *hba)
 {
-	struct scsi_device *sdev_ufs = hba->sdev_ufs_device;
+	struct scsi_device *sdev_ufs = hba->ufs_device_wlun;
 
 	dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
 	dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n",
@@ -4195,7 +4195,7 @@ void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
 
 	if (update &&
-	    !pm_runtime_suspended(&hba->sdev_ufs_device->sdev_gendev)) {
+	    !pm_runtime_suspended(&hba->ufs_device_wlun->sdev_gendev)) {
 		ufshcd_rpm_get_sync(hba);
 		ufshcd_hold(hba, false);
 		ufshcd_auto_hibern8_enable(hba);
@@ -4911,13 +4911,13 @@ static void ufshcd_setup_links(struct ufs_hba *hba, struct scsi_device *sdev)
 	 * Device wlun is the supplier & rest of the luns are consumers.
 	 * This ensures that device wlun suspends after all other luns.
 	 */
-	if (hba->sdev_ufs_device) {
+	if (hba->ufs_device_wlun) {
 		link = device_link_add(&sdev->sdev_gendev,
-				       &hba->sdev_ufs_device->sdev_gendev,
+				       &hba->ufs_device_wlun->sdev_gendev,
 				       DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE);
 		if (!link) {
 			dev_err(&sdev->sdev_gendev, "Failed establishing link - %s\n",
-				dev_name(&hba->sdev_ufs_device->sdev_gendev));
+				dev_name(&hba->ufs_device_wlun->sdev_gendev));
 			return;
 		}
 		hba->luns_avail--;
@@ -5053,15 +5053,15 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev)
 	/* Drop the reference as it won't be needed anymore */
 	if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) {
 		spin_lock_irqsave(hba->host->host_lock, flags);
-		hba->sdev_ufs_device = NULL;
+		hba->ufs_device_wlun = NULL;
 		spin_unlock_irqrestore(hba->host->host_lock, flags);
-	} else if (hba->sdev_ufs_device) {
+	} else if (hba->ufs_device_wlun) {
 		struct device *supplier = NULL;
 
 		/* Ensure UFS Device WLUN exists and does not disappear */
 		spin_lock_irqsave(hba->host->host_lock, flags);
-		if (hba->sdev_ufs_device) {
-			supplier = &hba->sdev_ufs_device->sdev_gendev;
+		if (hba->ufs_device_wlun) {
+			supplier = &hba->ufs_device_wlun->sdev_gendev;
 			get_device(supplier);
 		}
 		spin_unlock_irqrestore(hba->host->host_lock, flags);
@@ -6037,7 +6037,7 @@ static void ufshcd_clk_scaling_suspend(struct ufs_hba *hba, bool suspend)
 static void ufshcd_err_handling_prepare(struct ufs_hba *hba)
 {
 	ufshcd_rpm_get_sync(hba);
-	if (pm_runtime_status_suspended(&hba->sdev_ufs_device->sdev_gendev) ||
+	if (pm_runtime_status_suspended(&hba->ufs_device_wlun->sdev_gendev) ||
 	    hba->is_sys_suspended) {
 		enum ufs_pm_op pm_op;
 
@@ -6082,7 +6082,7 @@ static void ufshcd_err_handling_unprepare(struct ufs_hba *hba)
 static inline bool ufshcd_err_handling_should_stop(struct ufs_hba *hba)
 {
 	return (!hba->is_powered || hba->shutting_down ||
-		!hba->sdev_ufs_device ||
+		!hba->ufs_device_wlun ||
 		hba->ufshcd_state == UFSHCD_STATE_ERROR ||
 		(!(hba->saved_err || hba->saved_uic_err || hba->force_reset ||
 		   ufshcd_is_link_broken(hba))));
@@ -6101,7 +6101,7 @@ static void ufshcd_recover_pm_error(struct ufs_hba *hba)
 	 * Set RPM status of wlun device to RPM_ACTIVE,
 	 * this also clears its runtime error.
 	 */
-	ret = pm_runtime_set_active(&hba->sdev_ufs_device->sdev_gendev);
+	ret = pm_runtime_set_active(&hba->ufs_device_wlun->sdev_gendev);
 
 	/* hba device might have a runtime error otherwise */
 	if (ret)
@@ -7495,20 +7495,20 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)
 	int ret = 0;
 	struct scsi_device *sdev_boot, *sdev_rpmb;
 
-	hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0,
+	hba->ufs_device_wlun = __scsi_add_device(hba->host, 0, 0,
 		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL);
-	if (IS_ERR(hba->sdev_ufs_device)) {
-		ret = PTR_ERR(hba->sdev_ufs_device);
-		hba->sdev_ufs_device = NULL;
+	if (IS_ERR(hba->ufs_device_wlun)) {
+		ret = PTR_ERR(hba->ufs_device_wlun);
+		hba->ufs_device_wlun = NULL;
 		goto out;
 	}
-	scsi_device_put(hba->sdev_ufs_device);
+	scsi_device_put(hba->ufs_device_wlun);
 
 	sdev_rpmb = __scsi_add_device(hba->host, 0, 0,
 		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL);
 	if (IS_ERR(sdev_rpmb)) {
 		ret = PTR_ERR(sdev_rpmb);
-		goto remove_sdev_ufs_device;
+		goto remove_ufs_device_wlun;
 	}
 	ufshcd_blk_pm_runtime_init(sdev_rpmb);
 	scsi_device_put(sdev_rpmb);
@@ -7523,8 +7523,8 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)
 	}
 	goto out;
 
-remove_sdev_ufs_device:
-	scsi_remove_device(hba->sdev_ufs_device);
+remove_ufs_device_wlun:
+	scsi_remove_device(hba->ufs_device_wlun);
 out:
 	return ret;
 }
@@ -8660,7 +8660,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
 	int ret, retries;
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
-	sdp = hba->sdev_ufs_device;
+	sdp = hba->ufs_device_wlun;
 	if (sdp) {
 		ret = scsi_device_get(sdp);
 		if (!ret && !scsi_device_online(sdp)) {
@@ -9437,7 +9437,7 @@ EXPORT_SYMBOL(ufshcd_shutdown);
  */
 void ufshcd_remove(struct ufs_hba *hba)
 {
-	if (hba->sdev_ufs_device)
+	if (hba->ufs_device_wlun)
 		ufshcd_rpm_get_sync(hba);
 	ufs_hwmon_remove(hba);
 	ufs_bsg_remove(hba);
@@ -9765,7 +9765,7 @@ EXPORT_SYMBOL_GPL(ufshcd_resume_complete);
 
 static bool ufshcd_rpm_ok_for_spm(struct ufs_hba *hba)
 {
-	struct device *dev = &hba->sdev_ufs_device->sdev_gendev;
+	struct device *dev = &hba->ufs_device_wlun->sdev_gendev;
 	enum ufs_dev_pwr_mode dev_pwr_mode;
 	enum uic_link_state link_state;
 	unsigned long flags;
@@ -9794,7 +9794,7 @@ int __ufshcd_suspend_prepare(struct device *dev, bool rpm_ok_for_spm)
 	 * if it's runtime suspended. But ufs doesn't follow that.
 	 * Refer ufshcd_resume_complete()
 	 */
-	if (hba->sdev_ufs_device) {
+	if (hba->ufs_device_wlun) {
 		/* Prevent runtime suspend */
 		ufshcd_rpm_get_noresume(hba);
 		/*
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 49edbdb5ffd6..14414225faa1 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -732,6 +732,7 @@ struct ufs_hba_monitor {
  * @utmrdl_dma_addr: UTMRDL DMA address
  * @host: Scsi_Host instance of the driver
  * @dev: device handle
+ * @ufs_device_wlun: WLUN that controls the entire UFS device.
  * @lrb: local reference block
  * @outstanding_tasks: Bits representing outstanding task requests
  * @outstanding_lock: Protects @outstanding_reqs.
@@ -799,11 +800,7 @@ struct ufs_hba {
 
 	struct Scsi_Host *host;
 	struct device *dev;
-	/*
-	 * This field is to keep a reference to "scsi_device" corresponding to
-	 * "UFS device" W-LU.
-	 */
-	struct scsi_device *sdev_ufs_device;
+	struct scsi_device *ufs_device_wlun;
 
 #ifdef CONFIG_SCSI_UFS_HWMON
 	struct device *hwmon_device;
@@ -1407,27 +1404,27 @@ static inline int ufshcd_update_ee_usr_mask(struct ufs_hba *hba,
 
 static inline int ufshcd_rpm_get_sync(struct ufs_hba *hba)
 {
-	return pm_runtime_get_sync(&hba->sdev_ufs_device->sdev_gendev);
+	return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev);
 }
 
 static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba)
 {
-	return pm_runtime_put_sync(&hba->sdev_ufs_device->sdev_gendev);
+	return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev);
 }
 
 static inline void ufshcd_rpm_get_noresume(struct ufs_hba *hba)
 {
-	pm_runtime_get_noresume(&hba->sdev_ufs_device->sdev_gendev);
+	pm_runtime_get_noresume(&hba->ufs_device_wlun->sdev_gendev);
 }
 
 static inline int ufshcd_rpm_resume(struct ufs_hba *hba)
 {
-	return pm_runtime_resume(&hba->sdev_ufs_device->sdev_gendev);
+	return pm_runtime_resume(&hba->ufs_device_wlun->sdev_gendev);
 }
 
 static inline int ufshcd_rpm_put(struct ufs_hba *hba)
 {
-	return pm_runtime_put(&hba->sdev_ufs_device->sdev_gendev);
+	return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev);
 }
 
 #endif /* End of Header */

  parent reply	other threads:[~2022-03-31 22:37 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 22:33 [PATCH 00/29] UFS patches for kernel v5.19 Bart Van Assche
2022-03-31 22:33 ` [PATCH 01/29] scsi: ufs: Declare ufshcd_wait_for_register() static Bart Van Assche
2022-04-01 18:33   ` Avri Altman
2022-04-03  9:45   ` Bean Huo
2022-03-31 22:33 ` [PATCH 02/29] scsi: ufs: Remove superfluous boolean conversions Bart Van Assche
2022-03-31 23:44   ` Bjorn Andersson
2022-04-03  3:20     ` Bart Van Assche
2022-04-01 18:35   ` Avri Altman
2022-03-31 22:33 ` [PATCH 03/29] scsi: ufs: Simplify statements that return a boolean Bart Van Assche
2022-03-31 23:45   ` Bjorn Andersson
2022-04-01 18:49   ` Avri Altman
2022-04-03  3:30     ` Bart Van Assche
2022-03-31 22:33 ` [PATCH 04/29] scsi: ufs: Remove ufshcd_lrb.sense_bufflen Bart Van Assche
2022-04-01 18:56   ` Avri Altman
2022-03-31 22:34 ` [PATCH 05/29] scsi: ufs: Remove ufshcd_lrb.sense_buffer Bart Van Assche
2022-04-01 19:21   ` Avri Altman
2022-04-03  4:26     ` Bart Van Assche
2022-03-31 22:34 ` [PATCH 06/29] scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup() Bart Van Assche
2022-04-03 11:20   ` Bean Huo
2022-03-31 22:34 ` [PATCH 07/29] scsi: ufs: Remove the UFS_FIX() and END_FIX() macros Bart Van Assche
2022-04-01 19:43   ` Avri Altman
2022-03-31 22:34 ` [PATCH 08/29] scsi: ufs: Rename struct ufs_dev_fix into ufs_dev_quirk Bart Van Assche
2022-04-01 19:47   ` Avri Altman
2022-04-04 21:15     ` Bart Van Assche
2022-03-31 22:34 ` [PATCH 09/29] scsi: ufs: Declare the quirks array const Bart Van Assche
2022-04-01 19:56   ` Avri Altman
2022-04-04 21:14     ` Bart Van Assche
2022-04-08 14:41       ` Krzysztof Kozlowski
2022-04-05  6:14   ` Avri Altman
2022-03-31 22:34 ` [PATCH 10/29] scsi: ufs: Invert the return value of ufshcd_is_hba_active() Bart Van Assche
2022-04-02  6:32   ` Avri Altman
2022-03-31 22:34 ` [PATCH 11/29] scsi: ufs: Remove unused constants and code Bart Van Assche
2022-04-02  6:59   ` Avri Altman
2022-04-04  2:07     ` Bart Van Assche
2022-04-05  6:55       ` Avri Altman
2022-04-07  2:33         ` Stanley Chu
2022-03-31 22:34 ` [PATCH 12/29] scsi: ufs: Switch to aggregate initialization Bart Van Assche
2022-04-02  7:07   ` Avri Altman
2022-03-31 22:34 ` [PATCH 13/29] scsi: ufs: Remove the LUN quiescing code from ufshcd_wl_shutdown() Bart Van Assche
2022-04-01  6:20   ` Adrian Hunter
2022-04-01 13:52     ` Bart Van Assche
2022-04-01 14:35       ` Adrian Hunter
2022-04-05 19:11         ` Bart Van Assche
2022-03-31 22:34 ` [PATCH 14/29] scsi: ufs: Make the config_scaling_param calls type safe Bart Van Assche
2022-03-31 23:48   ` Bjorn Andersson
2022-04-01  4:08     ` Bart Van Assche
2022-04-03  3:51       ` Bjorn Andersson
2022-03-31 22:34 ` [PATCH 15/29] scsi: ufs: Remove the driver version Bart Van Assche
2022-04-03  7:10   ` Avri Altman
2022-04-03 21:51     ` Bart Van Assche
2022-04-03 15:52   ` Bean Huo
2022-04-04  6:25   ` Avri Altman
2022-03-31 22:34 ` Bart Van Assche [this message]
2022-04-03  7:25   ` [PATCH 16/29] scsi: ufs: Rename sdev_ufs_device into ufs_device_wlun Avri Altman
2022-03-31 22:34 ` [PATCH 17/29] scsi: ufs: Use an SPDX license identifier in the Kconfig file Bart Van Assche
2022-03-31 22:34 ` [PATCH 18/29] scsi: ufs: Remove paths from source code comments Bart Van Assche
2022-04-03  7:33   ` Avri Altman
2022-03-31 22:34 ` [PATCH 19/29] scsi: ufs: Remove the TRUE and FALSE definitions Bart Van Assche
2022-04-01  2:19   ` Chanho Park
2022-04-04  2:39     ` Bart Van Assche
2022-03-31 22:34 ` [PATCH 20/29] scsi: ufs: Remove locking from around single register writes Bart Van Assche
2022-04-05  6:19   ` Avri Altman
2022-03-31 22:34 ` [PATCH 21/29] scsi: ufs: Introduce ufshcd_clkgate_delay_set() Bart Van Assche
2022-04-05  6:20   ` Avri Altman
2022-03-31 22:34 ` [PATCH 22/29] scsi: ufs: qcom: Fix ufs_qcom_resume() Bart Van Assche
2022-03-31 23:50   ` Bjorn Andersson
2022-03-31 22:34 ` [PATCH 23/29] scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives Bart Van Assche
2022-03-31 22:34 ` [PATCH 24/29] scsi: ufs: Fix kernel-doc syntax in ufshcd.h Bart Van Assche
2022-04-05  6:27   ` Avri Altman
2022-03-31 22:34 ` [PATCH 25/29] scsi: ufs: Minimize #include directives Bart Van Assche
2022-04-01  6:53   ` Adrian Hunter
2022-04-01 13:52     ` Bart Van Assche
2022-03-31 22:34 ` [PATCH 26/29] scsi: ufs: Split the ufshcd.h header file Bart Van Assche
2022-04-01  0:21   ` Chanho Park
2022-04-01  4:14     ` Bart Van Assche
2022-04-01  4:30       ` Chanho Park
2022-04-05  6:39   ` Avri Altman
2022-04-05 14:10     ` Bart Van Assche
2022-03-31 22:34 ` [PATCH 27/29] scsi: ufs: Move the struct ufs_ref_clk definition Bart Van Assche
2022-04-05  6:50   ` Avri Altman
2022-03-31 22:34 ` [PATCH 28/29] scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition Bart Van Assche
2022-04-05  6:53   ` Avri Altman
2022-04-05 14:13     ` Bart Van Assche
2022-03-31 22:34 ` [PATCH 29/29] scsi: ufs: Split the drivers/scsi/ufs directory Bart Van Assche
2022-04-01  5:12   ` Christoph Hellwig
2022-04-01 13:56     ` Bart Van Assche
2022-04-01  6:38   ` Adrian Hunter
2022-04-01 13:58     ` Bart Van Assche
2022-04-01 17:03       ` Alim Akhtar
2022-04-02  3:21         ` Bart Van Assche
     [not found] ` <CGME20220331223522epcas2p4f8f20c2ec00dbc6d5a7bf855a1dd7395@epcms2p5>
2022-04-01  6:14   ` [PATCH 04/29] scsi: ufs: Remove ufshcd_lrb.sense_bufflen Keoseong Park
2022-04-01  9:28 ` [PATCH 00/29] UFS patches for kernel v5.19 Bean Huo
2022-04-01  9:32 ` Bean Huo
2022-04-01 14:12   ` Bart Van Assche
2022-04-03  5:59     ` Avri Altman
2022-04-03 21:36       ` Bean Huo
2022-04-03 21:54         ` Bart Van Assche
2022-04-04  8:12           ` Bean Huo
2022-04-04 21:13             ` Bart Van Assche
2022-04-05  9:33               ` Bean Huo
2022-04-05 14:22                 ` 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=20220331223424.1054715-17-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=adrian.hunter@intel.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=cang@codeaurora.org \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.