Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bba1f4ac authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Greg Kroah-Hartman
Browse files

drm/amd/display: Use swap() where appropriate



[ Upstream commit 34b86b75dfc90ab3d996c224314ce51772a3b351 ]

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@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8f16bebb
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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]);
				}
			}
		}
+2 −6
Original line number Diff line number Diff line
@@ -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]);
			}
		}
	}
+1 −5
Original line number Diff line number Diff line
@@ -907,15 +907,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;
			}
		}