diff options
author | Martin Sperl <kernel@martin.sperl.org> | 2015-09-10 05:32:14 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-09-10 06:09:16 -0400 |
commit | 2a3fffd45822070309bcf0b1e1dae624d633824a (patch) | |
tree | fedfb018c3582f5996e9c83f7e382df8c4ee905a | |
parent | d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff) |
spi: bcm2835: BUG: fix wrong use of PAGE_MASK
There is a bug in the alignment checking of transfers,
that results in DMA not being used for un-aligned
transfers that do not cross page-boundries, which is valid.
This is due to a missconception of the meaning PAGE_MASK
when implementing that check originally - (PAGE_SIZE - 1)
should have been used instead.
Also fixes a copy/paste error.
Reported-by: <robert@axium.co.nz>
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
-rw-r--r-- | drivers/spi/spi-bcm2835.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 59705ab23577..ed74786e68cb 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c | |||
@@ -386,14 +386,14 @@ static bool bcm2835_spi_can_dma(struct spi_master *master, | |||
386 | /* otherwise we only allow transfers within the same page | 386 | /* otherwise we only allow transfers within the same page |
387 | * 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 |
388 | */ | 388 | */ |
389 | if (((size_t)tfr->tx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { | 389 | if (((size_t)tfr->tx_buf & (PAGE_SIZE - 1)) + tfr->len > PAGE_SIZE) { |
390 | dev_warn_once(&spi->dev, | 390 | dev_warn_once(&spi->dev, |
391 | "Unaligned spi tx-transfer bridging page\n"); | 391 | "Unaligned spi tx-transfer bridging page\n"); |
392 | return false; | 392 | return false; |
393 | } | 393 | } |
394 | if (((size_t)tfr->rx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { | 394 | if (((size_t)tfr->rx_buf & (PAGE_SIZE - 1)) + tfr->len > PAGE_SIZE) { |
395 | dev_warn_once(&spi->dev, | 395 | dev_warn_once(&spi->dev, |
396 | "Unaligned spi tx-transfer bridging page\n"); | 396 | "Unaligned spi rx-transfer bridging page\n"); |
397 | return false; | 397 | return false; |
398 | } | 398 | } |
399 | 399 | ||