[PATCH 08/32] dmaengine: ste_dma40: Optimise local MAX() macro

Arnd Bergmann arnd at arndb.de
Thu Apr 18 06:46:03 EDT 2013


On Thursday 18 April 2013, Lee Jones wrote:
> The current implementation of the DMA40's local MAX() macro evaluates
> its arguments more times than is necessary. This patch strips it
> optimises it to only evaluate what's appropriate.

No, it does not.

> index b21a8a3..7b451b2 100644
> --- a/drivers/dma/ste_dma40.c
> +++ b/drivers/dma/ste_dma40.c
> @@ -53,7 +53,7 @@
>  #define D40_ALLOC_PHY          BIT(30)
>  #define D40_ALLOC_LOG_FREE     BIT(0)
>  
> -#define MAX(a, b) (((a) < (b)) ? (b) : (a))
> +#define MAX(a, b) ((a > b) ? a : b)

This just makes the macro worse in case you pass a complex expression
in, which can now have additional unwanted effects. Just drop this patch.

	Arnd



More information about the linux-arm-kernel mailing list