From 4889cd93b052a0ee450b3201b78ff1f103c8a22a Mon Sep 17 00:00:00 2001 From: daiss1 Date: Mon, 17 Aug 2020 18:21:18 +0800 Subject: [PATCH] dubai: bring up goodix fingerprint for android R Modify: bring up goodix fingerprint for android R mq@@r-shm2018.xml *NOT* needed on the branch(es) above just ignore R2D2. Change-Id: I4e488dc03830f8dc00eac9b9e9cd745680db28fc Signed-off-by: daiss1 Reviewed-on: https://gerrit.mot.com/1724630 Tested-by: Jira Key SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- drivers/input/misc/goodix_fod_mmi/Kbuild | 2 +- drivers/input/misc/goodix_fod_mmi/gf_spi.c | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/input/misc/goodix_fod_mmi/Kbuild b/drivers/input/misc/goodix_fod_mmi/Kbuild index 18541a461c7b..e3f81c89b1ba 100644 --- a/drivers/input/misc/goodix_fod_mmi/Kbuild +++ b/drivers/input/misc/goodix_fod_mmi/Kbuild @@ -1,6 +1,6 @@ # add -Wall to try to catch everything we can. EXTRA_CFLAGS += -Wall -EXTRA_CFLAGS += -I$(TOP)/motorola/kernel/modules/include \ +EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include \ goodix_fod_mmi-y += gf_spi.o netlink.o platform.o diff --git a/drivers/input/misc/goodix_fod_mmi/gf_spi.c b/drivers/input/misc/goodix_fod_mmi/gf_spi.c index ae340809c3fe..1bdcb4b91d47 100644 --- a/drivers/input/misc/goodix_fod_mmi/gf_spi.c +++ b/drivers/input/misc/goodix_fod_mmi/gf_spi.c @@ -50,6 +50,7 @@ #elif defined(USE_PLATFORM_BUS) #include #endif +#include #define VER_MAJOR 1 #define VER_MINOR 2 @@ -470,10 +471,20 @@ static long gf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (_IOC_TYPE(cmd) != GF_IOC_MAGIC) return -ENODEV; - if (_IOC_DIR(cmd) & _IOC_READ) - retval = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd)); - else if (_IOC_DIR(cmd) & _IOC_WRITE) - retval = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd)); + if (_IOC_DIR(cmd) & _IOC_READ){ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) + retval = !access_ok((void __user *)arg, _IOC_SIZE(cmd)); +#else + retval = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd)); +#endif + } + else if (_IOC_DIR(cmd) & _IOC_WRITE){ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) + retval = !access_ok((void __user *)arg, _IOC_SIZE(cmd)); +#else + retval = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd)); +#endif + } if (retval) return -EFAULT; @@ -708,6 +719,7 @@ static const struct file_operations gf_fops = { static int goodix_fb_state_chg_callback(struct notifier_block *nb, unsigned long val, void *data) { +#if 0 struct gf_dev *gf_dev; struct fb_event *evdata = data; int blank; @@ -748,6 +760,7 @@ static int goodix_fb_state_chg_callback(struct notifier_block *nb, break; } } +#endif return NOTIFY_OK; }