aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-08-18 10:51:30 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-18 10:51:30 -0700
commit4478976a43c5df8bc70e3a6b0e8ead9d7cff0a3f (patch)
tree237e1fbcc10735f806781f55f3ac6fb6268dfe12 /drivers
parentMerge tag 'drm-fixes-for-v4.13-rc6' of git://people.freedesktop.org/~airlied/linux (diff)
parentof: fix DMA mask generation (diff)
downloadlinux-dev-4478976a43c5df8bc70e3a6b0e8ead9d7cff0a3f.tar.xz
linux-dev-4478976a43c5df8bc70e3a6b0e8ead9d7cff0a3f.zip
Merge tag 'dma-mapping-4.13-3' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fix from Christoph Hellwig: "Another dma-mapping regression fix" * tag 'dma-mapping-4.13-3' of git://git.infradead.org/users/hch/dma-mapping: of: fix DMA mask generation
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/device.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 28c38c756f92..e0a28ea341fe 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -89,6 +89,7 @@ int of_dma_configure(struct device *dev, struct device_node *np)
bool coherent;
unsigned long offset;
const struct iommu_ops *iommu;
+ u64 mask;
/*
* Set default coherent_dma_mask to 32 bit. Drivers are expected to
@@ -134,10 +135,9 @@ int of_dma_configure(struct device *dev, struct device_node *np)
* Limit coherent and dma mask based on size and default mask
* set by the driver.
*/
- dev->coherent_dma_mask = min(dev->coherent_dma_mask,
- DMA_BIT_MASK(ilog2(dma_addr + size)));
- *dev->dma_mask = min((*dev->dma_mask),
- DMA_BIT_MASK(ilog2(dma_addr + size)));
+ mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1);
+ dev->coherent_dma_mask &= mask;
+ *dev->dma_mask &= mask;
coherent = of_dma_is_coherent(np);
dev_dbg(dev, "device is%sdma coherent\n",