lkml.org 
[lkml]   [2018]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] dma-mapping: use phys_to_dma in dma_direct_get_required
Date
We need to apply an DMA offset for the function to work as expected.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/base/platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 7812b861b6da..6feac7294f8d 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -15,7 +15,7 @@
#include <linux/of_irq.h>
#include <linux/module.h>
#include <linux/init.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-direct.h>
#include <linux/bootmem.h>
#include <linux/err.h>
#include <linux/slab.h>
@@ -1185,7 +1185,7 @@ int __init platform_bus_init(void)
*/
u64 dma_direct_get_required_mask(struct device *dev)
{
- u64 end = ((max_pfn - 1) << PAGE_SHIFT);
+ u64 end = phys_to_dma(dev, (max_pfn - 1) << PAGE_SHIFT);

return (1 << (fls64(end) - 1)) * 2 - 1;
}
--
2.18.0
\
 
 \ /
  Last update: 2018-09-10 08:14    [W:0.043 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site