linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] use swap()
@ 2021-07-12 22:44 Salah Triki
  2021-07-13 13:20 ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Salah Triki @ 2021-07-12 22:44 UTC (permalink / raw)
  To: p.zabel; +Cc: dri-devel, linux-kernel

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

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/gpu/ipu-v3/ipu-image-convert.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
index aa1d4b6d278f..5f730cd6009d 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] use swap()
  2021-07-12 22:44 [PATCH] use swap() Salah Triki
@ 2021-07-13 13:20 ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-07-13 13:20 UTC (permalink / raw)
  To: Salah Triki; +Cc: Philipp Zabel, LKML, Maling list - DRI developers

On Tue, Jul 13, 2021 at 3:09 AM Salah Triki <salah.triki@gmail.com> wrote:
>
> Use swap() instead of implementing it since it makes code more clean.
>
> Signed-off-by: Salah Triki <salah.triki@gmail.com>

Patches for this driver generally have the following prefix in the subject:
gpu: ipu-v3:

Alex

> ---
>  drivers/gpu/ipu-v3/ipu-image-convert.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
> index aa1d4b6d278f..5f730cd6009d 100644
> --- a/drivers/gpu/ipu-v3/ipu-image-convert.c
> +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
> @@ -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;
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] use swap()
@ 2021-07-13  2:38 Salah Triki
  0 siblings, 0 replies; 3+ messages in thread
From: Salah Triki @ 2021-07-13  2:38 UTC (permalink / raw)
  To: herbert, davem, nicolas.ferre, alexandre.belloni, ludovic.desroches
  Cc: linux-crypto, linux-arm-kernel, linux-kernel

Use swap() instead of implementing it in order to make code more clean.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/crypto/atmel-aes.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index b1d286004295..60041022c4f5 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -1819,12 +1819,8 @@ static int atmel_aes_xts_process_data(struct atmel_aes_dev *dd)
 	 * the order of the ciphered tweak bytes need to be reversed before
 	 * writing them into the ODATARx registers.
 	 */
-	for (i = 0; i < AES_BLOCK_SIZE/2; ++i) {
-		u8 tmp = tweak_bytes[AES_BLOCK_SIZE - 1 - i];
-
-		tweak_bytes[AES_BLOCK_SIZE - 1 - i] = tweak_bytes[i];
-		tweak_bytes[i] = tmp;
-	}
+	for (i = 0; i < AES_BLOCK_SIZE/2; ++i)
+		swap(tweak_bytes[i], tweak_bytes[AES_BLOCK_SIZE - 1 - i]);
 
 	/* Process the data. */
 	atmel_aes_write_ctrl(dd, use_dma, NULL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-13 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 22:44 [PATCH] use swap() Salah Triki
2021-07-13 13:20 ` Alex Deucher
2021-07-13  2:38 Salah Triki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).