lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 15 Dec 2020 09:33:49 -0800
From:   "Asutosh Das (asd)" <asutoshd@...eaurora.org>
To:     Stanley Chu <stanley.chu@...iatek.com>, linux-scsi@...r.kernel.org,
        martin.petersen@...cle.com, avri.altman@....com,
        alim.akhtar@...sung.com, jejb@...ux.ibm.com
Cc:     beanhuo@...ron.com, cang@...eaurora.org, matthias.bgg@...il.com,
        bvanassche@....org, linux-mediatek@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        nguyenb@...eaurora.org, bjorn.andersson@...aro.org,
        kuohong.wang@...iatek.com, peter.wang@...iatek.com,
        chun-hung.wu@...iatek.com, andy.teng@...iatek.com,
        chaotian.jing@...iatek.com, cc.chou@...iatek.com,
        jiajie.hao@...iatek.com, alice.chao@...iatek.com
Subject: Re: [PATCH v2 2/2] scsi: ufs: Uninline ufshcd_vops_device_reset
 function

On 12/8/2020 5:56 AM, Stanley Chu wrote:
> Since more and more statements showing up in ufshcd_vops_device_reset(),
> uninline it to allow compiler making possibly better optimization.
> 
> Signed-off-by: Stanley Chu <stanley.chu@...iatek.com>
> ---

Reviewed-by: Asutosh Das <asutoshd@...eaurora.org>

>   drivers/scsi/ufs/ufshcd.c | 27 ++++++++++++++++++++++-----
>   drivers/scsi/ufs/ufshcd.h | 19 +++++--------------
>   2 files changed, 27 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index c1c401b2b69d..b2ca1a6ad426 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -580,6 +580,23 @@ static void ufshcd_print_pwr_info(struct ufs_hba *hba)
>   		 hba->pwr_info.hs_rate);
>   }
>   
> +static void ufshcd_device_reset(struct ufs_hba *hba)
> +{
> +	int err;
> +
> +	err = ufshcd_vops_device_reset(hba);
> +
> +	if (!err) {
> +		ufshcd_set_ufs_dev_active(hba);
> +		if (ufshcd_is_wb_allowed(hba)) {
> +			hba->wb_enabled = false;
> +			hba->wb_buf_flush_enabled = false;
> +		}
> +	}
> +	if (err != -EOPNOTSUPP)
> +		ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err);
> +}
> +
>   void ufshcd_delay_us(unsigned long us, unsigned long tolerance)
>   {
>   	if (!us)
> @@ -3932,7 +3949,7 @@ int ufshcd_link_recovery(struct ufs_hba *hba)
>   	spin_unlock_irqrestore(hba->host->host_lock, flags);
>   
>   	/* Reset the attached device */
> -	ufshcd_vops_device_reset(hba);
> +	ufshcd_device_reset(hba);
>   
>   	ret = ufshcd_host_reset_and_restore(hba);
>   
> @@ -6933,7 +6950,7 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba)
>   
>   	do {
>   		/* Reset the attached device */
> -		ufshcd_vops_device_reset(hba);
> +		ufshcd_device_reset(hba);
>   
>   		err = ufshcd_host_reset_and_restore(hba);
>   	} while (err && --retries);
> @@ -8712,7 +8729,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
>   	 * further below.
>   	 */
>   	if (ufshcd_is_ufs_dev_deepsleep(hba)) {
> -		ufshcd_vops_device_reset(hba);
> +		ufshcd_device_reset(hba);
>   		WARN_ON(!ufshcd_is_link_off(hba));
>   	}
>   	if (ufshcd_is_link_hibern8(hba) && !ufshcd_uic_hibern8_exit(hba))
> @@ -8722,7 +8739,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
>   set_dev_active:
>   	/* Can also get here needing to exit DeepSleep */
>   	if (ufshcd_is_ufs_dev_deepsleep(hba)) {
> -		ufshcd_vops_device_reset(hba);
> +		ufshcd_device_reset(hba);
>   		ufshcd_host_reset_and_restore(hba);
>   	}
>   	if (!ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE))
> @@ -9321,7 +9338,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
>   	}
>   
>   	/* Reset the attached device */
> -	ufshcd_vops_device_reset(hba);
> +	ufshcd_device_reset(hba);
>   
>   	ufshcd_init_crypto(hba);
>   
> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
> index 36d367eb8139..9bb5f0ed4124 100644
> --- a/drivers/scsi/ufs/ufshcd.h
> +++ b/drivers/scsi/ufs/ufshcd.h
> @@ -1216,21 +1216,12 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
>   		hba->vops->dbg_register_dump(hba);
>   }
>   
> -static inline void ufshcd_vops_device_reset(struct ufs_hba *hba)
> +static inline int ufshcd_vops_device_reset(struct ufs_hba *hba)
>   {
> -	if (hba->vops && hba->vops->device_reset) {
> -		int err = hba->vops->device_reset(hba);
> -
> -		if (!err) {
> -			ufshcd_set_ufs_dev_active(hba);
> -			if (ufshcd_is_wb_allowed(hba)) {
> -				hba->wb_enabled = false;
> -				hba->wb_buf_flush_enabled = false;
> -			}
> -		}
> -		if (err != -EOPNOTSUPP)
> -			ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err);
> -	}
> +	if (hba->vops && hba->vops->device_reset)
> +		return hba->vops->device_reset(hba);
> +
> +	return -EOPNOTSUPP;
>   }
>   
>   static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
> 


-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
Linux Foundation Collaborative Project

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