* [PATCH] drm/amd/display/dc/dce110/dce110_mem_input_v: use swap macro in program_size_and_rotation
@ 2017-11-10 22:31 Gustavo A. R. Silva
[not found] ` <20171110223109.GA31549-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-10 22:31 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie
Cc: amd-gfx, dri-devel, linux-kernel, Gustavo A. R. Silva
Make use of the swap macro instead of _manually_ swapping values
and remove unnecessary variable swap.
This makes the code easier to read and maintain.
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
.../drm/amd/display/dc/dce110/dce110_mem_input_v.c | 28 +++++++---------------
1 file changed, 8 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c
index a06c602..7bab8c6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c
@@ -237,26 +237,14 @@ static void program_size_and_rotation(
if (rotation == ROTATION_ANGLE_90 ||
rotation == ROTATION_ANGLE_270) {
- uint32_t swap;
- swap = local_size.video.luma_size.x;
- local_size.video.luma_size.x =
- local_size.video.luma_size.y;
- local_size.video.luma_size.y = swap;
-
- swap = local_size.video.luma_size.width;
- local_size.video.luma_size.width =
- local_size.video.luma_size.height;
- local_size.video.luma_size.height = swap;
-
- swap = local_size.video.chroma_size.x;
- local_size.video.chroma_size.x =
- local_size.video.chroma_size.y;
- local_size.video.chroma_size.y = swap;
-
- swap = local_size.video.chroma_size.width;
- local_size.video.chroma_size.width =
- local_size.video.chroma_size.height;
- local_size.video.chroma_size.height = swap;
+ swap(local_size.video.luma_size.x,
+ local_size.video.luma_size.y);
+ swap(local_size.video.luma_size.width,
+ local_size.video.luma_size.height);
+ swap(local_size.video.chroma_size.x,
+ local_size.video.chroma_size.y);
+ swap(local_size.video.chroma_size.width,
+ local_size.video.chroma_size.height);
}
value = 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amd/display/dc/dce110/dce110_mem_input_v: use swap macro in program_size_and_rotation
[not found] ` <20171110223109.GA31549-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
@ 2017-11-17 15:45 ` Harry Wentland
2017-11-20 5:25 ` Gustavo A. R. Silva
0 siblings, 1 reply; 3+ messages in thread
From: Harry Wentland @ 2017-11-17 15:45 UTC (permalink / raw)
To: Gustavo A. R. Silva, Alex Deucher, Christian König,
David Airlie
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On 2017-11-10 05:31 PM, Gustavo A. R. Silva wrote:
> Make use of the swap macro instead of _manually_ swapping values
> and remove unnecessary variable swap.
>
> This makes the code easier to read and maintain.
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Harry
> ---
> .../drm/amd/display/dc/dce110/dce110_mem_input_v.c | 28 +++++++---------------
> 1 file changed, 8 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c
> index a06c602..7bab8c6 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c
> @@ -237,26 +237,14 @@ static void program_size_and_rotation(
> if (rotation == ROTATION_ANGLE_90 ||
> rotation == ROTATION_ANGLE_270) {
>
> - uint32_t swap;
> - swap = local_size.video.luma_size.x;
> - local_size.video.luma_size.x =
> - local_size.video.luma_size.y;
> - local_size.video.luma_size.y = swap;
> -
> - swap = local_size.video.luma_size.width;
> - local_size.video.luma_size.width =
> - local_size.video.luma_size.height;
> - local_size.video.luma_size.height = swap;
> -
> - swap = local_size.video.chroma_size.x;
> - local_size.video.chroma_size.x =
> - local_size.video.chroma_size.y;
> - local_size.video.chroma_size.y = swap;
> -
> - swap = local_size.video.chroma_size.width;
> - local_size.video.chroma_size.width =
> - local_size.video.chroma_size.height;
> - local_size.video.chroma_size.height = swap;
> + swap(local_size.video.luma_size.x,
> + local_size.video.luma_size.y);
> + swap(local_size.video.luma_size.width,
> + local_size.video.luma_size.height);
> + swap(local_size.video.chroma_size.x,
> + local_size.video.chroma_size.y);
> + swap(local_size.video.chroma_size.width,
> + local_size.video.chroma_size.height);
> }
>
> value = 0;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amd/display/dc/dce110/dce110_mem_input_v: use swap macro in program_size_and_rotation
2017-11-17 15:45 ` Harry Wentland
@ 2017-11-20 5:25 ` Gustavo A. R. Silva
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-20 5:25 UTC (permalink / raw)
To: Harry Wentland
Cc: Alex Deucher, Christian König, David Airlie, dri-devel,
amd-gfx, linux-kernel
Quoting Harry Wentland <harry.wentland@amd.com>:
> On 2017-11-10 05:31 PM, Gustavo A. R. Silva wrote:
>> Make use of the swap macro instead of _manually_ swapping values
>> and remove unnecessary variable swap.
>>
>> This makes the code easier to read and maintain.
>>
>> This code was detected with the help of Coccinelle.
>>
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
Thank you, Harry.
--
Gustavo A. R. Silva
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-20 5:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-10 22:31 [PATCH] drm/amd/display/dc/dce110/dce110_mem_input_v: use swap macro in program_size_and_rotation Gustavo A. R. Silva
[not found] ` <20171110223109.GA31549-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
2017-11-17 15:45 ` Harry Wentland
2017-11-20 5:25 ` Gustavo A. R. Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox