From defbc730ebe05f65e399b1e0fcc5105e9984b659 Mon Sep 17 00:00:00 2001 From: Liqiang Jin Date: Wed, 9 Jan 2019 14:44:59 +0800 Subject: [PATCH] linuxdriver: kernel4.19 "struct dma_buf_ops" have changed [1/1] PD#SWPL-2814 Problem: because "struct dma_buf_ops" have changed, so compile failed Solution: use "struct dma_buf_ops" according to the kernel version Verify: Android P + G12A(U200) Change-Id: I47573d1cfcdc942e4de2ac2c92938ebc4bc975d9 Signed-off-by: Liqiang Jin --- build_gx.sh => build.sh | 26 +++++++++++++++++++------- optee/Makefile | 0 tee_shm.c | 11 +++++++++++ 3 files changed, 30 insertions(+), 7 deletions(-) rename build_gx.sh => build.sh (72%) mode change 100755 => 100644 optee/Makefile diff --git a/build_gx.sh b/build.sh similarity index 72% rename from build_gx.sh rename to build.sh index 53bb93d..5bc4b81 100755 --- a/build_gx.sh +++ b/build.sh @@ -1,15 +1,27 @@ #!/bin/bash LOCAL_PATH=`pwd` -KERNEL_CONFIG=meson64_defconfig -export ARCH=arm64 -export CROSS_COMPILE=aarch64-linux-gnu- +BASE_PATH=$(cd "$(dirname $0)"; pwd) +export ARCH=arm -if [ "$KERNEL_SRC_DIR" = "" ]; then - KERNEL_SRC_DIR=/mnt/fileroot/peifu/kernel-m8 +if [ ${ARCH} = arm ] +then + KERNEL_CONFIG=meson64_a32_defconfig + export KERNEL_A32_SUPPORT=true + export CROSS_COMPILE=arm-linux-gnueabihf- +else + KERNEL_CONFIG=meson64_a64_defconfig + export CROSS_COMPILE=aarch64-linux-gnu- +fi + +if [ "${KERNEL_SRC_DIR}" = "" ] +then + KERNEL_SRC_DIR=${BASE_PATH}/../../../../../common/ fi -if [ "$KERNEL_OUT_DIR" = "" ]; then - KERNEL_OUT_DIR=/mnt/fileroot/peifu/kernel-m8/out + +if [ "${KERNEL_OUT_DIR}" = "" ] +then + KERNEL_OUT_DIR=${BASE_PATH}/../../../../../common/ fi show_help() diff --git a/optee/Makefile b/optee/Makefile old mode 100755 new mode 100644 diff --git a/tee_shm.c b/tee_shm.c index b820d4b..89b1c07 100755 --- a/tee_shm.c +++ b/tee_shm.c @@ -81,6 +81,12 @@ static void tee_shm_op_release(struct dma_buf *dmabuf) tee_shm_release(shm); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 12) +static void *tee_shm_op_map(struct dma_buf *dmabuf, unsigned long pgnum) +{ + return NULL; +} +#else static void *tee_shm_op_kmap_atomic(struct dma_buf *dmabuf, unsigned long pgnum) { return NULL; @@ -90,6 +96,7 @@ static void *tee_shm_op_kmap(struct dma_buf *dmabuf, unsigned long pgnum) { return NULL; } +#endif static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) { @@ -104,8 +111,12 @@ static struct dma_buf_ops tee_shm_dma_buf_ops = { .map_dma_buf = tee_shm_op_map_dma_buf, .unmap_dma_buf = tee_shm_op_unmap_dma_buf, .release = tee_shm_op_release, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 12) + .map = tee_shm_op_map, +#else .kmap_atomic = tee_shm_op_kmap_atomic, .kmap = tee_shm_op_kmap, +#endif .mmap = tee_shm_op_mmap, }; -- 2.20.1