]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/amd/display: Remove redundant ternary operators
authorLiao Yuanhong <liaoyuanhong@vivo.com>
Thu, 4 Sep 2025 07:10:15 +0000 (15:10 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 5 Sep 2025 21:38:39 +0000 (17:38 -0400)
For ternary operators in the form of "a ? true : false" or
"a ? false : true", 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/amd/display/dc/dio/dcn10/dcn10_link_encoder.c
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.c
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_dio.c
drivers/gpu/drm/amd/display/modules/freesync/freesync.c

index e0558a78b11c23512ad42aab032327480916fafb..1c12281164877d698af2f35595d9661216e0d515 100644 (file)
@@ -812,7 +812,7 @@ bool dcn10_link_encoder_validate_output_with_stream(
                                        enc10, &stream->timing);
        break;
        case SIGNAL_TYPE_EDP:
-               is_valid = (stream->timing.pixel_encoding == PIXEL_ENCODING_RGB) ? true : false;
+               is_valid = stream->timing.pixel_encoding == PIXEL_ENCODING_RGB;
        break;
        case SIGNAL_TYPE_VIRTUAL:
                is_valid = true;
index 6ab2a218b7694e53de1c47646e1a8ff610e7d4b3..6f30b6cc3c761c0961d668125ade45e5b8ce3ab3 100644 (file)
@@ -397,7 +397,7 @@ static bool enc35_is_fifo_enabled(struct stream_encoder *enc)
        uint32_t reset_val;
 
        REG_GET(DIG_FIFO_CTRL0, DIG_FIFO_ENABLE, &reset_val);
-       return (reset_val == 0) ? false : true;
+       return reset_val != 0;
 }
 void enc35_disable_fifo(struct stream_encoder *enc)
 {
index 0318260370edfec86e67104d3958adef529394fa..9deb03a18ccc8326ead109392e260ef4c5a4e008 100644 (file)
@@ -535,7 +535,7 @@ static bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode v
        if (result)
                result = does_configuration_meet_sw_policies(dml2, &dml2->v20.scratch.cur_display_config, &dml2->v20.scratch.mode_support_info);
 
-       return (result == 1) ? true : false;
+       return result == 1;
 }
 
 static void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *dml2)
index b68bcc9fca0a514112308ab51dfa2a4bcb9457dc..892907991f9122f1d641a9302416e01540cdff91 100644 (file)
@@ -138,8 +138,7 @@ void setup_dio_stream_attribute(struct pipe_ctx *pipe_ctx)
                stream_encoder->funcs->dvi_set_stream_attribute(
                                stream_encoder,
                                &stream->timing,
-                               (stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK) ?
-                                               true : false);
+                               stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK);
        else if (dc_is_lvds_signal(stream->signal))
                stream_encoder->funcs->lvds_set_stream_attribute(
                                stream_encoder,
index 71efd2770c99c2c48cbbb14fffde7713b6e88449..ce421bcddcb0803f314ee4e29c77b2b2ecff0b3f 100644 (file)
@@ -226,8 +226,8 @@ static void update_v_total_for_static_ramp(
        unsigned int target_duration_in_us =
                        calc_duration_in_us_from_refresh_in_uhz(
                                in_out_vrr->fixed.target_refresh_in_uhz);
-       bool ramp_direction_is_up = (current_duration_in_us >
-                               target_duration_in_us) ? true : false;
+       bool ramp_direction_is_up = current_duration_in_us >
+                               target_duration_in_us;
 
        /* Calculate ratio between new and current frame duration with 3 digit */
        unsigned int frame_duration_ratio = div64_u64(1000000,