Commit 2922a8de authored by Stephen Warren's avatar Stephen Warren Committed by Mark Brown

spi: introduce macros to set bits_per_word_mask

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: default avatarStephen Warren <swarren@wwwdotorg.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent c7788792
...@@ -308,6 +308,8 @@ struct spi_master { ...@@ -308,6 +308,8 @@ struct spi_master {
/* bitmask of supported bits_per_word for transfers */ /* bitmask of supported bits_per_word for transfers */
u32 bits_per_word_mask; 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 */ /* other constraints relevant to this driver */
u16 flags; u16 flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment