diff options
| author | Stephen Warren <swarren@nvidia.com> | 2013-08-01 18:08:57 -0400 |
|---|---|---|
| committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:05:53 -0400 |
| commit | f72ac71f4cee27e2077d2da79bd46ec631a3db6d (patch) | |
| tree | 165e6c1e70e611a85d18f7e138b38e7451cc64a9 /include/linux | |
| parent | 5a42f567433f9b870f98049b73f5a76d77c97aa0 (diff) | |
spi: fix SPI_BIT_MASK so it always fits into 32-bits
On a 64-bit platform, ~0UL fills 64-bits, which causes SPI_BIT_MASK(32)
not to fit into 32 bits. This causes a warning when the result is assigned
to a 32-bit variable. Use ~0U instead to prevent this. This fixes:
drivers/spi/spi-gpio.c: In function 'spi_gpio_probe':
drivers/spi/spi-gpio.c:446:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/spi/spi.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index c28ac127ef3d..85151908eaf7 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -314,7 +314,7 @@ struct spi_master { | |||
| 314 | /* bitmask of supported bits_per_word for transfers */ | 314 | /* bitmask of supported bits_per_word for transfers */ |
| 315 | u32 bits_per_word_mask; | 315 | u32 bits_per_word_mask; |
| 316 | #define SPI_BPW_MASK(bits) BIT((bits) - 1) | 316 | #define SPI_BPW_MASK(bits) BIT((bits) - 1) |
| 317 | #define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0UL : (BIT(bits) - 1)) | 317 | #define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1)) |
| 318 | #define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1)) | 318 | #define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1)) |
| 319 | 319 | ||
| 320 | /* limits on transfer speed */ | 320 | /* limits on transfer speed */ |
