]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
spi: introduce macros to set bits_per_word_mask
authorStephen Warren <swarren@wwwdotorg.org>
Wed, 22 May 2013 02:36:34 +0000 (20:36 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 22 May 2013 15:57:43 +0000 (10:57 -0500)
Introduce two macros to make setting up spi_master.bits_per_word_mask
easier, and avoid mistakes like writing BIT(n) instead of BIT(n - 1).

SPI_BPW_MASK is for a single supported value of bits_per_word_mask.

SPI_BPW_RANGE_MASK represents a contiguous set of bit lengths.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
include/linux/spi/spi.h

index 6ff26c8db7b923853527cee3ee1ffff1ca55bdd6..1737256222520a504779dd59b2fa2b0cece0c160 100644 (file)
@@ -308,6 +308,8 @@ struct spi_master {
 
        /* bitmask of supported bits_per_word for transfers */
        u32                     bits_per_word_mask;
+#define SPI_BPW_MASK(bits) BIT((bits) - 1)
+#define SPI_BPW_RANGE_MASK(min, max) ((BIT(max) - 1) - (BIT(min) - 1))
 
        /* other constraints relevant to this driver */
        u16                     flags;