* [PATCH] drm/amd/display/dc/core/dc_resource: use swap macro in rect_swap_helper
@ 2017-11-10 22:38 Gustavo A. R. Silva
[not found] ` <20171110223813.GA32508-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-10 22:38 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 temp.
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>
---
drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index d1cdf9f..ee216f2 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -426,15 +426,8 @@ static enum pixel_format convert_pixel_format_to_dalsurface(
static void rect_swap_helper(struct rect *rect)
{
- uint32_t temp = 0;
-
- temp = rect->height;
- rect->height = rect->width;
- rect->width = temp;
-
- temp = rect->x;
- rect->x = rect->y;
- rect->y = temp;
+ swap(rect->height, rect->width);
+ swap(rect->x, rect->y);
}
static void calculate_viewport(struct pipe_ctx *pipe_ctx)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <20171110223813.GA32508-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>]
* Re: [PATCH] drm/amd/display/dc/core/dc_resource: use swap macro in rect_swap_helper [not found] ` <20171110223813.GA32508-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org> @ 2017-11-17 15:45 ` Harry Wentland 0 siblings, 0 replies; 2+ 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:38 PM, Gustavo A. R. Silva wrote: > Make use of the swap macro instead of _manually_ swapping values > and remove unnecessary variable temp. > > 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 > --- > drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c > index d1cdf9f..ee216f2 100644 > --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c > @@ -426,15 +426,8 @@ static enum pixel_format convert_pixel_format_to_dalsurface( > > static void rect_swap_helper(struct rect *rect) > { > - uint32_t temp = 0; > - > - temp = rect->height; > - rect->height = rect->width; > - rect->width = temp; > - > - temp = rect->x; > - rect->x = rect->y; > - rect->y = temp; > + swap(rect->height, rect->width); > + swap(rect->x, rect->y); > } > > static void calculate_viewport(struct pipe_ctx *pipe_ctx) > _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-17 15:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-10 22:38 [PATCH] drm/amd/display/dc/core/dc_resource: use swap macro in rect_swap_helper Gustavo A. R. Silva
[not found] ` <20171110223813.GA32508-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
2017-11-17 15:45 ` Harry Wentland
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox