]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/radeon/dpm: Remove redundant ternary operators
authorLiao Yuanhong <liaoyuanhong@vivo.com>
Thu, 4 Sep 2025 11:31:58 +0000 (19:31 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 5 Sep 2025 21:38:40 +0000 (17:38 -0400)
For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/ci_dpm.c
drivers/gpu/drm/radeon/ni_dpm.c

index 1f9f4424055a95b8e9f08c695beab909d703e590..ba8db1d07c070e2725decbe29da4c62cf2857958 100644 (file)
@@ -2457,7 +2457,7 @@ static void ci_register_patching_mc_arb(struct radeon_device *rdev,
        u32 tmp, tmp2;
 
        tmp = RREG32(MC_SEQ_MISC0);
-       patch = ((tmp & 0x0000f00) == 0x300) ? true : false;
+       patch = (tmp & 0x0000f00) == 0x300;
 
        if (patch &&
            ((rdev->pdev->device == 0x67B0) ||
@@ -3438,7 +3438,7 @@ static int ci_setup_default_dpm_tables(struct radeon_device *rdev)
                        pi->dpm_table.sclk_table.dpm_levels[pi->dpm_table.sclk_table.count].value =
                                allowed_sclk_vddc_table->entries[i].clk;
                        pi->dpm_table.sclk_table.dpm_levels[pi->dpm_table.sclk_table.count].enabled =
-                               (i == 0) ? true : false;
+                               i == 0;
                        pi->dpm_table.sclk_table.count++;
                }
        }
@@ -3451,7 +3451,7 @@ static int ci_setup_default_dpm_tables(struct radeon_device *rdev)
                        pi->dpm_table.mclk_table.dpm_levels[pi->dpm_table.mclk_table.count].value =
                                allowed_mclk_table->entries[i].clk;
                        pi->dpm_table.mclk_table.dpm_levels[pi->dpm_table.mclk_table.count].enabled =
-                               (i == 0) ? true : false;
+                               i == 0;
                        pi->dpm_table.mclk_table.count++;
                }
        }
@@ -4489,7 +4489,7 @@ static int ci_register_patching_mc_seq(struct radeon_device *rdev,
        bool patch;
 
        tmp = RREG32(MC_SEQ_MISC0);
-       patch = ((tmp & 0x0000f00) == 0x300) ? true : false;
+       patch = (tmp & 0x0000f00) == 0x300;
 
        if (patch &&
            ((rdev->pdev->device == 0x67B0) ||
index e08559c44a5c482284fbb3264f61e34002750013..82edbfb259bf04873569e6419c8411eebe91e914 100644 (file)
@@ -3397,7 +3397,7 @@ static int ni_enable_smc_cac(struct radeon_device *rdev,
                                if (PPSMC_Result_OK != smc_result)
                                        ret = -EINVAL;
 
-                               ni_pi->cac_enabled = (PPSMC_Result_OK == smc_result) ? true : false;
+                               ni_pi->cac_enabled = PPSMC_Result_OK == smc_result;
                        }
                } else if (ni_pi->cac_enabled) {
                        smc_result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_DisableCac);