ramips: update v3.10 patches
[openwrt.git] / target / linux / ramips / patches-3.10 / 0120-spi-introduce-macros-to-set-bits_per_word_mask.patch
1 From 2922a8de996956893bb98e4aa91be9774c958336 Mon Sep 17 00:00:00 2001
2 From: Stephen Warren <swarren@wwwdotorg.org>
3 Date: Tue, 21 May 2013 20:36:34 -0600
4 Subject: [PATCH] spi: introduce macros to set bits_per_word_mask
5
6 Introduce two macros to make setting up spi_master.bits_per_word_mask
7 easier, and avoid mistakes like writing BIT(n) instead of BIT(n - 1).
8
9 SPI_BPW_MASK is for a single supported value of bits_per_word_mask.
10
11 SPI_BPW_RANGE_MASK represents a contiguous set of bit lengths.
12
13 Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
14 Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
15 ---
16  include/linux/spi/spi.h |    2 ++
17  1 file changed, 2 insertions(+)
18
19 --- a/include/linux/spi/spi.h
20 +++ b/include/linux/spi/spi.h
21 @@ -308,6 +308,8 @@ struct spi_master {
22  
23         /* bitmask of supported bits_per_word for transfers */
24         u32                     bits_per_word_mask;
25 +#define SPI_BPW_MASK(bits) BIT((bits) - 1)
26 +#define SPI_BPW_RANGE_MASK(min, max) ((BIT(max) - 1) - (BIT(min) - 1))
27  
28         /* other constraints relevant to this driver */
29         u16                     flags;