Commit a858af9a authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: ufs: Simplify statements that return a boolean

Convert "if (expr) return true; else return false;" into "return expr;" if
either 'expr' is a boolean expression or the return type of the function is
'bool'.

Link: https://lore.kernel.org/r/20220419225811.4127248-5-bvanassche@acm.orgTested-by: default avatarBean Huo <beanhuo@micron.com>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarKeoseong Park <keosung.park@samsung.com>
Reviewed-by: default avatarBean Huo <beanhuo@micron.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 51d1628f
...@@ -239,10 +239,7 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host); ...@@ -239,10 +239,7 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host);
static inline bool ufs_qcom_cap_qunipro(struct ufs_qcom_host *host) static inline bool ufs_qcom_cap_qunipro(struct ufs_qcom_host *host)
{ {
if (host->caps & UFS_QCOM_CAP_QUNIPRO) return host->caps & UFS_QCOM_CAP_QUNIPRO;
return true;
else
return false;
} }
/* ufs-qcom-ice.c */ /* ufs-qcom-ice.c */
......
...@@ -939,10 +939,7 @@ static bool ufshcd_is_unipro_pa_params_tuning_req(struct ufs_hba *hba) ...@@ -939,10 +939,7 @@ static bool ufshcd_is_unipro_pa_params_tuning_req(struct ufs_hba *hba)
* logic simple, we will only do manual tuning if local unipro version * logic simple, we will only do manual tuning if local unipro version
* doesn't support ver1.6 or later. * doesn't support ver1.6 or later.
*/ */
if (ufshcd_get_local_unipro_ver(hba) < UFS_UNIPRO_VER_1_6) return ufshcd_get_local_unipro_ver(hba) < UFS_UNIPRO_VER_1_6;
return true;
else
return false;
} }
/** /**
...@@ -2216,10 +2213,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) ...@@ -2216,10 +2213,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
*/ */
static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba) static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
{ {
if (ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY) return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY;
return true;
else
return false;
} }
/** /**
...@@ -5781,10 +5775,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba, ...@@ -5781,10 +5775,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba,
return false; return false;
} }
/* Let it continue to flush when available buffer exceeds threshold */ /* Let it continue to flush when available buffer exceeds threshold */
if (avail_buf < hba->vps->wb_flush_threshold) return avail_buf < hba->vps->wb_flush_threshold;
return true;
return false;
} }
static void ufshcd_wb_force_disable(struct ufs_hba *hba) static void ufshcd_wb_force_disable(struct ufs_hba *hba)
...@@ -5863,11 +5854,8 @@ static bool ufshcd_wb_need_flush(struct ufs_hba *hba) ...@@ -5863,11 +5854,8 @@ static bool ufshcd_wb_need_flush(struct ufs_hba *hba)
return false; return false;
} }
if (!hba->dev_info.b_presrv_uspc_en) { if (!hba->dev_info.b_presrv_uspc_en)
if (avail_buf <= UFS_WB_BUF_REMAIN_PERCENT(10)) return avail_buf <= UFS_WB_BUF_REMAIN_PERCENT(10);
return true;
return false;
}
return ufshcd_wb_presrv_usrspc_keep_vcc_on(hba, avail_buf); return ufshcd_wb_presrv_usrspc_keep_vcc_on(hba, avail_buf);
} }
......
...@@ -90,12 +90,8 @@ static bool ufshpb_is_general_lun(int lun) ...@@ -90,12 +90,8 @@ static bool ufshpb_is_general_lun(int lun)
static bool ufshpb_is_pinned_region(struct ufshpb_lu *hpb, int rgn_idx) static bool ufshpb_is_pinned_region(struct ufshpb_lu *hpb, int rgn_idx)
{ {
if (hpb->lu_pinned_end != PINNED_NOT_SET && return hpb->lu_pinned_end != PINNED_NOT_SET &&
rgn_idx >= hpb->lu_pinned_start && rgn_idx >= hpb->lu_pinned_start && rgn_idx <= hpb->lu_pinned_end;
rgn_idx <= hpb->lu_pinned_end)
return true;
return false;
} }
static void ufshpb_kick_map_work(struct ufshpb_lu *hpb) static void ufshpb_kick_map_work(struct ufshpb_lu *hpb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment