diff mbox series

[v3,4/8] scsi: ufs: move ufshcd_get_max_pwr_mode() to ufs_init_params()

Message ID 20200119001327.29155-5-huobean@gmail.com (mailing list archive)
State Superseded
Headers show
Series Use UFS device indicated maximum LU number | expand

Commit Message

Bean Huo Jan. 19, 2020, 12:13 a.m. UTC
From: Bean Huo <beanhuo@micron.com>

ufshcd_get_max_pwr_mode() only need to be called once while booting,
take it out from ufshcd_probe_hba() and inline into ufshcd_init_params().

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/scsi/ufs/ufshcd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Alim Akhtar Jan. 19, 2020, 1:47 a.m. UTC | #1
On Sun, Jan 19, 2020 at 5:44 AM Bean Huo <huobean@gmail.com> wrote:
>
> From: Bean Huo <beanhuo@micron.com>
>
> ufshcd_get_max_pwr_mode() only need to be called once while booting,
> take it out from ufshcd_probe_hba() and inline into ufshcd_init_params().
>
This can be safely squash with the previous patch which introduce
ufshcd_init_params.

> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 54c127ef360b..925b31dc3110 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6959,6 +6959,11 @@ static int ufshcd_init_params(struct ufs_hba *hba)
>                         QUERY_FLAG_IDN_PWR_ON_WPE, &flag))
>                 hba->dev_info.f_power_on_wp_en = flag;
>
> +       /* Probe maximum power mode co-supported by both UFS host and device */
> +       if (ufshcd_get_max_pwr_mode(hba))
> +               dev_err(hba->dev,
> +                       "%s: Failed getting max supported power mode\n",
> +                       __func__);
>  out:
>         return ret;
>  }
> @@ -7057,11 +7062,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async)
>         ufshcd_force_reset_auto_bkops(hba);
>         hba->wlun_dev_clr_ua = true;
>
> -       if (ufshcd_get_max_pwr_mode(hba)) {
> -               dev_err(hba->dev,
> -                       "%s: Failed getting max supported power mode\n",
> -                       __func__);
> -       } else {
> +       /* Gear up to HS gear if supported */
> +       if (hba->max_pwr_info.is_valid) {
>                 /*
>                  * Set the right value to bRefClkFreq before attempting to
>                  * switch to HS gears.
> --
> 2.17.1
>
Stanley Chu Jan. 19, 2020, 9:57 a.m. UTC | #2
On Sun, 2020-01-19 at 01:13 +0100, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
> 
> ufshcd_get_max_pwr_mode() only need to be called once while booting,
> take it out from ufshcd_probe_hba() and inline into ufshcd_init_params().
> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Bean Huo Jan. 19, 2020, 10:21 p.m. UTC | #3
Hi, Alim

> > From: Bean Huo <beanhuo@micron.com>
> >
> > ufshcd_get_max_pwr_mode() only need to be called once while booting,
> > take it out from ufshcd_probe_hba() and inline into ufshcd_init_params().
> >
> This can be safely squash with the previous patch which introduce
> ufshcd_init_params.
>

I kept this patch because I want you to review the patch easily. The previous patch is exactly to
split ufshcd_probe_hba(), doesn't want to do any initialization path flow changing. If I merge this
patch to the previous one, that will disorder the original calling process, and some reviewers will
have more concern about previous patch.

kept them independently, for the previous patch, you only need to check its split-up validity.


Thanks,

//Bean
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 54c127ef360b..925b31dc3110 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6959,6 +6959,11 @@  static int ufshcd_init_params(struct ufs_hba *hba)
 			QUERY_FLAG_IDN_PWR_ON_WPE, &flag))
 		hba->dev_info.f_power_on_wp_en = flag;
 
+	/* Probe maximum power mode co-supported by both UFS host and device */
+	if (ufshcd_get_max_pwr_mode(hba))
+		dev_err(hba->dev,
+			"%s: Failed getting max supported power mode\n",
+			__func__);
 out:
 	return ret;
 }
@@ -7057,11 +7062,8 @@  static int ufshcd_probe_hba(struct ufs_hba *hba, bool async)
 	ufshcd_force_reset_auto_bkops(hba);
 	hba->wlun_dev_clr_ua = true;
 
-	if (ufshcd_get_max_pwr_mode(hba)) {
-		dev_err(hba->dev,
-			"%s: Failed getting max supported power mode\n",
-			__func__);
-	} else {
+	/* Gear up to HS gear if supported */
+	if (hba->max_pwr_info.is_valid) {
 		/*
 		 * Set the right value to bRefClkFreq before attempting to
 		 * switch to HS gears.