All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] UFS patches for Linux kernel v5.14
@ 2021-06-24 23:29 Bart Van Assche
  2021-06-24 23:29 ` [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Bart Van Assche @ 2021-06-24 23:29 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Jaegeuk Kim, Bart Van Assche


Hi Martin,

The three patches in this series are intended for kernel v5.14. These
patches have been compile tested only but should be easy to review.

Thanks,

Bart.

Changes compared to v1:
- Dropped patches 3 and 4.
- Added a new patch at the start of this series that reduces code duplication
  in the runtime power managment implementation.

Bart Van Assche (3):
  ufs: Reduce code duplication in the runtime power managment
    implementation
  ufs: Rename the second ufshcd_probe_hba() argument
  ufs: Remove ufshcd_valid_tag()

 drivers/scsi/ufs/tc-dwc-g210-pci.c | 34 ++----------
 drivers/scsi/ufs/ufshcd-pci.c      | 48 +----------------
 drivers/scsi/ufs/ufshcd-pltfrm.c   | 47 -----------------
 drivers/scsi/ufs/ufshcd.c          | 83 ++++++++++--------------------
 drivers/scsi/ufs/ufshcd.h          |  9 ++--
 5 files changed, 36 insertions(+), 185 deletions(-)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation
  2021-06-24 23:29 [PATCH v2 0/3] UFS patches for Linux kernel v5.14 Bart Van Assche
@ 2021-06-24 23:29 ` Bart Van Assche
  2021-06-25 10:27   ` Bean Huo
                     ` (3 more replies)
  2021-06-24 23:29 ` [PATCH v2 2/3] ufs: Rename the second ufshcd_probe_hba() argument Bart Van Assche
  2021-06-24 23:29 ` [PATCH v2 3/3] ufs: Remove ufshcd_valid_tag() Bart Van Assche
  2 siblings, 4 replies; 10+ messages in thread
From: Bart Van Assche @ 2021-06-24 23:29 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Jaegeuk Kim, Bart Van Assche, Adrian Hunter,
	Stanley Chu, Can Guo, Asutosh Das, Avri Altman, Pedro Sousa,
	James E.J. Bottomley, Matthias Brugger, Bean Huo,
	Bjorn Andersson, Sergey Shtylyov, Yue Hu, Kiwoong Kim

Move the dev_get_drvdata() calls into the ufshcd_{system,runtime}_*()
functions. Remove ufshcd_runtime_idle() since it is empty. This patch
does not change any functionality.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Stanley Chu <stanley.chu@mediatek.com>
Cc: Can Guo <cang@codeaurora.org>
Cc: Asutosh Das <asutoshd@codeaurora.org>
Cc: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/tc-dwc-g210-pci.c | 34 +++------------------
 drivers/scsi/ufs/ufshcd-pci.c      | 48 ++----------------------------
 drivers/scsi/ufs/ufshcd-pltfrm.c   | 47 -----------------------------
 drivers/scsi/ufs/ufshcd.c          | 35 ++++++++++------------
 drivers/scsi/ufs/ufshcd.h          |  9 +++---
 5 files changed, 26 insertions(+), 147 deletions(-)

diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-g210-pci.c
index ec4589afbc13..96ef98a95b85 100644
--- a/drivers/scsi/ufs/tc-dwc-g210-pci.c
+++ b/drivers/scsi/ufs/tc-dwc-g210-pci.c
@@ -23,31 +23,6 @@ static int tc_type = TC_G210_INV;
 module_param(tc_type, int, 0);
 MODULE_PARM_DESC(tc_type, "Test Chip Type (20 = 20-bit, 40 = 40-bit)");
 
-static int tc_dwc_g210_pci_suspend(struct device *dev)
-{
-	return ufshcd_system_suspend(dev_get_drvdata(dev));
-}
-
-static int tc_dwc_g210_pci_resume(struct device *dev)
-{
-	return ufshcd_system_resume(dev_get_drvdata(dev));
-}
-
-static int tc_dwc_g210_pci_runtime_suspend(struct device *dev)
-{
-	return ufshcd_runtime_suspend(dev_get_drvdata(dev));
-}
-
-static int tc_dwc_g210_pci_runtime_resume(struct device *dev)
-{
-	return ufshcd_runtime_resume(dev_get_drvdata(dev));
-}
-
-static int tc_dwc_g210_pci_runtime_idle(struct device *dev)
-{
-	return ufshcd_runtime_idle(dev_get_drvdata(dev));
-}
-
 /*
  * struct ufs_hba_dwc_vops - UFS DWC specific variant operations
  */
