diff options
author | Martin Sperl <kernel@martin.sperl.org> | 2015-05-12 06:32:08 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-05-12 06:42:16 -0400 |
commit | 7e52be0d576e8f7bc99a606f07b9d000c4340f04 (patch) | |
tree | 198eaa44f665bd28cbf064007b1033a69f7d9ac3 /drivers/spi/spi-bcm2835.c | |
parent | 3ecd37edaa2a6ba3246e2c35714be9316b1087fe (diff) |
spi: bcm2835: fix kbuild compile warnings/errors and a typo
fixes several warnings/error emmitted by the kbuild system:
* warn: cast from pointer to integer of different size
using size_t instead of u32
* error: 'SZ_4K' undeclared
moved to PAGE_SIZE and PAGE_MASK instead
Review showed also a typo in the same code where tx_buff
was checked twice instead of checking both rx and tx_buff.
Reported by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-bcm2835.c')
-rw-r--r-- | drivers/spi/spi-bcm2835.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 6ab43c8bd6fd..ac1760e06a86 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c | |||
@@ -20,6 +20,7 @@ | |||
20 | * GNU General Public License for more details. | 20 | * GNU General Public License for more details. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <asm/page.h> | ||
23 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
24 | #include <linux/completion.h> | 25 | #include <linux/completion.h> |
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
@@ -378,18 +379,19 @@ static bool bcm2835_spi_can_dma(struct spi_master *master, | |||
378 | } | 379 | } |
379 | 380 | ||
380 | /* if we run rx/tx_buf with word aligned addresses then we are OK */ | 381 | /* if we run rx/tx_buf with word aligned addresses then we are OK */ |
381 | if (((u32)tfr->tx_buf % 4 == 0) && ((u32)tfr->tx_buf % 4 == 0)) | 382 | if ((((size_t)tfr->rx_buf & 3) == 0) && |
383 | (((size_t)tfr->tx_buf & 3) == 0)) | ||
382 | return true; | 384 | return true; |
383 | 385 | ||
384 | /* otherwise we only allow transfers within the same page | 386 | /* otherwise we only allow transfers within the same page |
385 | * to avoid wasting time on dma_mapping when it is not practical | 387 | * to avoid wasting time on dma_mapping when it is not practical |
386 | */ | 388 | */ |
387 | if (((u32)tfr->tx_buf % SZ_4K) + tfr->len > SZ_4K) { | 389 | if (((size_t)tfr->tx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { |
388 | dev_warn_once(&spi->dev, | 390 | dev_warn_once(&spi->dev, |
389 | "Unaligned spi tx-transfer bridging page\n"); | 391 | "Unaligned spi tx-transfer bridging page\n"); |
390 | return false; | 392 | return false; |
391 | } | 393 | } |
392 | if (((u32)tfr->rx_buf % SZ_4K) + tfr->len > SZ_4K) { | 394 | if (((size_t)tfr->rx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { |
393 | dev_warn_once(&spi->dev, | 395 | dev_warn_once(&spi->dev, |
394 | "Unaligned spi tx-transfer bridging page\n"); | 396 | "Unaligned spi tx-transfer bridging page\n"); |
395 | return false; | 397 | return false; |