Skip to content

Commit 60d6f01

Browse files
LiaoYuanhong-vivoalexdeucher
authored andcommitted
drm/radeon/dpm: Remove redundant ternary operators
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>
1 parent 7a50377 commit 60d6f01

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/gpu/drm/radeon/ci_dpm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@ static void ci_register_patching_mc_arb(struct radeon_device *rdev,
24572457
u32 tmp, tmp2;
24582458

24592459
tmp = RREG32(MC_SEQ_MISC0);
2460-
patch = ((tmp & 0x0000f00) == 0x300) ? true : false;
2460+
patch = (tmp & 0x0000f00) == 0x300;
24612461

24622462
if (patch &&
24632463
((rdev->pdev->device == 0x67B0) ||
@@ -3438,7 +3438,7 @@ static int ci_setup_default_dpm_tables(struct radeon_device *rdev)
34383438
pi->dpm_table.sclk_table.dpm_levels[pi->dpm_table.sclk_table.count].value =
34393439
allowed_sclk_vddc_table->entries[i].clk;
34403440
pi->dpm_table.sclk_table.dpm_levels[pi->dpm_table.sclk_table.count].enabled =
3441-
(i == 0) ? true : false;
3441+
i == 0;
34423442
pi->dpm_table.sclk_table.count++;
34433443
}
34443444
}
@@ -3451,7 +3451,7 @@ static int ci_setup_default_dpm_tables(struct radeon_device *rdev)
34513451
pi->dpm_table.mclk_table.dpm_levels[pi->dpm_table.mclk_table.count].value =
34523452
allowed_mclk_table->entries[i].clk;
34533453
pi->dpm_table.mclk_table.dpm_levels[pi->dpm_table.mclk_table.count].enabled =
3454-
(i == 0) ? true : false;
3454+
i == 0;
34553455
pi->dpm_table.mclk_table.count++;
34563456
}
34573457
}
@@ -4489,7 +4489,7 @@ static int ci_register_patching_mc_seq(struct radeon_device *rdev,
44894489
bool patch;
44904490

44914491
tmp = RREG32(MC_SEQ_MISC0);
4492-
patch = ((tmp & 0x0000f00) == 0x300) ? true : false;
4492+
patch = (tmp & 0x0000f00) == 0x300;
44934493

44944494
if (patch &&
44954495
((rdev->pdev->device == 0x67B0) ||

drivers/gpu/drm/radeon/ni_dpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3397,7 +3397,7 @@ static int ni_enable_smc_cac(struct radeon_device *rdev,
33973397
if (PPSMC_Result_OK != smc_result)
33983398
ret = -EINVAL;
33993399

3400-
ni_pi->cac_enabled = (PPSMC_Result_OK == smc_result) ? true : false;
3400+
ni_pi->cac_enabled = PPSMC_Result_OK == smc_result;
34013401
}
34023402
} else if (ni_pi->cac_enabled) {
34033403
smc_result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_DisableCac);

0 commit comments

Comments
 (0)