make UFS dev_cmd more readable
v3 cover make UFS dev_cmd more readable
From: Bean Huo <[email protected]>
Changelog:
v2 -v3:
1. fix a coding style issue in [2/2] (Asutosh Das)
v1 - v2:
1. remove original patch scsi: ufs: differentiate dev_cmd trace message
2. add new patch scsi: ufs: remove several redundant goto statements
Bean Huo (2):
scsi: ufs: change ufshcd_comp_devman_upiu() to
ufshcd_compose_devman_upiu()
scsi: ufs: remove several redundant goto statements
drivers/scsi/ufs/ufshcd.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/2 scsi: ufs: change ufshcd_comp_devman_upiu() to ufshcd_compose_devman_upiu()
From: Bean Huo <[email protected]>
ufshcd_comp_devman_upiu() alwasy make me confuse that it is a request completion calling function. Change it to ufshcd_compose_devman_upiu().
--- drivers/scsi/ufs/ufshcd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufshcd.c +4 -3
@@ -2391,12 +2391,13 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) }/** -* ufshcd_comp_devman_upiu - UFS Protocol Information Unit(UPIU) +* ufshcd_compose_devman_upiu - UFS Protocol Information Unit(UPIU) * for Device Management Purposes * @hba: per adapter instance * @lrbp: pointer to local reference block */ -static int ufshcd_comp_devman_upiu (struct ufs_hba *hba,struct ufshcd_lrb *lrbp) +static int ufshcd_compose_devman_upiu (struct ufs_hba *hba, +struct ufshcd_lrb *lrbp) {u8 upiu_flags;int ret =0 ;
@@ -2590,7 +2591,7 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba,ufshcd_prepare_lrbp_crypto (NULL , lrbp); hba->dev_cmd.type = cmd_type; -return ufshcd_comp_devman_upiu (hba, lrbp); +return ufshcd_compose_devman_upiu (hba, lrbp); } static int
Signature · 1 line
2.17.1
Re: [PATCH v3 1/2] scsi: ufs: change ufshcd_comp_devman_upiu() to ufshcd_compose_devman_upiu()
Quoted 8 lines · Bean Huo
From: Bean Huo <[email protected]>
ufshcd_comp_devman_upiu()alwasy make me confuse that it is a request completion calling function. Change it toufshcd_compose_devman_upiu().Signed-off-by Bean Huo <[email protected]>Acked-by Avri Altman <[email protected]>---
Quoted 35 lines
drivers/scsi/ufs/ufshcd.c| 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)drivers/scsi/ufs/ufshcd.c +4
-3@@ -2391,12 +2391,13 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) }/** -* ufshcd_comp_devman_upiu - UFS Protocol Information Unit(UPIU) +* ufshcd_compose_devman_upiu - UFS Protocol Information Unit(UPIU) * for Device Management Purposes * @hba: per adapter instance * @lrbp: pointer to local reference block */ -static int ufshcd_comp_devman_upiu (struct ufs_hba *hba,struct ufshcd_lrb *lrbp) +static int ufshcd_compose_devman_upiu (struct ufs_hba *hba, +struct ufshcd_lrb *lrbp) {u8 upiu_flags;int ret =0 ;@@ -2590,7 +2591,7 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba,ufshcd_prepare_lrbp_crypto (NULL , lrbp); hba->dev_cmd.type = cmd_type; -return ufshcd_comp_devman_upiu (hba, lrbp); +return ufshcd_compose_devman_upiu (hba, lrbp); }static int
Signature · 1 line
2.17.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 1/2] scsi: ufs: change ufshcd_comp_devman_upiu() to ufshcd_compose_devman_upiu()
Quoted 10 lines · Can Guo
Hi Bean,
Quoted 7 lines · Bean Huo
From: Bean Huo <[email protected]>
ufshcd_comp_devman_upiu()alwasy make me confuse that it is a request
completion calling function. Change it toufshcd_compose_devman_upiu().
Quoted 7 lines
Quoted 2 lines
Signed-off-by Bean Huo <[email protected]>Acked-by Avri Altman <[email protected]>I gave my reviewed by tag in previous version, you missed it. Here it is
Reviewed-by Can Guo <[email protected]>
Can
nice, thanks.
Bean
Re: [PATCH v3 1/2] scsi: ufs: change ufshcd_comp_devman_upiu() to ufshcd_compose_devman_upiu()
In reply to Bean HuoQuoted 8 lines · Bean Huo
From: Bean Huo <[email protected]>
ufshcd_comp_devman_upiu()alwasy make me confuse that it is a request completion calling function. Change it toufshcd_compose_devman_upiu().Signed-off-by Bean Huo <[email protected]>Acked-by Avri Altman <[email protected]>---
PATCH v3 2/2 scsi: ufs: remove several redundant goto statements
In reply to Bean HuoFrom: Bean Huo <[email protected]>
--- drivers/scsi/ufs/ufshcd.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-)
drivers/scsi/ufs/ufshcd.c +5 -20
@@ -4256,10 +4256,8 @@ int ufshcd_make_hba_operational(struct ufs_hba *hba)dev_err (hba->dev,"Host controller not ready to process requests" ); err = -EIO ; - goto out; } -out:return err; }EXPORT_SYMBOL_GPL (ufshcd_make_hba_operational);
@@ -5542,10 +5540,8 @@ static bool ufshcd_quirk_dl_nac_errors(struct ufs_hba *hba) hba->saved_err &= ~UIC_ERROR ;/* clear NAC error */ hba->saved_uic_err &= ~UFSHCD_UIC_DL_NAC_RECEIVED_ERROR ; -if (!hba->saved_uic_err) { +if (!hba->saved_uic_err) err_handling = false; - goto out; - } } out:spin_unlock_irqrestore (hba->host->host_lock, flags);
@@ -7604,12 +7600,10 @@ static int ufshcd_config_vreg(struct device *dev,if (vreg->min_uV && vreg->max_uV) { min_uV = on ? vreg->min_uV :0 ; ret =regulator_set_voltage (reg, min_uV, vreg->max_uV); -if (ret) { +if (ret)dev_err (dev,"%s: %s set voltage failed, err=%d\n" , __func__, name, ret); - goto out; - } } } out:
@@ -7672,8 +7666,6 @@ static int ufshcd_setup_vreg(struct ufs_hba *hba, bool on) goto out; ret =ufshcd_toggle_vreg (dev, info->vccq2, on); -if (ret) - goto out; out:if (ret) {
@@ -7719,10 +7711,8 @@ static int ufshcd_init_vreg(struct ufs_hba *hba) goto out; ret =ufshcd_get_vreg (dev, info->vccq); -if (ret) - goto out; - - ret =ufshcd_get_vreg (dev, info->vccq2); +if (!ret) + ret =ufshcd_get_vreg (dev, info->vccq2); out:return ret; }
@@ -7866,12 +7856,7 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba) err =ufshcd_vops_setup_regulators (hba, true);if (err) - goto out_exit; - - goto out; - -out_exit: -ufshcd_vops_exit (hba); +ufshcd_vops_exit (hba); out:if (err) dev_err(hba->dev, "%s: variant %s init failed err %d\n",
Signature · 1 line
2.17.1
Re: [PATCH v3 2/2] scsi: ufs: remove several redundant goto statements
Quoted 3 lines · Bean Huo
From: Bean Huo <[email protected]>
Signed-off-by Bean Huo <[email protected]>
Quoted 84 lines
---
drivers/scsi/ufs/ufshcd.c| 25 +++++--------------------1 file changed, 5 insertions(+), 20 deletions(-)drivers/scsi/ufs/ufshcd.c +1
-5@@ -4256,10 +4256,8 @@ int ufshcd_make_hba_operational(struct ufs_hba *hba)dev_err (hba->dev,"Host controller not ready to process requests" ); err = -EIO ; - goto out; } -out:return err; }EXPORT_SYMBOL_GPL (ufshcd_make_hba_operational);@@ -5542,10 +5540,8 @@ static bool ufshcd_quirk_dl_nac_errors(struct ufs_hba *hba) hba->saved_err &= ~UIC_ERROR ;/* clear NAC error */ hba->saved_uic_err &= ~UFSHCD_UIC_DL_NAC_RECEIVED_ERROR ; -if (!hba->saved_uic_err) { +if (!hba->saved_uic_err) err_handling = false; - goto out; - } }out:
spin_unlock_irqrestore(hba->host->host_lock, flags);drivers/scsi/ufs/ufshcd.c +1
-3@@ -7604,12 +7600,10 @@ static int ufshcd_config_vreg(struct device *dev,if (vreg->min_uV && vreg->max_uV) { min_uV = on ? vreg->min_uV :0 ; ret =regulator_set_voltage (reg, min_uV, vreg->max_uV); -if (ret) { +if (ret)dev_err (dev,"%s: %s set voltage failed, err=%d\n" , __func__, name, ret); - goto out; - } } }out:
drivers/scsi/ufs/ufshcd.c +0
-2@@ -7672,8 +7666,6 @@ static int ufshcd_setup_vreg(struct ufs_hba *hba, bool on) goto out; ret =ufshcd_toggle_vreg (dev, info->vccq2, on); -if (ret) - goto out;out:
if (ret) {drivers/scsi/ufs/ufshcd.c +2
-4@@ -7719,10 +7711,8 @@ static int ufshcd_init_vreg(struct ufs_hba *hba) goto out; ret =ufshcd_get_vreg (dev, info->vccq); -if (ret) - goto out; - - ret =ufshcd_get_vreg (dev, info->vccq2); +if (!ret) + ret =ufshcd_get_vreg (dev, info->vccq2);out:
return ret; }drivers/scsi/ufs/ufshcd.c +1
-6@@ -7866,12 +7856,7 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba) err =ufshcd_vops_setup_regulators (hba, true);if (err) - goto out_exit; - - goto out; - -out_exit: -ufshcd_vops_exit (hba); +ufshcd_vops_exit (hba);out:
if (err) dev_err(hba->dev, "%s: variant %s init failed err %d\n",Signature · 1 line
2.17.1
Re: [PATCH v3 2/2] scsi: ufs: remove several redundant goto statements
In reply to Bean HuoQuoted 3 lines · Bean Huo
From: Bean Huo <[email protected]>
Signed-off-by Bean Huo <[email protected]>
Martin K. Petersen
AppliedQuoted 9 lines · Bean Huo
Changelog:
v2 -v3:
1. fix a coding style issue in [2/2] (Asutosh Das)v1 - v2:
1. remove original patch scsi: ufs: differentiatedev_cmdtrace message
2. add new patch scsi: ufs: remove several redundant goto statements[...]
Applied to 5.10/scsi-queue, thanks!
[1/2] scsi: ufs: Change ufshcd_comp_devman_upiu() to ufshcd_compose_devman_upiu()
https://git.kernel.org/mkp/scsi/c/39e78be3474b [2/2] scsi: ufs: Remove several redundant goto statements https://git.kernel.org/mkp/scsi/c/e62212672ab5
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering