summaryrefslogtreecommitdiffstats
path: root/include/linux/spi/spi.h
diff options
context:
space:
mode:
authorStephen Warren <swarren@wwwdotorg.org>2013-05-21 20:36:34 -0600
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-05-22 10:57:43 -0500
commit2922a8de996956893bb98e4aa91be9774c958336 (patch)
treec9181673361f52877caa50047ecc04dabbd13c0d /include/linux/spi/spi.h
parentc7788792a5e7b0d5d7f96d0766b4cb6112d47d75 (diff)
downloadblackbird-obmc-linux-2922a8de996956893bb98e4aa91be9774c958336.tar.gz
blackbird-obmc-linux-2922a8de996956893bb98e4aa91be9774c958336.zip
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: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/linux/spi/spi.h')
-rw-r--r--include/linux/spi/spi.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 6ff26c8db7b9..173725622252 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -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;
OpenPOWER on IntegriCloud