[PATCH 4/4] drm/radeon/pm: Remove redundant ternary operators

Liao Yuanhong posted 4 patches 4 weeks ago
[PATCH 4/4] drm/radeon/pm: Remove redundant ternary operators
Posted by Liao Yuanhong 4 weeks ago
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>
---
 drivers/gpu/drm/radeon/radeon_pm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index b4fb7e70320b..a855a96dd2ea 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -907,8 +907,7 @@ static void radeon_dpm_thermal_work_handler(struct work_struct *work)
 
 static bool radeon_dpm_single_display(struct radeon_device *rdev)
 {
-	bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ?
-		true : false;
+	bool single_display = rdev->pm.dpm.new_active_crtc_count < 2;
 
 	/* check if the vblank period is too short to adjust the mclk */
 	if (single_display && rdev->asic->dpm.vblank_too_short) {
-- 
2.34.1
Re: [PATCH 4/4] drm/radeon/pm: Remove redundant ternary operators
Posted by Alex Deucher 4 weeks ago
Applied the series.  Thanks!

Alex

On Thu, Sep 4, 2025 at 7:49 AM Liao Yuanhong <liaoyuanhong@vivo.com> wrote:
>
> 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>
> ---
>  drivers/gpu/drm/radeon/radeon_pm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
> index b4fb7e70320b..a855a96dd2ea 100644
> --- a/drivers/gpu/drm/radeon/radeon_pm.c
> +++ b/drivers/gpu/drm/radeon/radeon_pm.c
> @@ -907,8 +907,7 @@ static void radeon_dpm_thermal_work_handler(struct work_struct *work)
>
>  static bool radeon_dpm_single_display(struct radeon_device *rdev)
>  {
> -       bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ?
> -               true : false;
> +       bool single_display = rdev->pm.dpm.new_active_crtc_count < 2;
>
>         /* check if the vblank period is too short to adjust the mclk */
>         if (single_display && rdev->asic->dpm.vblank_too_short) {
> --
> 2.34.1
>