Re: [PATCH] drm/amd/display/dc/core/dc_resource: use swap macro in rect_swap_helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>

Reviewed-by: Harry Wentland <harry.wentland@xxxxxxx>

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)
> 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux