From: Alex Hung <alex.hung@amd.com>
To: "Liao Yuanhong" <liaoyuanhong@vivo.com>,
"Austin Zheng" <austin.zheng@amd.com>,
"Jun Lei" <jun.lei@amd.com>,
"Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Rodrigo Siqueira" <siqueira@igalia.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"open list:AMD DISPLAY CORE" <amd-gfx@lists.freedesktop.org>,
"open list:DRM DRIVERS" <dri-devel@lists.freedesktop.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amd/display: Use swap() to simplify code
Date: Sun, 17 Aug 2025 18:03:34 -0600 [thread overview]
Message-ID: <884b009a-d3bf-4d7f-bcf7-ae50ee01c7a3@amd.com> (raw)
In-Reply-To: <20250806124120.381818-1-liaoyuanhong@vivo.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
On 8/6/25 06:41, Liao Yuanhong wrote:
> Replace the original swapping logic with swap() to improve readability and
> remove temporary variables
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
> drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c | 6 ++----
> 1 file changed, 2 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 5f1b49a50049..4cfe64aa8492 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
> @@ -473,7 +473,6 @@ static void sort_pipes_for_splitting(struct dc_plane_pipe_pool *pipes)
> {
> bool sorted, swapped;
> unsigned int cur_index;
> - unsigned int temp;
> int odm_slice_index;
>
> for (odm_slice_index = 0; odm_slice_index < pipes->num_pipes_assigned_to_plane_for_odm_combine; odm_slice_index++) {
> @@ -489,9 +488,8 @@ static void sort_pipes_for_splitting(struct dc_plane_pipe_pool *pipes)
> swapped = false;
> while (!sorted) {
> if (pipes->pipes_assigned_to_plane[odm_slice_index][cur_index] > pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1]) {
> - temp = pipes->pipes_assigned_to_plane[odm_slice_index][cur_index];
> - pipes->pipes_assigned_to_plane[odm_slice_index][cur_index] = pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1];
> - pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1] = temp;
> + swap(pipes->pipes_assigned_to_plane[odm_slice_index][cur_index + 1],
> + pipes->pipes_assigned_to_plane[odm_slice_index][cur_index]);
>
> swapped = true;
> }
prev parent reply other threads:[~2025-08-18 0:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 12:41 Liao Yuanhong
2025-08-18 0:03 ` Alex Hung [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=884b009a-d3bf-4d7f-bcf7-ae50ee01c7a3@amd.com \
--to=alex.hung@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=austin.zheng@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=jun.lei@amd.com \
--cc=liaoyuanhong@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®