diff mbox series

[v2,6/9] scsi: ufs: Delete is_init_prefetch from struct ufs_hba

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

Commit Message

Bean Huo Jan. 16, 2020, 9:59 p.m. UTC
From: Bean Huo <beanhuo@micron.com>

Without variable is_init_prefetch, the current logic can guarantee
ufshcd_init_icc_levels() will execute only once, delete it now.

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/scsi/ufs/ufshcd.c | 5 +----
 drivers/scsi/ufs/ufshcd.h | 2 --
 2 files changed, 1 insertion(+), 6 deletions(-)

Comments

Bart Van Assche Jan. 17, 2020, 4 a.m. UTC | #1
On 2020-01-16 13:59, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
> 
> Without variable is_init_prefetch, the current logic can guarantee
> ufshcd_init_icc_levels() will execute only once, delete it now.
> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 5 +----
>  drivers/scsi/ufs/ufshcd.h | 2 --
>  2 files changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 44b7c0a44b8d..31b6e2a7c166 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6967,8 +6967,7 @@ static int ufs_lu_add(struct ufs_hba *hba)
>  {
>  	int ret;
>  
> -	if (!hba->is_init_prefetch)
> -		ufshcd_init_icc_levels(hba);
> +	ufshcd_init_icc_levels(hba);
>  
>  	/* Add required well known logical units to scsi mid layer */
>  	ret = ufshcd_scsi_add_wlus(hba);
> @@ -6994,8 +6993,6 @@ static int ufs_lu_add(struct ufs_hba *hba)
>  	scsi_scan_host(hba->host);
>  	pm_runtime_put_sync(hba->dev);
>  
> -	if (!hba->is_init_prefetch)
> -		hba->is_init_prefetch = true;
>  out:
>  	return ret;
>  }

The current code calls ufshcd_init_icc_levels() once per HBA. This patch
changes that into one call per LUN. It seems like the patch description
contradicts the code I see above.

Thanks,

Bart.
Bean Huo Jan. 17, 2020, 1:12 p.m. UTC | #2
Hi, Bart

> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index 44b7c0a44b8d..31b6e2a7c166 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -6967,8 +6967,7 @@ static int ufs_lu_add(struct ufs_hba *hba)  {
> >  	int ret;
> >
> > -	if (!hba->is_init_prefetch)
> > -		ufshcd_init_icc_levels(hba);
> > +	ufshcd_init_icc_levels(hba);
> >
> >  	/* Add required well known logical units to scsi mid layer */
> >  	ret = ufshcd_scsi_add_wlus(hba);
> > @@ -6994,8 +6993,6 @@ static int ufs_lu_add(struct ufs_hba *hba)
> >  	scsi_scan_host(hba->host);
> >  	pm_runtime_put_sync(hba->dev);
> >
> > -	if (!hba->is_init_prefetch)
> > -		hba->is_init_prefetch = true;
> >  out:
> >  	return ret;
> >  }
> 
> The current code calls ufshcd_init_icc_levels() once per HBA. This patch changes
> that into one call per LUN. It seems like the patch description contradicts the
> code I see above.
> 
No, it is still called once per HBA.  The current UFS driver doesn't have per LU initialization path.
After this patch, the path likes this:

ufshcd_pltfrm_init(pdev, of_id->data);
	ufshcd_init(hba, mmio_base, irq);
		ufshcd_async_scan()
			ufs_lu_add()-->ufshcd_init_icc_levels()
	
I should change ufs_lu_add() name to ufs_lus_add(), will make it clearer.

//Bean
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 44b7c0a44b8d..31b6e2a7c166 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6967,8 +6967,7 @@  static int ufs_lu_add(struct ufs_hba *hba)
 {
 	int ret;
 
-	if (!hba->is_init_prefetch)
-		ufshcd_init_icc_levels(hba);
+	ufshcd_init_icc_levels(hba);
 
 	/* Add required well known logical units to scsi mid layer */
 	ret = ufshcd_scsi_add_wlus(hba);
@@ -6994,8 +6993,6 @@  static int ufs_lu_add(struct ufs_hba *hba)
 	scsi_scan_host(hba->host);
 	pm_runtime_put_sync(hba->dev);
 
-	if (!hba->is_init_prefetch)
-		hba->is_init_prefetch = true;
 out:
 	return ret;
 }
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 32b6714f25a5..5c65d9fdeb14 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -501,7 +501,6 @@  struct ufs_stats {
  * @intr_mask: Interrupt Mask Bits
  * @ee_ctrl_mask: Exception event control mask
  * @is_powered: flag to check if HBA is powered
- * @is_init_prefetch: flag to check if data was pre-fetched in initialization
  * @init_prefetch_data: data pre-fetched during initialization
  * @eh_work: Worker to handle UFS errors that require s/w attention
  * @eeh_work: Worker to handle exception events
@@ -652,7 +651,6 @@  struct ufs_hba {
 	u32 intr_mask;
 	u16 ee_ctrl_mask;
 	bool is_powered;
-	bool is_init_prefetch;
 	struct ufs_init_prefetch init_prefetch_data;
 
 	/* Work Queues */