Re: Applied "spi: work around clang bug in SPI_BPW_RANGE_MASK()" to the spi tree

From: Arnd Bergmann
Date: Wed Mar 13 2019 - 17:02:06 EST


On Wed, Mar 13, 2019 at 8:15 PM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:

> > -#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_BPW_RANGE_MASK(min, max) GENMASK((min) - 1, (max) - 1)
>
> This is not correct: GENMASK() order is from msb to lsb.
> So it should it:
>
> +#define SPI_BPW_RANGE_MASK(min, max) GENMASK((max) - 1, (min) - 1)

Sorry about the mess, I've sent a fixup now.

Arnd