]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: ufs: Remove superfluous boolean conversions
authorBart Van Assche <bvanassche@acm.org>
Tue, 19 Apr 2022 22:57:46 +0000 (15:57 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 26 Apr 2022 03:23:02 +0000 (23:23 -0400)
Remove "? true : false" if the preceding expression yields a boolean or if
the result of the expression is assigned to a boolean since in these two
cases the "? true : false" part is superfluous.

Link: https://lore.kernel.org/r/20220419225811.4127248-4-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufs-qcom.c
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h

index 586c0e567ff9abd9c51123cee8f0f15d36bed1c7..46b24b926860d630328c62149b13d71e841d134f 100644 (file)
@@ -299,8 +299,7 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
        struct ufs_qcom_host *host = ufshcd_get_variant(hba);
        struct phy *phy = host->generic_phy;
        int ret = 0;
-       bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B)
-                                                       ? true : false;
+       bool is_rate_B = UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B;
 
        /* Reset UFS Host Controller and PHY */
        ret = ufs_qcom_host_reset(hba);
index 28bdc6770e6de097a9c241b17070745ec3cb6d01..c1a8bfe7f7cb32274807240ab333e5c24b206b53 100644 (file)
@@ -712,8 +712,7 @@ static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba)
  */
 static inline bool ufshcd_is_device_present(struct ufs_hba *hba)
 {
-       return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) &
-                                               DEVICE_PRESENT) ? true : false;
+       return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & DEVICE_PRESENT;
 }
 
 /**
@@ -840,7 +839,7 @@ ufshcd_get_rsp_upiu_data_seg_len(struct utp_upiu_rsp *ucd_rsp_ptr)
 static inline bool ufshcd_is_exception_event(struct utp_upiu_rsp *ucd_rsp_ptr)
 {
        return be32_to_cpu(ucd_rsp_ptr->header.dword_2) &
-                       MASK_RSP_EXCEPTION_EVENT ? true : false;
+                       MASK_RSP_EXCEPTION_EVENT;
 }
 
 /**
@@ -1350,7 +1349,7 @@ static int ufshcd_devfreq_target(struct device *dev,
        }
 
        /* Decide based on the rounded-off frequency and update */
-       scale_up = (*freq == clki->max_freq) ? true : false;
+       scale_up = *freq == clki->max_freq;
        if (!scale_up)
                *freq = clki->min_freq;
        /* Update the frequency */
@@ -2800,7 +2799,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
        lrbp->sense_buffer = cmd->sense_buffer;
        lrbp->task_tag = tag;
        lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun);
-       lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba) ? true : false;
+       lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba);
 
        ufshcd_prepare_lrbp_crypto(scsi_cmd_to_rq(cmd), lrbp);
 
index c3a2043fe13d452ff73cf13705b9885641ae3f7b..28ce0fda7c4381c80ab88c3c1e935383d63fbd53 100644 (file)
@@ -983,7 +983,7 @@ static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba)
 
 static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba)
 {
-       return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false;
+       return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit);
 }
 
 static inline bool ufshcd_is_wb_allowed(struct ufs_hba *hba)