Skip to content

Commit fe4e5ef

Browse files
FlyGoatChristoph Hellwig
authored andcommitted
dma-mapping: provide a fallback dma_default_coherent
dma_default_coherent was decleared unconditionally at kernel/dma/mapping.c but only decleared when any of non-coherent options is enabled in dma-map-ops.h. Guard the declaration in mapping.c with non-coherent options and provide a fallback definition. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent b31507d commit fe4e5ef

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

include/linux/dma-map-ops.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ static inline bool dev_is_dma_coherent(struct device *dev)
269269
return dev->dma_coherent;
270270
}
271271
#else
272+
#define dma_default_coherent true
273+
272274
static inline bool dev_is_dma_coherent(struct device *dev)
273275
{
274276
return true;

kernel/dma/mapping.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
#include "debug.h"
1818
#include "direct.h"
1919

20+
#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
21+
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
22+
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
2023
bool dma_default_coherent;
24+
#endif
2125

2226
/*
2327
* Managed DMA API

0 commit comments

Comments
 (0)