drm/amd/display/dc/core/dc_resource: use swap macro in rect_swap_helper
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Fri, 10 Nov 2017 22:38:13 +0000 (16:38 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Dec 2017 17:47:56 +0000 (12:47 -0500)
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>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_resource.c

index 15e518aba9169dab08cf2c7994dd6579333844f7..9c5e879f18b36da0c991a7bcf86450ce487bba97 100644 (file)
@@ -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)