linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop
@ 2020-12-05 12:00 Stanley Chu
  2020-12-05 12:00 ` [PATCH v1 1/4] scsi: ufs: Remove unused setup_regulators variant function Stanley Chu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Stanley Chu @ 2020-12-05 12:00 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
  Cc: beanhuo, asutoshd, cang, matthias.bgg, bvanassche,
	linux-mediatek, linux-arm-kernel, linux-kernel, kuohong.wang,
	peter.wang, chun-hung.wu, andy.teng, chaotian.jing, cc.chou,
	jiajie.hao, alice.chao, Stanley Chu

Hi,
This series simply cleans up UFS vops and shall not change any functionality.

Stanley Chu (4):
  scsi: ufs: Remove unused setup_regulators variant function
  scsi: ufs: Introduce phy_initialization helper
  scsi: ufs-cdns: Use phy_initialization helper
  scsi: ufs-dwc: Use phy_initialization helper

 drivers/scsi/ufs/cdns-pltfrm.c |  3 +--
 drivers/scsi/ufs/ufshcd-dwc.c  | 11 ++++-------
 drivers/scsi/ufs/ufshcd.c      | 10 +---------
 drivers/scsi/ufs/ufshcd.h      | 18 ++++++++----------
 4 files changed, 14 insertions(+), 28 deletions(-)

-- 
2.18.0


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

* [PATCH v1 1/4] scsi: ufs: Remove unused setup_regulators variant function
  2020-12-05 12:00 [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Stanley Chu
@ 2020-12-05 12:00 ` Stanley Chu
  2020-12-05 12:00 ` [PATCH v1 2/4] scsi: ufs: Introduce phy_initialization helper Stanley Chu
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stanley Chu @ 2020-12-05 12:00 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
  Cc: beanhuo, asutoshd, cang, matthias.bgg, bvanassche,
	linux-mediatek, linux-arm-kernel, linux-kernel, kuohong.wang,
	peter.wang, chun-hung.wu, andy.teng, chaotian.jing, cc.chou,
	jiajie.hao, alice.chao, Stanley Chu

Since setup_regulators variant function is not used by any
vendors, simply remove it.

Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.c | 10 +---------
 drivers/scsi/ufs/ufshcd.h | 10 ----------
 2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 11a4aad09f3a..c2f611516ea7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8171,16 +8171,10 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
 		goto out;
 
 	err = ufshcd_vops_init(hba);
-	if (err)
-		goto out;
-
-	err = ufshcd_vops_setup_regulators(hba, true);
-	if (err)
-		ufshcd_vops_exit(hba);
-out:
 	if (err)
 		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
 			__func__, ufshcd_get_var_name(hba), err);
+out:
 	return err;
 }
 
@@ -8189,8 +8183,6 @@ static void ufshcd_variant_hba_exit(struct ufs_hba *hba)
 	if (!hba->vops)
 		return;
 
-	ufshcd_vops_setup_regulators(hba, false);
-
 	ufshcd_vops_exit(hba);
 }
 
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 7a7e056a33a9..21de7607611f 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -277,7 +277,6 @@ struct ufs_pwr_mode_info {
  * @get_ufs_hci_version: called to get UFS HCI version
  * @clk_scale_notify: notifies that clks are scaled up/down
  * @setup_clocks: called before touching any of the controller registers
- * @setup_regulators: called before accessing the host controller
  * @hce_enable_notify: called before and after HCE enable bit is set to allow
  *                     variant specific Uni-Pro initialization.
  * @link_startup_notify: called before and after Link startup is carried out
@@ -307,7 +306,6 @@ struct ufs_hba_variant_ops {
 				    enum ufs_notify_change_status);
 	int	(*setup_clocks)(struct ufs_hba *, bool,
 				enum ufs_notify_change_status);
-	int     (*setup_regulators)(struct ufs_hba *, bool);
 	int	(*hce_enable_notify)(struct ufs_hba *,
 				     enum ufs_notify_change_status);
 	int	(*link_startup_notify)(struct ufs_hba *,
@@ -1119,14 +1117,6 @@ static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on,
 	return 0;
 }
 
-static inline int ufshcd_vops_setup_regulators(struct ufs_hba *hba, bool status)
-{
-	if (hba->vops && hba->vops->setup_regulators)
-		return hba->vops->setup_regulators(hba, status);
-
-	return 0;
-}
-
 static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba,
 						bool status)
 {
-- 
2.18.0


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

* [PATCH v1 2/4] scsi: ufs: Introduce phy_initialization helper
  2020-12-05 12:00 [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Stanley Chu
  2020-12-05 12:00 ` [PATCH v1 1/4] scsi: ufs: Remove unused setup_regulators variant function Stanley Chu
