From dd06f72e0ac8549d5ad4815e6839598e9d83f427 Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Mon, 12 Feb 2018 14:35:24 +0900 Subject: [PATCH] android: ion: add ion_cached_dmabuf() Some kernel clients of ION need to know if an ION buffer is cached. Change-Id: I8a179e2ba4476408732e2d32441268883c9dc2c6 Signed-off-by: Cho KyongHo --- drivers/staging/android/ion/ion_exynos.c | 5 +++++ include/linux/ion_exynos.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/drivers/staging/android/ion/ion_exynos.c b/drivers/staging/android/ion/ion_exynos.c index 2f067d1ceed5..72350f8bce3e 100644 --- a/drivers/staging/android/ion/ion_exynos.c +++ b/drivers/staging/android/ion/ion_exynos.c @@ -34,6 +34,11 @@ struct dma_buf *ion_alloc_dmabuf(const char *heap_name, return __ion_alloc(len, 1 << heap->id, flags); } +bool ion_cached_dmabuf(struct dma_buf *dmabuf) +{ + return ion_buffer_cached(dmabuf->priv); +} + struct ion_iovm_map { struct list_head list; struct device *dev; diff --git a/include/linux/ion_exynos.h b/include/linux/ion_exynos.h index b43fb18147bb..8a40bc385490 100644 --- a/include/linux/ion_exynos.h +++ b/include/linux/ion_exynos.h @@ -26,12 +26,17 @@ struct dma_buf_attachment; #ifdef CONFIG_ION_EXYNOS struct dma_buf *ion_alloc_dmabuf(const char *heap_name, size_t len, unsigned int flags); +bool ion_cached_dmabuf(struct dma_buf *dmabuf); #else static inline struct dma_buf *ion_alloc_dmabuf(const char *heap_name, size_t len, unsigned int flags) { return ERR_PTR(-ENODEV); } +static inline bool ion_cached_dmabuf(struct dma_buf *dmabuf) +{ + return false; +} #endif #if defined(CONFIG_EXYNOS_IOVMM) && defined(CONFIG_ION_EXYNOS) -- 2.20.1