video: driver: check kernel version to differentiate api

dma_buf_vmap() api changed from kernel version 5.15 and hence
check kernel version to use the updated api.

Change-Id: I05b7c72199cedfe9c33a8888fffb5e38da875f7e
Signed-off-by: Maheshwar Ajja <majja@quicinc.com>
This commit is contained in:
Maheshwar Ajja
2021-11-11 12:19:45 -08:00
父節點 767c8ad13d
當前提交 814107162d

查看文件

@@ -3,6 +3,7 @@
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/version.h>
#include <linux/dma-buf.h>
#include <linux/dma-heap.h>
#include <linux/dma-mapping.h>
@@ -377,12 +378,22 @@ int msm_vidc_memory_alloc(struct msm_vidc_core *core, struct msm_vidc_alloc *mem
if (mem->map_kernel) {
dma_buf_begin_cpu_access(mem->dmabuf, DMA_BIDIRECTIONAL);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0))
mem->kvaddr = dma_buf_vmap(mem->dmabuf);
if (!mem->kvaddr) {
d_vpr_e("%s: kernel map failed\n", __func__);
rc = -EIO;
goto error;
}
#else
rc = dma_buf_vmap(mem->dmabuf, mem->kvaddr);
if (rc) {
d_vpr_e("%s: kernel map failed\n", __func__);
rc = -EIO;
goto error;
}
#endif
}
d_vpr_h(