Skip to contentSkip to conversation

gpu: ipu-v3: use swap()

PATCH Superseded Salah Triki 2 participants 2 messages Jul 13, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu: ipu-v3: use swap()

Use swap() instead of implementing it since it makes code more clean.

---
 drivers/gpu/ipu-v3/ipu-image-convert.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/ipu-v3/ipu-image-convert.c +2 -5
index aa1d4b6d278f..5f730cd6009d 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw

Hi Salah,

Quoted 2 lines · Salah Triki

Use swap() instead of implementing it since it makes code more clean.

s/more clean/cleaner

Quoted 10 lines
---
 drivers/gpu/ipu-v3/ipu-image-convert.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/ipu-v3/ipu-image-convert.c +0 -0
index aa1d4b6d278f..5f730cd6009d 100644

drivers/gpu/ipu-v3/ipu-image-convert.c static int calc_tile_offsets_planar(struct ipu_image_convert_ctx *ctx, · line 1027

Quoted 7 lines
drivers/gpu/ipu-v3/ipu-image-convert.c +0 -4
@@ -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;

The 'tmp' variable seems to be unused now, so its declaration should be removed.

Thanks