@@ -143,11 +118,10 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 }
 
 static const struct dev_pm_ops tc_dwc_g210_pci_pm_ops = {
-	.suspend	= tc_dwc_g210_pci_suspend,
-	.resume		= tc_dwc_g210_pci_resume,
-	.runtime_suspend = tc_dwc_g210_pci_runtime_suspend,
-	.runtime_resume  = tc_dwc_g210_pci_runtime_resume,
-	.runtime_idle    = tc_dwc_g210_pci_runtime_idle,
+	.suspend	 = ufshcd_system_suspend,
+	.resume		 = ufshcd_system_resume,
+	.runtime_suspend = ufshcd_runtime_suspend,
+	.runtime_resume  = ufshcd_runtime_resume,
 	.prepare	 = ufshcd_suspend_prepare,
 	.complete	 = ufshcd_resume_complete,
 };
diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
index e6c334bfb4c2..f07f4a490025 100644
--- a/drivers/scsi/ufs/ufshcd-pci.c
+++ b/drivers/scsi/ufs/ufshcd-pci.c
@@ -385,48 +385,6 @@ static struct ufs_hba_variant_ops ufs_intel_lkf_hba_vops = {
 	.device_reset		= ufs_intel_device_reset,
 };
 
-#ifdef CONFIG_PM_SLEEP
-/**
- * ufshcd_pci_suspend - suspend power management function
- * @dev: pointer to PCI device handle
- *
- * Returns 0 if successful
- * Returns non-zero otherwise
- */
-static int ufshcd_pci_suspend(struct device *dev)
-{
-	return ufshcd_system_suspend(dev_get_drvdata(dev));
-}
-
-/**
- * ufshcd_pci_resume - resume power management function
- * @dev: pointer to PCI device handle
- *
- * Returns 0 if successful
- * Returns non-zero otherwise
- */
-static int ufshcd_pci_resume(struct device *dev)
-{
-	return ufshcd_system_resume(dev_get_drvdata(dev));
-}
-
-#endif /* !CONFIG_PM_SLEEP */
-
-#ifdef CONFIG_PM
-static int ufshcd_pci_runtime_suspend(struct device *dev)
-{
-	return ufshcd_runtime_suspend(dev_get_drvdata(dev));
-}
-static int ufshcd_pci_runtime_resume(struct device *dev)
-{
-	return ufshcd_runtime_resume(dev_get_drvdata(dev));
-}
-static int ufshcd_pci_runtime_idle(struct device *dev)
-{
-	return ufshcd_runtime_idle(dev_get_drvdata(dev));
-}
-#endif /* !CONFIG_PM */
-
 /**
  * ufshcd_pci_shutdown - main function to put the controller in reset state
  * @pdev: pointer to PCI device handle
@@ -510,10 +468,8 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 }
 
 static const struct dev_pm_ops ufshcd_pci_pm_ops = {
-	SET_RUNTIME_PM_OPS(ufshcd_pci_runtime_suspend,
-			   ufshcd_pci_runtime_resume,
-			   ufshcd_pci_runtime_idle)
-	SET_SYSTEM_SLEEP_PM_OPS(ufshcd_pci_suspend, ufshcd_pci_resume)
+	SET_RUNTIME_PM_OPS(ufshcd_runtime_suspend, ufshcd_runtime_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(ufshcd_system_suspend, ufshcd_system_resume)
 #ifdef CONFIG_PM_SLEEP
 	.prepare	= ufshcd_suspend_prepare,
 	.complete	= ufshcd_resume_complete,
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index 298e22ef907e..8859c13f4e09 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -170,53 +170,6 @@ static int ufshcd_parse_regulator_info(struct ufs_hba *hba)
 	return err;
 }
 
-#ifdef CONFIG_PM
-/**
- * ufshcd_pltfrm_suspend - suspend power management function
- * @dev: pointer to device handle
- *
- * Returns 0 if successful
- * Returns non-zero otherwise
- */
-int ufshcd_pltfrm_suspend(struct device *dev)
-{
-	return ufshcd_system_suspend(dev_get_drvdata(dev));
-}
-EXPORT_SYMBOL_GPL(ufshcd_pltfrm_suspend);
-
-/**
- * ufshcd_pltfrm_resume - resume power management function
- * @dev: pointer to device handle
- *
- * Returns 0 if successful
- * Returns non-zero otherwise
- */
-int ufshcd_pltfrm_resume(struct device *dev)
-{
-	return ufshcd_system_resume(dev_get_drvdata(dev));
-}
-EXPORT_SYMBOL_GPL(ufshcd_pltfrm_resume);
-
-int ufshcd_pltfrm_runtime_suspend(struct device *dev)
-{
-	return ufshcd_runtime_suspend(dev_get_drvdata(dev));
-}
-EXPORT_SYMBOL_GPL(ufshcd_pltfrm_runtime_suspend);
-
-int ufshcd_pltfrm_runtime_resume(struct device *dev)
-{
-	return ufshcd_runtime_resume(dev_get_drvdata(dev));
-}
-EXPORT_SYMBOL_GPL(ufshcd_pltfrm_runtime_resume);
-
-int ufshcd_pltfrm_runtime_idle(struct device *dev)
-{
-	return ufshcd_runtime_idle(dev_get_drvdata(dev));
-}
-EXPORT_SYMBOL_GPL(ufshcd_pltfrm_runtime_idle);
-
-#endif /* CONFIG_PM */
-
 void ufshcd_pltfrm_shutdown(struct platform_device *pdev)
 {
 	ufshcd_shutdown((struct ufs_hba *)platform_get_drvdata(pdev));
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5b31de83a63a..f097720b6b5e 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -9204,15 +9204,16 @@ static int ufshcd_resume(struct ufs_hba *hba)
 }
 
 /**
- * ufshcd_system_suspend - system suspend routine
- * @hba: per adapter instance
+ * ufshcd_system_suspend - system suspend callback
+ * @dev: Device associated with the UFS controller.
  *
  * Check the description of ufshcd_suspend() function for more details.
  *
  * Returns 0 for success and non-zero for failure
  */
