From db57f481c01c4c39946707d06d04f3039bb5a9d3 Mon Sep 17 00:00:00 2001 From: Suman Anna Date: Tue, 14 Feb 2017 15:58:07 -0600 Subject: cmemk: Fix cmem_dma_buf_end_cpu_access() signature on 4.6+ kernels Commit 18b862dcd57a ("dma-buf, drm, ion: Propagate error code from dma_buf_start_cpu_access()") in Linux kernel has changed the signature for the dma_buf's end_cpu_access() ops. It now returns an error code, so adjust the signature for the cmem_dma_buf_end_cpu_access() function appropriately based on the kernel version. Signed-off-by: Suman Anna Signed-off-by: Sam Nelson --- src/cmem/module/cmemk.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cmem/module/cmemk.c b/src/cmem/module/cmemk.c index b3dbcee..b1e39d4 100644 --- a/src/cmem/module/cmemk.c +++ b/src/cmem/module/cmemk.c @@ -1187,8 +1187,14 @@ static void cmem_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset, { } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)) +static int cmem_dma_buf_end_cpu_access(struct dma_buf *dmabuf, + enum dma_data_direction direction) +#else static void cmem_dma_buf_end_cpu_access(struct dma_buf *dmabuf, enum dma_data_direction direction) + +#endif { struct pool_buffer *entry = dmabuf->priv; @@ -1197,6 +1203,10 @@ static void cmem_dma_buf_end_cpu_access(struct dma_buf *dmabuf, /* TODO: Need to take care of case where kvirtp is not set */ outer_clean_range(entry->physp, entry->physp + entry->size); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)) + return 0; +#endif } static int cmem_dmabuf_map_attach(struct dma_buf *dma_buf, -- cgit v1.2.3