From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Mateusz Polrola Date: Thu, 20 Sep 2018 14:01:22 +0200 Subject: [PATCH] hyper_dmabuf: Align with dma_buf_ops changes In 4.17.0 kernel, map_atomic and unmap_atomic callbacks were removed from dma_buf_ops, additionally device param for attach callback was removed. Signed-off-by: Mateusz Polrola --- drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c | 7 +++++++ drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c b/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c index 10b5510b3816..3bd13c584ffc 100644 --- a/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c +++ b/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_ops.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "hyper_dmabuf_drv.h" #include "hyper_dmabuf_struct.h" #include "hyper_dmabuf_ops.h" @@ -86,7 +87,9 @@ static int sync_request(hyper_dmabuf_id_t hid, int dmabuf_ops) } static int hyper_dmabuf_ops_attach(struct dma_buf *dmabuf, +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) struct device *dev, +#endif struct dma_buf_attachment *attach) { struct imported_sgt_info *imported; @@ -255,6 +258,7 @@ static int hyper_dmabuf_ops_end_cpu_access(struct dma_buf *dmabuf, return sync_request(imported->hid, HYPER_DMABUF_OPS_END_CPU_ACCESS); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) static void *hyper_dmabuf_ops_kmap_atomic(struct dma_buf *dmabuf, unsigned long pgnum) { @@ -283,6 +287,7 @@ static void hyper_dmabuf_ops_kunmap_atomic(struct dma_buf *dmabuf, sync_request(imported->hid, HYPER_DMABUF_OPS_KUNMAP_ATOMIC); } +#endif static void *hyper_dmabuf_ops_kmap(struct dma_buf *dmabuf, unsigned long pgnum) { @@ -362,8 +367,10 @@ static const struct dma_buf_ops hyper_dmabuf_ops = { .release = hyper_dmabuf_ops_release, .begin_cpu_access = hyper_dmabuf_ops_begin_cpu_access, .end_cpu_access = hyper_dmabuf_ops_end_cpu_access, +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) .map_atomic = hyper_dmabuf_ops_kmap_atomic, .unmap_atomic = hyper_dmabuf_ops_kunmap_atomic, +#endif .map = hyper_dmabuf_ops_kmap, .unmap = hyper_dmabuf_ops_kunmap, .mmap = hyper_dmabuf_ops_mmap, diff --git a/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c b/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c index a82fd7b087b8..3cd3d6c98c33 100644 --- a/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c +++ b/drivers/dma-buf/hyper_dmabuf/hyper_dmabuf_remote_sync.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "hyper_dmabuf_drv.h" #include "hyper_dmabuf_struct.h" #include "hyper_dmabuf_list.h" @@ -219,10 +220,12 @@ int hyper_dmabuf_remote_sync(hyper_dmabuf_id_t hid, int ops) return -ENOMEM; /* dummy kmapping of 1 page */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) if (ops == HYPER_DMABUF_OPS_KMAP_ATOMIC) va_kmapl->vaddr = dma_buf_kmap_atomic( exported->dma_buf, 1); else +#endif va_kmapl->vaddr = dma_buf_kmap( exported->dma_buf, 1); @@ -253,11 +256,13 @@ int hyper_dmabuf_remote_sync(hyper_dmabuf_id_t hid, int ops) return PTR_ERR(va_kmapl->vaddr); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) /* unmapping 1 page */ if (ops == HYPER_DMABUF_OPS_KUNMAP_ATOMIC) dma_buf_kunmap_atomic(exported->dma_buf, 1, va_kmapl->vaddr); else +#endif dma_buf_kunmap(exported->dma_buf, 1, va_kmapl->vaddr); -- https://clearlinux.org