Re: [PATCH] spi: work around clang bug in SPI_BPW_RANGE_MASK()
From: Mark Brown
Date: Thu Mar 07 2019 - 06:23:26 EST
On Thu, Mar 07, 2019 at 11:56:07AM +0100, Arnd Bergmann wrote:
> Link: https://bugs.llvm.org/show_bug.cgi?id=38789
> #define SPI_BPW_MASK(bits) BIT((bits) - 1)
> -#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1))
> -#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
> +#define SPI_BIT_MASK(bits) ((BIT((bits) - 1) << 1) - 1)
> +#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - (BIT((min) - 1) - 1))
Can we have a comment that this is for the clang warning please so
nobody goes in and simplifies the code?
Attachment:
signature.asc
Description: PGP signature