[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_OtyaYJAcMpd6hmo4jShFq+1NjDHW5_TEcQB+Hf3yxaqQ@mail.gmail.com>
Date: Wed, 5 Jun 2024 10:35:51 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Thorsten Blum <thorsten.blum@...lux.com>
Cc: harry.wentland@....com, sunpeng.li@....com, Rodrigo.Siqueira@....com,
alexander.deucher@....com, christian.koenig@....com, Xinhui.Pan@....com,
daniel@...ll.ch, Qingqing.Zhuo@....com, roman.li@....com, hersenxs.wu@....com,
chaitanya.dhere@....com, wenjing.liu@....com, alex.hung@....com,
sungkim@....com, syed.hassan@....com, syedsaaem.rizvi@....com,
dillon.varone@....com, charlene.liu@....com, hamza.mahfooz@....com,
nicholas.kazlauskas@....com, jerry.zuo@....com, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/amd/display: Simplify if conditions
Applied. Thanks!
Alex
On Tue, Jun 4, 2024 at 9:07 AM Thorsten Blum <thorsten.blum@...lux.com> wrote:
>
> 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 <thorsten.blum@...lux.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
> index ad2a6b4769fe..940081df6dc0 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
> @@ -68,7 +68,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *state
> if (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_stat
> for (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]);
> }
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
> index a41812598ce8..b2bbf7988f92 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
> @@ -979,7 +979,7 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *conte
> if (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
>
Powered by blists - more mailing lists