drm/amd/display: Simplify if conditions
Subsystems (3)
PATCH 1/1 drm/amd/display: Simplify if conditions
The if conditions !A || A && B can be simplified to !A || B.
Fixes the following Coccinelle/coccicheck warnings reported by excluded_middle.cocci:
WARNING !A || A && B is equivalent to !A || B WARNING !A || A && B is equivalent to !A || B WARNING !A || A && B is equivalent to !A || B
Compile-tested only.
Signed-off-by Thorsten Blum <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c | 6 +++--- .../gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +3 -3
@@ -68,7 +68,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *stateif (state->streams[i]->stream_id == stream_id) {for (j =0 ; j < state->stream_status[i].plane_count; j++) {if (state->stream_status[i].plane_states[j] == plane && - (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) { + (!is_plane_duplicate || (j == plane_index))) { *plane_id = (i <<16 ) | j;return true; }
@@ -707,8 +707,8 @@ static void free_unused_pipes_for_plane(struct dml2_context *ctx, struct dc_statfor (i =0 ; i < ctx->config.dcn_pipe_count; i++) {if (state->res_ctx.pipe_ctx[i].plane_state == plane && state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id && - (!is_plane_duplicate || (is_plane_duplicate && - ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[state->res_ctx.pipe_ctx[i].pipe_idx] == plane_index)) && + (!is_plane_duplicate || + ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[state->res_ctx.pipe_ctx[i].pipe_idx] == plane_index) && !is_pipe_used (pool, state->res_ctx.pipe_ctx[i].pipe_idx)) {free_pipe (&state->res_ctx.pipe_ctx[i]); }
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +1 -1
@@ -979,7 +979,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *conteif (context->streams[i]->stream_id == stream_id) {for (j =0 ; j < context->stream_status[i].plane_count; j++) {if (context->stream_status[i].plane_states[j] == plane && - (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) { + (!is_plane_duplicate || (j == plane_index))) { *plane_id = (i <<16 ) | j;return true; }
Signature · 1 line
2.39.2
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 58 lines · Thorsten Blum
The if conditions !A || A && B can be simplified to !A || B.
Fixes the following Coccinelle/coccicheck warnings reported by
excluded_middle.cocci:WARNING !A || A && B is equivalent to !A || B WARNING !A || A && B is equivalent to !A || B WARNING !A || A && B is equivalent to !A || BCompile-tested only.
Signed-off-by Thorsten Blum <[email protected]>--- drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c | 6 +++--- .../gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +3
-3@@ -68,7 +68,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *stateif (state->streams[i]->stream_id == stream_id) {for (j =0 ; j < state->stream_status[i].plane_count; j++) {if (state->stream_status[i].plane_states[j] == plane && - (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) { + (!is_plane_duplicate || (j == plane_index))) { *plane_id = (i <<16 ) | j;return true; }@@ -707,8 +707,8 @@ static void free_unused_pipes_for_plane(struct dml2_context *ctx, struct dc_statfor (i =0 ; i < ctx->config.dcn_pipe_count; i++) {if (state->res_ctx.pipe_ctx[i].plane_state == plane && state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id && - (!is_plane_duplicate || (is_plane_duplicate && - ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[state->res_ctx.pipe_ctx[i].pipe_idx] == plane_index)) && + (!is_plane_duplicate || + ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[state->res_ctx.pipe_ctx[i].pipe_idx] == plane_index) && !is_pipe_used (pool, state->res_ctx.pipe_ctx[i].pipe_idx)) {free_pipe (&state->res_ctx.pipe_ctx[i]); }drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +1
-2@@ -979,7 +979,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *conteif (context->streams[i]->stream_id == stream_id) {for (j =0 ; j < context->stream_status[i].plane_count; j++) {if (context->stream_status[i].plane_states[j] == plane && - (!is_plane_duplicate || (is_plane_duplicate && (j == plane_index)))) { + (!is_plane_duplicate || (j == plane_index))) { *plane_id = (i <<16 ) | j;return true; } --2.39.2