dma-mapping: make the global coherent pool conditional
Only build the code to support the global coherent pool if support for it is enabled. Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Dillon Min <dillon.minfei@gmail.com>
This commit is contained in:
@@ -171,13 +171,6 @@ int dma_alloc_from_dev_coherent(struct device *dev, ssize_t size,
|
||||
int dma_release_from_dev_coherent(struct device *dev, int order, void *vaddr);
|
||||
int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma,
|
||||
void *cpu_addr, size_t size, int *ret);
|
||||
|
||||
void *dma_alloc_from_global_coherent(struct device *dev, ssize_t size,
|
||||
dma_addr_t *dma_handle);
|
||||
int dma_release_from_global_coherent(int order, void *vaddr);
|
||||
int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr,
|
||||
size_t size, int *ret);
|
||||
int dma_init_global_coherent(phys_addr_t phys_addr, size_t size);
|
||||
#else
|
||||
static inline int dma_declare_coherent_memory(struct device *dev,
|
||||
phys_addr_t phys_addr, dma_addr_t device_addr, size_t size)
|
||||
@@ -187,7 +180,16 @@ static inline int dma_declare_coherent_memory(struct device *dev,
|
||||
#define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0)
|
||||
#define dma_release_from_dev_coherent(dev, order, vaddr) (0)
|
||||
#define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0)
|
||||
#endif /* CONFIG_DMA_DECLARE_COHERENT */
|
||||
|
||||
#ifdef CONFIG_DMA_GLOBAL_POOL
|
||||
void *dma_alloc_from_global_coherent(struct device *dev, ssize_t size,
|
||||
dma_addr_t *dma_handle);
|
||||
int dma_release_from_global_coherent(int order, void *vaddr);
|
||||
int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr,
|
||||
size_t size, int *ret);
|
||||
int dma_init_global_coherent(phys_addr_t phys_addr, size_t size);
|
||||
#else
|
||||
static inline void *dma_alloc_from_global_coherent(struct device *dev,
|
||||
ssize_t size, dma_addr_t *dma_handle)
|
||||
{
|
||||
@@ -202,7 +204,7 @@ static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma,
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_DMA_DECLARE_COHERENT */
|
||||
#endif /* CONFIG_DMA_GLOBAL_POOL */
|
||||
|
||||
/*
|
||||
* This is the actual return value from the ->alloc_noncontiguous method.
|
||||
|
||||
Reference in New Issue
Block a user