public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Keoseong Park <keosung.park@samsung.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Bean Huo <beanhuo@micron.com>, Avri Altman <avri.altman@wdc.com>,
	Daejun Park <daejun7.park@samsung.com>,
	Keoseong Park <keosung.park@samsung.com>
Subject: RE: [PATCH v2 04/29] scsi: ufs: Simplify statements that return a boolean
Date: Wed, 13 Apr 2022 11:33:24 +0900	[thread overview]
Message-ID: <1889248251.21649817605815.JavaMail.epsvc@epcpadp3> (raw)
In-Reply-To: <20220412181853.3715080-5-bvanassche@acm.org>

Hi Bart,

>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'.

How about adding ufshcd_is_pwr_mode_restore_needed()?

Best Regards,
Keoseong Park

>
>Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
>Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>---
> drivers/scsi/ufs/ufs-qcom.h |  5 +----
> drivers/scsi/ufs/ufshcd.c   | 22 +++++-----------------
> drivers/scsi/ufs/ufshpb.c   |  8 ++------
> 3 files changed, 8 insertions(+), 27 deletions(-)
>
>diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/scsi/ufs/ufs-qcom.h
>index 8208e3a3ef59..51570224a6e2 100644
>--- a/drivers/scsi/ufs/ufs-qcom.h
>+++ b/drivers/scsi/ufs/ufs-qcom.h
>@@ -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)
> {
>-	if (host->caps & UFS_QCOM_CAP_QUNIPRO)
>-		return true;
>-	else
>-		return false;
>+	return host->caps & UFS_QCOM_CAP_QUNIPRO;
> }
> 
> /* ufs-qcom-ice.c */
>diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>index 983fac14b7cd..c60519372b3b 100644
>--- a/drivers/scsi/ufs/ufshcd.c
>+++ b/drivers/scsi/ufs/ufshcd.c
>@@ -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
> 	 * doesn't support ver1.6 or later.
> 	 */
>-	if (ufshcd_get_local_unipro_ver(hba) < UFS_UNIPRO_VER_1_6)
>-		return true;
>-	else
>-		return false;
>+	return ufshcd_get_local_unipro_ver(hba) < UFS_UNIPRO_VER_1_6;
> }
> 
> /**
>@@ -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)
> {
>-	if (ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY)
>-		return true;
>-	else
>-		return false;
>+	return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY;
> }
> 
> /**
>@@ -5781,10 +5775,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba,
> 		return false;
> 	}
> 	/* Let it continue to flush when available buffer exceeds threshold */
>-	if (avail_buf < hba->vps->wb_flush_threshold)
>-		return true;
>-
>-	return false;
>+	return avail_buf < hba->vps->wb_flush_threshold;
> }
> 
> static void ufshcd_wb_force_disable(struct ufs_hba *hba)
>@@ -5863,11 +5854,8 @@ static bool ufshcd_wb_need_flush(struct ufs_hba *hba)
> 		return false;
> 	}
> 
>-	if (!hba->dev_info.b_presrv_uspc_en) {
>-		if (avail_buf <= UFS_WB_BUF_REMAIN_PERCENT(10))
>-			return true;
>-		return false;
>-	}
>+	if (!hba->dev_info.b_presrv_uspc_en)
>+		return avail_buf <= UFS_WB_BUF_REMAIN_PERCENT(10);
> 
> 	return ufshcd_wb_presrv_usrspc_keep_vcc_on(hba, avail_buf);
> }
>diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
>index b2bec19022cd..ebd8fc8fc109 100644
>--- a/drivers/scsi/ufs/ufshpb.c
>+++ b/drivers/scsi/ufs/ufshpb.c
>@@ -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)
> {
>-	if (hpb->lu_pinned_end != PINNED_NOT_SET &&
>-	    rgn_idx >= hpb->lu_pinned_start &&
>-	    rgn_idx <= hpb->lu_pinned_end)
>-		return true;
>-
>-	return false;
>+	return hpb->lu_pinned_end != PINNED_NOT_SET &&
>+	       rgn_idx >= hpb->lu_pinned_start && rgn_idx <= hpb->lu_pinned_end;
> }
> 
> static void ufshpb_kick_map_work(struct ufshpb_lu *hpb)
>

  reply	other threads:[~2022-04-13  2:40 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 18:18 [PATCH v2 00/29] UFS patches for kernel v5.19 Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 01/29] scsi: ufs: Fix a spelling error in a source code comment Bart Van Assche
