Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd31496d authored by Suren Baghdasaryan's avatar Suren Baghdasaryan
Browse files

ANDROID: Export functions to be used with dma_map_ops in modules



For modules to reuse default dma_map_ops implementations they need to be
exported. Export the following functions:

dma_direct_alloc
dma_direct_free
dma_common_mmap
dma_common_get_sgtable
dma_direct_get_required_mask

Bug: 151050914
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
Change-Id: Ia77b797fcd909fce01da7431bfbde282dc70b3b3
parent 3605968c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ u64 dma_direct_get_required_mask(struct device *dev)

	return (1ULL << (fls64(max_dma) - 1)) * 2 - 1;
}
EXPORT_SYMBOL_GPL(dma_direct_get_required_mask);

static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
		u64 *phys_mask)
@@ -209,6 +210,7 @@ void *dma_direct_alloc(struct device *dev, size_t size,
		return arch_dma_alloc(dev, size, dma_handle, gfp, attrs);
	return dma_direct_alloc_pages(dev, size, dma_handle, gfp, attrs);
}
EXPORT_SYMBOL_GPL(dma_direct_alloc);

void dma_direct_free(struct device *dev, size_t size,
		void *cpu_addr, dma_addr_t dma_addr, unsigned long attrs)
@@ -219,6 +221,7 @@ void dma_direct_free(struct device *dev, size_t size,
	else
		dma_direct_free_pages(dev, size, cpu_addr, dma_addr, attrs);
}
EXPORT_SYMBOL_GPL(dma_direct_free);

#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
    defined(CONFIG_SWIOTLB)
+2 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
		sg_set_page(sgt->sgl, page, PAGE_ALIGN(size), 0);
	return ret;
}
EXPORT_SYMBOL_GPL(dma_common_get_sgtable);

/*
 * The whole dma_get_sgtable() idea is fundamentally unsafe - it seems
@@ -221,6 +222,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
	return -ENXIO;
#endif /* CONFIG_MMU */
}
EXPORT_SYMBOL_GPL(dma_common_mmap);

/**
 * dma_can_mmap - check if a given device supports dma_mmap_*