@ 2020-12-05 12:00 ` Stanley Chu
  2020-12-05 12:00 ` [PATCH v1 3/4] scsi: ufs-cdns: Use " Stanley Chu
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stanley Chu @ 2020-12-05 12:00 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
  Cc: beanhuo, asutoshd, cang, matthias.bgg, bvanassche,
	linux-mediatek, linux-arm-kernel, linux-kernel, kuohong.wang,
	peter.wang, chun-hung.wu, andy.teng, chaotian.jing, cc.chou,
	jiajie.hao, alice.chao, Stanley Chu

Introduce phy_initialization helper since this is the only
one variant function without helper.

Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 21de7607611f..384a042ccb46 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -1134,6 +1134,14 @@ static inline int ufshcd_vops_link_startup_notify(struct ufs_hba *hba,
 	return 0;
 }
 
+static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba)
+{
+	if (hba->vops && hba->vops->phy_initialization)
+		return hba->vops->phy_initialization(hba);
+
+	return 0;
+}
+
 static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
 				  bool status,
 				  struct ufs_pa_layer_attr *dev_max_params,
-- 
2.18.0


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

* [PATCH v1 3/4] scsi: ufs-cdns: Use phy_initialization helper
  2020-12-05 12:00 [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Stanley Chu
  2020-12-05 12:00 ` [PATCH v1 1/4] scsi: ufs: Remove unused setup_regulators variant function Stanley Chu
  2020-12-05 12:00 ` [PATCH v1 2/4] scsi: ufs: Introduce phy_initialization helper Stanley Chu
@ 2020-12-05 12:00 ` Stanley Chu
  2020-12-05 12:00 ` [PATCH v1 4/4] scsi: ufs-dwc: " Stanley Chu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Stanley Chu @ 2020-12-05 12:00 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
  Cc: beanhuo, asutoshd, cang, matthias.bgg, bvanassche,
	linux-mediatek, linux-arm-kernel, linux-kernel, kuohong.wang,
	peter.wang, chun-hung.wu, andy.teng, chaotian.jing, cc.chou,
	jiajie.hao, alice.chao, Stanley Chu

Use phy_initialization helper instead of direct function invoking.

Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/cdns-pltfrm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c
index da065a259f6e..149391faa19c 100644
--- a/drivers/scsi/ufs/cdns-pltfrm.c
+++ b/drivers/scsi/ufs/cdns-pltfrm.c
@@ -221,8 +221,7 @@ static int cdns_ufs_init(struct ufs_hba *hba)
 		return -ENOMEM;
 	ufshcd_set_variant(hba, host);
 
-	if (hba->vops && hba->vops->phy_initialization)
-		status = hba->vops->phy_initialization(hba);
+	status = ufshcd_vops_phy_initialization(hba);
 
 	return status;
 }
-- 
2.18.0


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

