From: Christoph Hellwig Date: Thu, 30 Nov 2017 07:32:51 -0800 Subject: dma-mapping: take dma_pfn_offset into account in dma_max_pfn Git-commit: a41ef1e455a9796be8cb986f0616f52453ac8e4b Patch-mainline: v4.16-rc1 References: jsc#SLE-6197 FATE#327012 bsc#1140559 LTC#173150 This makes sure the generic version can be used with architectures / devices that have a DMA offset in the direct mapping. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy Acked-by: Petr Tesarik --- include/linux/dma-mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -686,7 +686,7 @@ static inline int dma_set_seg_boundary(s #ifndef dma_max_pfn static inline unsigned long dma_max_pfn(struct device *dev) { - return *dev->dma_mask >> PAGE_SHIFT; + return (*dev->dma_mask >> PAGE_SHIFT) + dev->dma_pfn_offset; } #endif