2022-04-13  5:18   ` Avri Altman
2022-04-12 18:18 ` [PATCH v2 02/29] scsi: ufs: Declare ufshcd_wait_for_register() static Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 03/29] scsi: ufs: Remove superfluous boolean conversions Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 04/29] scsi: ufs: Simplify statements that return a boolean Bart Van Assche
2022-04-13  2:33   ` Keoseong Park [this message]
2022-04-13  3:20     ` Bart Van Assche
2022-04-13  5:18       ` Keoseong Park
2022-04-12 18:18 ` [PATCH v2 05/29] scsi: ufs: Remove ufshcd_lrb.sense_bufflen Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 06/29] scsi: ufs: Remove ufshcd_lrb.sense_buffer Bart Van Assche
2022-04-13  5:23   ` Avri Altman
2022-04-12 18:18 ` [PATCH v2 07/29] scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup() Bart Van Assche
2022-04-12 21:26   ` Eric Biggers
2022-04-13  0:08     ` Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 08/29] scsi: ufs: Remove the UFS_FIX() and END_FIX() macros Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 09/29] scsi: ufs: Rename struct ufs_dev_fix into ufs_dev_quirk Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 10/29] scsi: ufs: Declare the quirks array const Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 11/29] scsi: ufs: Invert the return value of ufshcd_is_hba_active() Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 12/29] scsi: ufs: Remove unused constants and code Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 13/29] scsi: ufs: Switch to aggregate initialization Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 14/29] scsi: ufs: Make the config_scaling_param calls type safe Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 15/29] scsi: ufs: Remove the driver version Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 16/29] scsi: ufs: Rename sdev_ufs_device into ufs_device_wlun Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 17/29] scsi: ufs: Use an SPDX license identifier in the Kconfig file Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 18/29] scsi: ufs: Remove paths from source code comments Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 19/29] scsi: ufs: Remove the TRUE and FALSE definitions Bart Van Assche
2022-04-14 11:56   ` Avri Altman
2022-04-12 18:18 ` [PATCH v2 20/29] scsi: ufs: Remove locking from around single register writes Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 21/29] scsi: ufs: Introduce ufshcd_clkgate_delay_set() Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 22/29] scsi: ufs: qcom: Fix ufs_qcom_resume() Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 23/29] scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives Bart Van Assche
2022-04-12 21:30   ` Eric Biggers
2022-04-12 18:18 ` [PATCH v2 24/29] scsi: ufs: Fix kernel-doc syntax in ufshcd.h Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 25/29] scsi: ufs: Minimize #include directives Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 26/29] scsi: ufs: Split the ufshcd.h header file Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 27/29] scsi: ufs: Move the struct ufs_ref_clk definition Bart Van Assche
2022-04-12 18:18 ` [PATCH v2 28/29] scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition Bart Van Assche
2022-04-19 21:00   ` Bean Huo
2022-04-19 21:48     ` Bart Van Assche
2022-04-12 18:32 ` [PATCH v2 29/29] scsi: ufs: Split the drivers/scsi/ufs directory Bart Van Assche
2022-04-18 17:11   ` Bart Van Assche
2022-04-19  8:25     ` Bean Huo
2022-04-19 20:28       ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1889248251.21649817605815.JavaMail.epsvc@epcpadp3 \
    --to=keosung.park@samsung.com \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=bvanassche@acm.org \
    --cc=daejun7.park@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox