From 716ca530e1c4515d8683c9d5be3d56b301758b66 Mon Sep 17 00:00:00 2001 From: James <> Date: Wed, 4 Nov 2015 11:49:21 +0000 Subject: trunk-47381 --- ...pi-bcm2835-BUG-fix-wrong-use-of-PAGE_MASK.patch | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 target/linux/brcm2708/patches-4.1/0182-backport-spi-bcm2835-BUG-fix-wrong-use-of-PAGE_MASK.patch (limited to 'target/linux/brcm2708/patches-4.1/0182-backport-spi-bcm2835-BUG-fix-wrong-use-of-PAGE_MASK.patch') diff --git a/target/linux/brcm2708/patches-4.1/0182-backport-spi-bcm2835-BUG-fix-wrong-use-of-PAGE_MASK.patch b/target/linux/brcm2708/patches-4.1/0182-backport-spi-bcm2835-BUG-fix-wrong-use-of-PAGE_MASK.patch new file mode 100644 index 0000000..cbe4b29 --- /dev/null +++ b/target/linux/brcm2708/patches-4.1/0182-backport-spi-bcm2835-BUG-fix-wrong-use-of-PAGE_MASK.patch @@ -0,0 +1,44 @@ +From 6460bf849143979acff90f3664f78bf3907aad0f Mon Sep 17 00:00:00 2001 +From: Martin Sperl +Date: Thu, 10 Sep 2015 09:32:14 +0000 +Subject: [PATCH 182/203] backport: 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: +Signed-off-by: Martin Sperl +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +--- + drivers/spi/spi-bcm2835.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/spi/spi-bcm2835.c ++++ b/drivers/spi/spi-bcm2835.c +@@ -386,14 +386,14 @@ static bool bcm2835_spi_can_dma(struct s + /* otherwise we only allow transfers within the same page + * to avoid wasting time on dma_mapping when it is not practical + */ +- if (((size_t)tfr->tx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { ++ if (((size_t)tfr->tx_buf & (PAGE_SIZE - 1)) + tfr->len > PAGE_SIZE) { + dev_warn_once(&spi->dev, + "Unaligned spi tx-transfer bridging page\n"); + return false; + } +- if (((size_t)tfr->rx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { ++ if (((size_t)tfr->rx_buf & (PAGE_SIZE - 1)) + tfr->len > PAGE_SIZE) { + dev_warn_once(&spi->dev, +- "Unaligned spi tx-transfer bridging page\n"); ++ "Unaligned spi rx-transfer bridging page\n"); + return false; + } + -- cgit v1.2.3