mmi_annotate: support build in kernel-5.10

build error:
make[2]: Entering directory '/home/xizx/work/moto/8450/pine_20210507_08_userdebug/out/msm-waipio-waipio-gki/common'
  CC [M]  /home/xizx/work/moto/8450/pine_20210507_08_userdebug/motorola/kernel/modules/drivers/mmi_annotate/mmi_annotate.o
/home/xizx/work/moto/8450/pine_20210507_08_userdebug/motorola/kernel/modules/drivers/mmi_annotate/mmi_annotate.c:229:15: error: incompatible pointer types passing 'const struct file_operations *' to parameter of type 'const struct proc_ops *' [-Werror,-Wincompatible-pointer-types]
                0444, NULL, &mmi_annotate_operations);
                            ^~~~~~~~~~~~~~~~~~~~~~~~
/home/xizx/work/moto/8450/pine_20210507_08_userdebug/kernel_platform/common/include/linux/proc_fs.h:109:122: note: passing argument to parameter 'proc_ops' here
struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct proc_ops *proc_ops);
                                                                                                                         ^
1 error generated.

Change-Id: I6bc25e9e74cae7582862b83b29796538271e9406
Reviewed-on: https://gerrit.mot.com/1949924
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xianshan Wang <wangxs8@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
xizx 2021-05-09 13:55:04 +08:00 • committed by Xianshan Wang
commit f9b4963d4d
2 changed files with 22 additions and 6 deletions

View file

@ -1,10 +1,14 @@
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
all: modules
all:
$(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS)
modules:
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
modules_install:
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
%:
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
rm -rf .tmp_versions

View file

@ -23,12 +23,14 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/ctype.h>
#include <linux/version.h>
#if KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE
#include <linux/dma-contiguous.h>
#endif
#include <linux/dma-mapping.h>
#include <linux/mmi_annotate.h>
#include <linux/seq_file.h>
#include <linux/fs.h>
#include <linux/version.h>
#define MAX_USER_STR 1024
#define DEFAULT_MEM_SIZE 4096
@ -92,6 +94,15 @@ static ssize_t mmi_annotate_write(struct file *file, const char __user *buf,
return count;
}
#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
static const struct proc_ops mmi_annotate_operations = {
.proc_open = mmi_annotate_open,
.proc_read = seq_read,
.proc_write = mmi_annotate_write,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#else
static const struct file_operations mmi_annotate_operations = {
.open = mmi_annotate_open,
.read = seq_read,
@ -99,6 +110,7 @@ static const struct file_operations mmi_annotate_operations = {
.llseek = seq_lseek,
.release = single_release,
};
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
static void* mmi_annotate_ram_vmap(phys_addr_t start, size_t size)