diff mbox series

[v2] gpu: ipu-v3: use swap()

Message ID 20210713140521.GA1873885@pc (mailing list archive)
State New, archived
Headers show
Series [v2] gpu: ipu-v3: use swap() | expand

Commit Message

Salah Triki July 13, 2021, 2:05 p.m. UTC
Use swap() instead of implementing it since it makes code cleaner.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---

Changes since v1:
	- Remove the declaration of tmp
	- Fix typo in the description

 drivers/gpu/ipu-v3/ipu-image-convert.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Philipp Zabel July 27, 2021, 2:11 p.m. UTC | #1
On Tue, 2021-07-13 at 15:05 +0100, Salah Triki wrote:
> Use swap() instead of implementing it since it makes code cleaner.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
> 
> Changes since v1:
> 	- Remove the declaration of tmp
> 	- Fix typo in the description

Thank you, I've changed the subject to "gpu: ipu-v3: image-convert: use
swap()" and applied to imx-drm/next.

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
index aa1d4b6d278f..af1612044eef 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -990,7 +990,7 @@  static int calc_tile_offsets_planar(struct ipu_image_convert_ctx *ctx,
 	const struct ipu_image_pixfmt *fmt = image->fmt;
 	unsigned int row, col, tile = 0;
 	u32 H, top, y_stride, uv_stride;
-	u32 uv_row_off, uv_col_off, uv_off, u_off, v_off, tmp;
+	u32 uv_row_off, uv_col_off, uv_off, u_off, v_off;
 	u32 y_row_off, y_col_off, y_off;
 	u32 y_size, uv_size;
 
@@ -1021,11 +1021,8 @@  static int calc_tile_offsets_planar(struct ipu_image_convert_ctx *ctx,
 
 			u_off = y_size - y_off + uv_off;
 			v_off = (fmt->uv_packed) ? 0 : u_off + uv_size;
-			if (fmt->uv_swapped) {
-				tmp = u_off;
-				u_off = v_off;
-				v_off = tmp;
-			}
+			if (fmt->uv_swapped)
+				swap(u_off, v_off);
 
 			image->tile[tile].offset = y_off;
 			image->tile[tile].u_off = u_off;