Skip to content

Commit

Permalink
Merge tag 'dma-mapping-4.13-3' of git://git.infradead.org/users/hch/d…
Browse files Browse the repository at this point in the history
…ma-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
  • Loading branch information
torvalds committed Aug 18, 2017
2 parents 04d49f3 + ee7b1f3 commit 4478976
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/of/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 4478976

Please sign in to comment.