-int ufshcd_system_suspend(struct ufs_hba *hba)
+int ufshcd_system_suspend(struct device *dev)
 {
+	struct ufs_hba *hba = dev_get_drvdata(dev);
 	int ret = 0;
 	ktime_t start = ktime_get();
 
@@ -9229,16 +9230,16 @@ int ufshcd_system_suspend(struct ufs_hba *hba)
 EXPORT_SYMBOL(ufshcd_system_suspend);
 
 /**
- * ufshcd_system_resume - system resume routine
- * @hba: per adapter instance
+ * ufshcd_system_resume - system resume callback
+ * @dev: Device associated with the UFS controller.
  *
  * Returns 0 for success and non-zero for failure
  */
-
-int ufshcd_system_resume(struct ufs_hba *hba)
+int ufshcd_system_resume(struct device *dev)
 {
-	int ret = 0;
+	struct ufs_hba *hba = dev_get_drvdata(dev);
 	ktime_t start = ktime_get();
+	int ret = 0;
 
 	if (pm_runtime_suspended(hba->dev))
 		goto out;
@@ -9255,15 +9256,16 @@ int ufshcd_system_resume(struct ufs_hba *hba)
 EXPORT_SYMBOL(ufshcd_system_resume);
 
 /**
- * ufshcd_runtime_suspend - runtime suspend routine
- * @hba: per adapter instance
+ * ufshcd_runtime_suspend - runtime suspend callback
+ * @dev: Device associated with the UFS controller.
  *
  * Check the description of ufshcd_suspend() function for more details.
  *
  * Returns 0 for success and non-zero for failure
  */
-int ufshcd_runtime_suspend(struct ufs_hba *hba)
+int ufshcd_runtime_suspend(struct device *dev)
 {
+	struct ufs_hba *hba = dev_get_drvdata(dev);
 	int ret;
 	ktime_t start = ktime_get();
 
@@ -9278,7 +9280,7 @@ EXPORT_SYMBOL(ufshcd_runtime_suspend);
 
 /**
  * ufshcd_runtime_resume - runtime resume routine
- * @hba: per adapter instance
+ * @dev: Device associated with the UFS controller.
  *
  * This function basically brings controller
  * to active state. Following operations are done in this function:
@@ -9286,8 +9288,9 @@ EXPORT_SYMBOL(ufshcd_runtime_suspend);
  * 1. Turn on all the controller related clocks
  * 2. Turn ON VCC rail
  */
-int ufshcd_runtime_resume(struct ufs_hba *hba)
+int ufshcd_runtime_resume(struct device *dev)
 {
+	struct ufs_hba *hba = dev_get_drvdata(dev);
 	int ret;
 	ktime_t start = ktime_get();
 
@@ -9300,12 +9303,6 @@ int ufshcd_runtime_resume(struct ufs_hba *hba)
 }
 EXPORT_SYMBOL(ufshcd_runtime_resume);
 
-int ufshcd_runtime_idle(struct ufs_hba *hba)
-{
-	return 0;
-}
-EXPORT_SYMBOL(ufshcd_runtime_idle);
-
 /**
  * ufshcd_shutdown - shutdown routine
  * @hba: per adapter instance
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index c98d540ac044..dc75426c609f 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -1009,11 +1009,10 @@ static inline u8 ufshcd_wb_get_query_index(struct ufs_hba *hba)
 	return 0;
 }
 
-extern int ufshcd_runtime_suspend(struct ufs_hba *hba);
-extern int ufshcd_runtime_resume(struct ufs_hba *hba);
-extern int ufshcd_runtime_idle(struct ufs_hba *hba);
-extern int ufshcd_system_suspend(struct ufs_hba *hba);
-extern int ufshcd_system_resume(struct ufs_hba *hba);
+extern int ufshcd_runtime_suspend(struct device *dev);
+extern int ufshcd_runtime_resume(struct device *dev);
+extern int ufshcd_system_suspend(struct device *dev);
+extern int ufshcd_system_resume(struct device *dev);
 extern int ufshcd_shutdown(struct ufs_hba *hba);
 extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba,
 				      int agreed_gear,

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/3] ufs: Rename the second ufshcd_probe_hba() argument
  2021-06-24 23:29 [PATCH v2 0/3] UFS patches for Linux kernel v5.14 Bart Van Assche
  2021-06-24 23:29 ` [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation Bart Van Assche
@ 2021-06-24 23:29 ` Bart Van Assche
  2021-06-25 10:36   ` Bean Huo
  2021-06-24 23:29 ` [PATCH v2 3/3] ufs: Remove ufshcd_valid_tag() Bart Van Assche
  2 siblings, 1 reply; 10+ messages in thread
From: Bart Van Assche @ 2021-06-24 23:29 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Jaegeuk Kim, Bart Van Assche, Avri Altman, Bean Huo,
	Asutosh Das, Can Guo, James E.J. Bottomley, Stanley Chu

Rename the second argument of ufshcd_probe_hba() such that the name of
that argument reflects its purpose instead of how the function is called.
See also commit 1b9e21412f72 ("scsi: ufs: Split ufshcd_probe_hba() based
on its called flow").

Reviewed-by: Avri Altman <avri.altman@wdc.com>
Cc: Bean Huo <beanhuo@micron.com>
Cc: Asutosh Das <asutoshd@codeaurora.org>
Cc: Can Guo <cang@codeaurora.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufshcd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f097720b6b5e..fb493533c034 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7964,13 +7964,13 @@ static int ufshcd_clear_ua_wluns(struct ufs_hba *hba)
 }
 
 /**
- * ufshcd_probe_hba - probe hba to detect device and initialize
+ * ufshcd_probe_hba - probe hba to detect device and initialize it
  * @hba: per-adapter instance
- * @async: asynchronous execution or not
+ * @init_dev_params: whether or not to call ufshcd_device_params_init().
  *
  * Execute link-startup and verify device initialization
  */
-static int ufshcd_probe_hba(struct ufs_hba *hba, bool async)
+static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
 {
 	int ret;
 	unsigned long flags;
@@ -8002,7 +8002,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async)
 	 * Initialize UFS device parameters used by driver, these
 	 * parameters are associated with UFS descriptors.
 	 */
-	if (async) {
+	if (init_dev_params) {
 		ret = ufshcd_device_params_init(hba);
 		if (ret)
 			goto out;

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/3] ufs: Remove ufshcd_valid_tag()
  2021-06-24 23:29 [PATCH v2 0/3] UFS patches for Linux kernel v5.14 Bart Van Assche
  2021-06-24 23:29 ` [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation Bart Van Assche
  2021-06-24 23:29 ` [PATCH v2 2/3] ufs: Rename the second ufshcd_probe_hba() argument Bart Van Assche
@ 2021-06-24 23:29 ` Bart Van Assche
  2 siblings, 0 replies; 10+ messages in thread
From: Bart Van Assche @ 2021-06-24 23:29 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Jaegeuk Kim, Bart Van Assche, Alim Akhtar,
	Avri Altman, Gilad Broner, Yaniv Gardi, Subhash Jadavani,
	Dolev Raviv, James E.J. Bottomley, Can Guo, Stanley Chu,
	Bean Huo, Asutosh Das

scsi_add_host() allocates shost->can_queue tags. ufshcd_init() sets
shost->can_queue to hba->nutrs. In other words, we know that tag values
will be in the range [0, hba->nutrs). Hence remove the checks that
verify that blk_get_request() returns a tag in this range. This check
was introduced by commit 14497328b6a6 ("scsi: ufs: verify command tag
validity").

Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Avri Altman <avri.altman@wdc.com>
Cc: Gilad Broner <gbroner@codeaurora.org>
Cc: Yaniv Gardi <ygardi@codeaurora.org>
Cc: Subhash Jadavani <subhashj@codeaurora.org>
Cc: Dolev Raviv <draviv@codeaurora.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufshcd.c | 40 ++++++---------------------------------
 1 file changed, 6 insertions(+), 34 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index fb493533c034..64a24fb7da27 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -253,11 +253,6 @@ static inline void ufshcd_wb_toggle_flush(struct ufs_hba *hba, bool enable);
 static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba);
 static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba);
 
-static inline bool ufshcd_valid_tag(struct ufs_hba *hba, int tag)
-{
-	return tag >= 0 && tag < hba->nutrs;
-}
-
 static inline void ufshcd_enable_irq(struct ufs_hba *hba)
 {
 	if (!hba->is_irq_enabled) {
@@ -2701,21 +2696,11 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i)
  */
 static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 {
+	struct ufs_hba *hba = shost_priv(host);
+	int tag = cmd->request->tag;
 	struct ufshcd_lrb *lrbp;
-	struct ufs_hba *hba;
-	int tag;
 	int err = 0;
 
-	hba = shost_priv(host);
-
-	tag = cmd->request->tag;
-	if (!ufshcd_valid_tag(hba, tag)) {
-		dev_err(hba->dev,
-			"%s: invalid command tag %d: cmd=0x%p, cmd->request=0x%p",
-			__func__, tag, cmd, cmd->request);
-		BUG();
-	}
-
 	if (!down_read_trylock(&hba->clk_scaling_lock))
 		return SCSI_MLQUEUE_HOST_BUSY;
 
@@ -2968,7 +2953,6 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
 		goto out_unlock;
 	}
 	tag = req->tag;
-	WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag));
 
 	if (unlikely(test_bit(tag, &hba->outstanding_reqs))) {
 		err = -EBUSY;
@@ -6675,7 +6659,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
 		goto out_unlock;
 	}
 	tag = req->tag;
-	WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag));
 
 	if (unlikely(test_bit(tag, &hba->outstanding_reqs))) {
 		err = -EBUSY;
@@ -6978,25 +6961,14 @@ static int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag)
  */
 static int ufshcd_abort(struct scsi_cmnd *cmd)
 {
-	struct Scsi_Host *host;
-	struct ufs_hba *hba;
+	struct Scsi_Host *host = cmd->device->host;
+	struct ufs_hba *hba = shost_priv(host);
+	unsigned int tag = cmd->request->tag;
+	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
 	unsigned long flags;
-	unsigned int tag;
 	int err = 0;
-	struct ufshcd_lrb *lrbp;
 	u32 reg;
 
-	host = cmd->device->host;
-	hba = shost_priv(host);
-	tag = cmd->request->tag;
-	lrbp = &hba->lrb[tag];
-	if (!ufshcd_valid_tag(hba, tag)) {
-		dev_err(hba->dev,
-			"%s: invalid command tag %d: cmd=0x%p, cmd->request=0x%p",
-			__func__, tag, cmd, cmd->request);
-		BUG();
-	}
-
 	ufshcd_hold(hba, false);
 	reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
 	/* If command is already aborted/completed, return SUCCESS */

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation
  2021-06-24 23:29 ` [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation Bart Van Assche
@ 2021-06-25 10:27   ` Bean Huo
  2021-06-25 12:36   ` Bean Huo
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Bean Huo @ 2021-06-25 10:27 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Jaegeuk Kim, Adrian Hunter, Stanley Chu, Can Guo,
	Asutosh Das, Avri Altman, Pedro Sousa, James E.J. Bottomley,
	Matthias Brugger, Bean Huo, Bjorn Andersson, Sergey Shtylyov,
	Yue Hu, Kiwoong Kim

On Thu, 2021-06-24 at 16:29 -0700, Bart Van Assche wrote:
> Move the dev_get_drvdata() calls into the ufshcd_{system,runtime}_*()
> 
> functions. Remove ufshcd_runtime_idle() since it is empty. This patch
> 
> does not change any functionality.
> 
> 
> 
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> 
> Cc: Stanley Chu <stanley.chu@mediatek.com>
> 
> Cc: Can Guo <cang@codeaurora.org>
> 
> Cc: Asutosh Das <asutoshd@codeaurora.org>
> 
> Cc: Avri Altman <avri.altman@wdc.com>
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

looks good to me.

Reviewed-by: Bean Huo <beanhuo@micron.com>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] ufs: Rename the second ufshcd_probe_hba() argument
  2021-06-24 23:29 ` [PATCH v2 2/3] ufs: Rename the second ufshcd_probe_hba() argument Bart Van Assche
@ 2021-06-25 10:36   ` Bean Huo
  0 siblings, 0 replies; 10+ messages in thread
From: Bean Huo @ 2021-06-25 10:36 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Jaegeuk Kim, Avri Altman, Bean Huo, Asutosh Das,
	Can Guo, James E.J. Bottomley, Stanley Chu

On Thu, 2021-06-24 at 16:29 -0700, Bart Van Assche wrote:
> Rename the second argument of ufshcd_probe_hba() such that the name
> of
> 
> that argument reflects its purpose instead of how the function is
> called.
> 
> See also commit 1b9e21412f72 ("scsi: ufs: Split ufshcd_probe_hba()
> based
> 
> on its called flow").
> 
> 
> 
> Reviewed-by: Avri Altman <avri.altman@wdc.com>
> 
> Cc: Bean Huo <beanhuo@micron.com>
> 
> Cc: Asutosh Das <asutoshd@codeaurora.org>
> 
> Cc: Can Guo <cang@codeaurora.org>
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Thanks for change.

Reviewed-by: Bean Huo <beanhuo@micron.com>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation
  2021-06-24 23:29 ` [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation Bart Van Assche
  2021-06-25 10:27   ` Bean Huo
@ 2021-06-25 12:36   ` Bean Huo
  2021-06-25 14:27     ` kernel test robot
  2021-06-25 20:39   ` kernel test robot
  3 siblings, 0 replies; 10+ messages in thread
From: Bean Huo @ 2021-06-25 12:36 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Jaegeuk Kim, Adrian Hunter, Stanley Chu, Can Guo,
	Asutosh Das, Avri Altman, Pedro Sousa, James E.J. Bottomley,
	Matthias Brugger, Bean Huo, Bjorn Andersson, Sergey Shtylyov,
	Yue Hu, Kiwoong Kim

On Thu, 2021-06-24 at 16:29 -0700, Bart Van Assche wrote:
>  static const struct dev_pm_ops tc_dwc_g210_pci_pm_ops = {
> 
> -       .suspend        = tc_dwc_g210_pci_suspend,
> 
> -       .resume         = tc_dwc_g210_pci_resume,
> 
> -       .runtime_suspend = tc_dwc_g210_pci_runtime_suspend,
> 
> -       .runtime_resume  = tc_dwc_g210_pci_runtime_resume,
> 
> -       .runtime_idle    = tc_dwc_g210_pci_runtime_idle,
> 
> +       .suspend         = ufshcd_system_suspend,
> 
> +       .resume          = ufshcd_system_resume,
> 
> +       .runtime_suspend = ufshcd_runtime_suspend,
> 
> +       .runtime_resume  = ufshcd_runtime_resume,
> 
>         .prepare         = ufshcd_suspend_prepare,
> 
>         .complete        = ufshcd_resume_complete,

Hi Bart,
you need to update this patch since you forgot to change the vendor's
driver.


drivers/scsi/ufs/cdns-pltfrm.c
drivers/scsi/ufs/tc-dwc-g210-pltfrm.c
drivers/scsi/ufs/ufs-exynos.c
drivers/scsi/ufs/ufs-hisi.c
drivers/scsi/ufs/ufs-mediatek.c
drivers/scsi/ufs/ufs-qcom.c


Bean


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation
  2021-06-24 23:29 ` [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation Bart Van Assche
@ 2021-06-25 14:27     ` kernel test robot
  2021-06-25 12:36   ` Bean Huo
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-06-25 14:27 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: kbuild-all, linux-scsi, Jaegeuk Kim, Bart Van Assche,
	Adrian Hunter, Stanley Chu, Can Guo, Asutosh Das, Avri Altman,
	Pedro Sousa

[-- Attachment #1: Type: text/plain, Size: 1924 bytes --]

Hi Bart,

I love your patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20210625]
[cannot apply to scsi/for-next bvanassche/for-next v5.13-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Bart-Van-Assche/UFS-patches-for-Linux-kernel-v5-14/20210625-073154
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a013-20210622 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/b5e451996a357bcf0940e038b6812f7d18fa4146
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Bart-Van-Assche/UFS-patches-for-Linux-kernel-v5-14/20210625-073154
        git checkout b5e451996a357bcf0940e038b6812f7d18fa4146
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0x30): undefined reference to `ufshcd_pltfrm_suspend'
>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0x38): undefined reference to `ufshcd_pltfrm_resume'
>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0xc0): undefined reference to `ufshcd_pltfrm_runtime_suspend'
>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0xc8): undefined reference to `ufshcd_pltfrm_runtime_resume'
>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0xd0): undefined reference to `ufshcd_pltfrm_runtime_idle'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41107 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation
@ 2021-06-25 14:27     ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-06-25 14:27 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

Hi Bart,

I love your patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20210625]
[cannot apply to scsi/for-next bvanassche/for-next v5.13-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Bart-Van-Assche/UFS-patches-for-Linux-kernel-v5-14/20210625-073154
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a013-20210622 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/b5e451996a357bcf0940e038b6812f7d18fa4146
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Bart-Van-Assche/UFS-patches-for-Linux-kernel-v5-14/20210625-073154
        git checkout b5e451996a357bcf0940e038b6812f7d18fa4146
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0x30): undefined reference to `ufshcd_pltfrm_suspend'
>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0x38): undefined reference to `ufshcd_pltfrm_resume'
>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0xc0): undefined reference to `ufshcd_pltfrm_runtime_suspend'
>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0xc8): undefined reference to `ufshcd_pltfrm_runtime_resume'
>> ld: drivers/scsi/ufs/cdns-pltfrm.o:(.rodata+0xd0): undefined reference to `ufshcd_pltfrm_runtime_idle'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41107 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation
  2021-06-24 23:29 ` [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation Bart Van Assche
                     ` (2 preceding siblings ...)
  2021-06-25 14:27     ` kernel test robot
@ 2021-06-25 20:39   ` kernel test robot
  3 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-06-25 20:39 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4568 bytes --]

Hi Bart,

I love your patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on next-20210625]
[cannot apply to scsi/for-next bvanassche/for-next v5.13-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Bart-Van-Assche/UFS-patches-for-Linux-kernel-v5-14/20210625-073154
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/b5e451996a357bcf0940e038b6812f7d18fa4146
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Bart-Van-Assche/UFS-patches-for-Linux-kernel-v5-14/20210625-073154
        git checkout b5e451996a357bcf0940e038b6812f7d18fa4146
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> powerpc64-linux-ld: drivers/scsi/ufs/tc-dwc-g210-pltfrm.o:(.data.rel.ro.tc_dwc_g210_pltfm_pm_ops+0x18): undefined reference to `ufshcd_pltfrm_resume'
>> powerpc64-linux-ld: drivers/scsi/ufs/tc-dwc-g210-pltfrm.o:(.data.rel.ro.tc_dwc_g210_pltfm_pm_ops+0x58): undefined reference to `ufshcd_pltfrm_suspend'
>> powerpc64-linux-ld: drivers/scsi/ufs/tc-dwc-g210-pltfrm.o:(.data.rel.ro.tc_dwc_g210_pltfm_pm_ops+0x88): undefined reference to `ufshcd_pltfrm_runtime_idle'
>> powerpc64-linux-ld: drivers/scsi/ufs/tc-dwc-g210-pltfrm.o:(.data.rel.ro.tc_dwc_g210_pltfm_pm_ops+0x98): undefined reference to `ufshcd_pltfrm_runtime_resume'
>> powerpc64-linux-ld: drivers/scsi/ufs/tc-dwc-g210-pltfrm.o:(.data.rel.ro.tc_dwc_g210_pltfm_pm_ops+0xa8): undefined reference to `ufshcd_pltfrm_runtime_suspend'
>> powerpc64-linux-ld: drivers/scsi/ufs/cdns-pltfrm.o:(.data.rel.ro.cdns_ufs_dev_pm_ops+0x18): undefined reference to `ufshcd_pltfrm_resume'
>> powerpc64-linux-ld: drivers/scsi/ufs/cdns-pltfrm.o:(.data.rel.ro.cdns_ufs_dev_pm_ops+0x58): undefined reference to `ufshcd_pltfrm_suspend'
>> powerpc64-linux-ld: drivers/scsi/ufs/cdns-pltfrm.o:(.data.rel.ro.cdns_ufs_dev_pm_ops+0x88): undefined reference to `ufshcd_pltfrm_runtime_idle'
>> powerpc64-linux-ld: drivers/scsi/ufs/cdns-pltfrm.o:(.data.rel.ro.cdns_ufs_dev_pm_ops+0x98): undefined reference to `ufshcd_pltfrm_runtime_resume'
>> powerpc64-linux-ld: drivers/scsi/ufs/cdns-pltfrm.o:(.data.rel.ro.cdns_ufs_dev_pm_ops+0xa8): undefined reference to `ufshcd_pltfrm_runtime_suspend'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-exynos.o:(.data.rel.ro.exynos_ufs_pm_ops+0x18): undefined reference to `ufshcd_pltfrm_resume'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-exynos.o:(.data.rel.ro.exynos_ufs_pm_ops+0x58): undefined reference to `ufshcd_pltfrm_suspend'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-exynos.o:(.data.rel.ro.exynos_ufs_pm_ops+0x88): undefined reference to `ufshcd_pltfrm_runtime_idle'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-exynos.o:(.data.rel.ro.exynos_ufs_pm_ops+0x98): undefined reference to `ufshcd_pltfrm_runtime_resume'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-exynos.o:(.data.rel.ro.exynos_ufs_pm_ops+0xa8): undefined reference to `ufshcd_pltfrm_runtime_suspend'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-hisi.o:(.data.rel.ro.ufs_hisi_pm_ops+0x18): undefined reference to `ufshcd_pltfrm_resume'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-hisi.o:(.data.rel.ro.ufs_hisi_pm_ops+0x58): undefined reference to `ufshcd_pltfrm_suspend'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-hisi.o:(.data.rel.ro.ufs_hisi_pm_ops+0x88): undefined reference to `ufshcd_pltfrm_runtime_idle'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-hisi.o:(.data.rel.ro.ufs_hisi_pm_ops+0x98): undefined reference to `ufshcd_pltfrm_runtime_resume'
>> powerpc64-linux-ld: drivers/scsi/ufs/ufs-hisi.o:(.data.rel.ro.ufs_hisi_pm_ops+0xa8): undefined reference to `ufshcd_pltfrm_runtime_suspend'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 73411 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-25 20:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 23:29 [PATCH v2 0/3] UFS patches for Linux kernel v5.14 Bart Van Assche
2021-06-24 23:29 ` [PATCH v2 1/3] ufs: Reduce code duplication in the runtime power managment implementation Bart Van Assche
2021-06-25 10:27   ` Bean Huo
2021-06-25 12:36   ` Bean Huo
2021-06-25 14:27   ` kernel test robot
2021-06-25 14:27     ` kernel test robot
2021-06-25 20:39   ` kernel test robot
2021-06-24 23:29 ` [PATCH v2 2/3] ufs: Rename the second ufshcd_probe_hba() argument Bart Van Assche
2021-06-25 10:36   ` Bean Huo
2021-06-24 23:29 ` [PATCH v2 3/3] ufs: Remove ufshcd_valid_tag() Bart Van Assche

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.