[PATCH 1/3] drm/amd/display: Use swap() where appropriate
Alex Deucher
alexdeucher at gmail.com
Thu Oct 10 14:24:35 UTC 2019
Applied. Thanks!
Alex
On Thu, Oct 10, 2019 at 9:48 AM Kazlauskas, Nicholas
<Nicholas.Kazlauskas at amd.com> wrote:
>
> On 2019-10-10 9:11 a.m., Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >
> > Mostly a cocci-job, but it flat out refused to remove the
> > declaration in drivers/gpu/drm/amd/display/dc/core/dc.c so
> > had to do that part manually.
> >
> > @swap@
> > identifier TEMP;
> > expression A,B;
> > @@
> > - TEMP = A;
> > - A = B;
> > - B = TEMP;
> > + swap(A, B);
> >
> > @@
> > type T;
> > identifier swap.TEMP;
> > @@
> > (
> > - T TEMP;
> > |
> > - T TEMP = {...};
> > )
> > ... when != TEMP
> >
> > Cc: Harry Wentland <harry.wentland at amd.com>
> > Cc: Leo Li <sunpeng.li at amd.com>
> > Cc: Alex Deucher <alexander.deucher at amd.com>
> > Cc: "Christian König" <christian.koenig at amd.com>
> > Cc: "David (ChunMing) Zhou" <David1.Zhou at amd.com>
> > Cc: amd-gfx at lists.freedesktop.org
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
>
> Thanks!
>
> Nicholas Kazlauskas
>
> > ---
> > drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 7 ++-----
> > drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 8 ++------
> > drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +-----
> > 3 files changed, 5 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> > index 221e0f56389f..823843cd2613 100644
> > --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> > +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> > @@ -2543,7 +2543,6 @@ static enum bp_result construct_integrated_info(
> >
> > /* Sort voltage table from low to high*/
> > if (result == BP_RESULT_OK) {
> > - struct clock_voltage_caps temp = {0, 0};
> > uint32_t i;
> > uint32_t j;
> >
> > @@ -2553,10 +2552,8 @@ static enum bp_result construct_integrated_info(
> > info->disp_clk_voltage[j].max_supported_clk <
> > info->disp_clk_voltage[j-1].max_supported_clk) {
> > /* swap j and j - 1*/
> > - temp = info->disp_clk_voltage[j-1];
> > - info->disp_clk_voltage[j-1] =
> > - info->disp_clk_voltage[j];
> > - info->disp_clk_voltage[j] = temp;
> > + swap(info->disp_clk_voltage[j - 1],
> > + info->disp_clk_voltage[j]);
> > }
> > }
> > }
> > diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> > index dff65c0fe82f..7873abea4112 100644
> > --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> > +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> > @@ -1613,8 +1613,6 @@ static enum bp_result construct_integrated_info(
> >
> > struct atom_common_table_header *header;
> > struct atom_data_revision revision;
> > -
> > - struct clock_voltage_caps temp = {0, 0};
> > uint32_t i;
> > uint32_t j;
> >
> > @@ -1644,10 +1642,8 @@ static enum bp_result construct_integrated_info(
> > info->disp_clk_voltage[j-1].max_supported_clk
> > ) {
> > /* swap j and j - 1*/
> > - temp = info->disp_clk_voltage[j-1];
> > - info->disp_clk_voltage[j-1] =
> > - info->disp_clk_voltage[j];
> > - info->disp_clk_voltage[j] = temp;
> > + swap(info->disp_clk_voltage[j - 1],
> > + info->disp_clk_voltage[j]);
> > }
> > }
> > }
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> > index 5d1adeda4d90..fb6a7288caf4 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> > @@ -901,15 +901,11 @@ static void program_timing_sync(
> >
> > /* set first pipe with plane as master */
> > for (j = 0; j < group_size; j++) {
> > - struct pipe_ctx *temp;
> > -
> > if (pipe_set[j]->plane_state) {
> > if (j == 0)
> > break;
> >
> > - temp = pipe_set[0];
> > - pipe_set[0] = pipe_set[j];
> > - pipe_set[j] = temp;
> > + swap(pipe_set[0], pipe_set[j]);
> > break;
> > }
> > }
> >
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list