drm/amd/display/dc/core/dc_resource: use swap macro in rect_swap_helper
Subsystems (3)
PATCH 1/1 drm/amd/display/dc/core/dc_resource: use swap macro in rect_swap_helper
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 <[email protected]>
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -9
@@ -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)
Signature · 1 line
2.7.4
Quoted 8 lines · 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 <[email protected]>
Reviewed-by Harry Wentland <[email protected]>
Harry
Quoted 17 lines
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/display/dc/core/dc_resource.c +0
-4@@ -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;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c static enum pixel_format convert_pixel_format_to_dalsurface( · line 433
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2
-5- 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx