Skip to content

Commit 53c271b

Browse files
LiaoYuanhong-vivoalexdeucher
authored andcommitted
drm/amd/display: Remove redundant ternary operators
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>
1 parent 54d18bc commit 53c271b

5 files changed

Lines changed: 6 additions & 7 deletions

File tree

drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_link_encoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ bool dcn10_link_encoder_validate_output_with_stream(
812812
enc10, &stream->timing);
813813
break;
814814
case SIGNAL_TYPE_EDP:
815-
is_valid = (stream->timing.pixel_encoding == PIXEL_ENCODING_RGB) ? true : false;
815+
is_valid = stream->timing.pixel_encoding == PIXEL_ENCODING_RGB;
816816
break;
817817
case SIGNAL_TYPE_VIRTUAL:
818818
is_valid = true;

drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static bool enc35_is_fifo_enabled(struct stream_encoder *enc)
397397
uint32_t reset_val;
398398

399399
REG_GET(DIG_FIFO_CTRL0, DIG_FIFO_ENABLE, &reset_val);
400-
return (reset_val == 0) ? false : true;
400+
return reset_val != 0;
401401
}
402402
void enc35_disable_fifo(struct stream_encoder *enc)
403403
{

drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ static bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode v
535535
if (result)
536536
result = does_configuration_meet_sw_policies(dml2, &dml2->v20.scratch.cur_display_config, &dml2->v20.scratch.mode_support_info);
537537

538-
return (result == 1) ? true : false;
538+
return result == 1;
539539
}
540540

541541
static void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *dml2)

drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_dio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ void setup_dio_stream_attribute(struct pipe_ctx *pipe_ctx)
138138
stream_encoder->funcs->dvi_set_stream_attribute(
139139
stream_encoder,
140140
&stream->timing,
141-
(stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK) ?
142-
true : false);
141+
stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK);
143142
else if (dc_is_lvds_signal(stream->signal))
144143
stream_encoder->funcs->lvds_set_stream_attribute(
145144
stream_encoder,

drivers/gpu/drm/amd/display/modules/freesync/freesync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ static void update_v_total_for_static_ramp(
226226
unsigned int target_duration_in_us =
227227
calc_duration_in_us_from_refresh_in_uhz(
228228
in_out_vrr->fixed.target_refresh_in_uhz);
229-
bool ramp_direction_is_up = (current_duration_in_us >
230-
target_duration_in_us) ? true : false;
229+
bool ramp_direction_is_up = current_duration_in_us >
230+
target_duration_in_us;
231231

232232
/* Calculate ratio between new and current frame duration with 3 digit */
233233
unsigned int frame_duration_ratio = div64_u64(1000000,

0 commit comments

Comments
 (0)