* [PATCH v1 4/4] scsi: ufs-dwc: Use phy_initialization helper
  2020-12-05 12:00 [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Stanley Chu
                   ` (2 preceding siblings ...)
  2020-12-05 12:00 ` [PATCH v1 3/4] scsi: ufs-cdns: Use " Stanley Chu
@ 2020-12-05 12:00 ` Stanley Chu
  2020-12-07 23:09 ` [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Martin K. Petersen
  2020-12-09 17:23 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Stanley Chu @ 2020-12-05 12:00 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
  Cc: beanhuo, asutoshd, cang, matthias.bgg, bvanassche,
	linux-mediatek, linux-arm-kernel, linux-kernel, kuohong.wang,
	peter.wang, chun-hung.wu, andy.teng, chaotian.jing, cc.chou,
	jiajie.hao, alice.chao, Stanley Chu

Use phy_initialization helper instead of direct invoking.

Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd-dwc.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd-dwc.c b/drivers/scsi/ufs/ufshcd-dwc.c
index 6a901da2d15a..5bb9d3a88795 100644
--- a/drivers/scsi/ufs/ufshcd-dwc.c
+++ b/drivers/scsi/ufs/ufshcd-dwc.c
@@ -120,13 +120,10 @@ int ufshcd_dwc_link_startup_notify(struct ufs_hba *hba,
 	if (status == PRE_CHANGE) {
 		ufshcd_dwc_program_clk_div(hba, DWC_UFS_REG_HCLKDIV_DIV_125);
 
-		if (hba->vops->phy_initialization) {
-			err = hba->vops->phy_initialization(hba);
-			if (err) {
-				dev_err(hba->dev, "Phy setup failed (%d)\n",
-									err);
-				goto out;
-			}
+		err = ufshcd_vops_phy_initialization(hba);
+		if (err) {
+			dev_err(hba->dev, "Phy setup failed (%d)\n", err);
+			goto out;
 		}
 	} else { /* POST_CHANGE */
 		err = ufshcd_dwc_link_is_up(hba);
-- 
2.18.0


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

* Re: [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop
  2020-12-05 12:00 [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Stanley Chu
                   ` (3 preceding siblings ...)
  2020-12-05 12:00 ` [PATCH v1 4/4] scsi: ufs-dwc: " Stanley Chu
@ 2020-12-07 23:09 ` Martin K. Petersen
  2020-12-09 17:23 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2020-12-07 23:09 UTC (permalink / raw)
  To: Stanley Chu
  Cc: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb,
	beanhuo, asutoshd, cang, matthias.bgg, bvanassche,
	linux-mediatek, linux-arm-kernel, linux-kernel, kuohong.wang,
	peter.wang, chun-hung.wu, andy.teng, chaotian.jing, cc.chou,
	jiajie.hao, alice.chao


Stanley,

> This series simply cleans up UFS vops and shall not change any
> functionality.

Applied to 5.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop
  2020-12-05 12:00 [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Stanley Chu
                   ` (4 preceding siblings ...)
  2020-12-07 23:09 ` [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Martin K. Petersen
@ 2020-12-09 17:23 ` Martin K. Petersen
  5 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2020-12-09 17:23 UTC (permalink / raw)
  To: Stanley Chu, alim.akhtar, avri.altman, linux-scsi, jejb
  Cc: Martin K . Petersen, jiajie.hao, beanhuo, cc.chou, chun-hung.wu,
	asutoshd, chaotian.jing, matthias.bgg, alice.chao,
	linux-arm-kernel, linux-kernel, andy.teng, bvanassche,
	kuohong.wang, cang, linux-mediatek, peter.wang

On Sat, 5 Dec 2020 20:00:37 +0800, Stanley Chu wrote:

> This series simply cleans up UFS vops and shall not change any functionality.
> 
> Stanley Chu (4):
>   scsi: ufs: Remove unused setup_regulators variant function
>   scsi: ufs: Introduce phy_initialization helper
>   scsi: ufs-cdns: Use phy_initialization helper
>   scsi: ufs-dwc: Use phy_initialization helper
> 
> [...]

Applied to 5.11/scsi-queue, thanks!

[1/4] scsi: ufs: Remove unused setup_regulators variant function
      https://git.kernel.org/mkp/scsi/c/ade921a891de
[2/4] scsi: ufs: Introduce phy_initialization helper
      https://git.kernel.org/mkp/scsi/c/92bcebe4b6d6
[3/4] scsi: ufs-cdns: Use phy_initialization helper
      https://git.kernel.org/mkp/scsi/c/885445736bc0
[4/4] scsi: ufs-dwc: Use phy_initialization helper
      https://git.kernel.org/mkp/scsi/c/ab98105484fc

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-12-09 17:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-05 12:00 [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Stanley Chu
2020-12-05 12:00 ` [PATCH v1 1/4] scsi: ufs: Remove unused setup_regulators variant function Stanley Chu
2020-12-05 12:00 ` [PATCH v1 2/4] scsi: ufs: Introduce phy_initialization helper Stanley Chu
2020-12-05 12:00 ` [PATCH v1 3/4] scsi: ufs-cdns: Use " Stanley Chu
2020-12-05 12:00 ` [PATCH v1 4/4] scsi: ufs-dwc: " Stanley Chu
2020-12-07 23:09 ` [PATCH v1 0/4] scsi: ufs: Cleanup phy_initialization vop Martin K. Petersen
2020-12-09 17:23 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).