diff options
author | davidycchen <davidycchen@google.com> | 2021-08-23 14:03:38 +0800 |
---|---|---|
committer | davidycchen <davidycchen@google.com> | 2021-09-08 15:13:37 +0800 |
commit | 7363f13daa302159b13a77d3c7769f46535a2f38 (patch) | |
tree | 71d0a8b71e57f165b93a547ee91a09e69006ff10 | |
parent | b709f4d97bb33d74ff5a14f8ff8c617b5f605c67 (diff) | |
download | synaptics_touch-7363f13daa302159b13a77d3c7769f46535a2f38.tar.gz |
synaptics: fix build break
Use kernel 5.10 time structure and ioctl.
Bug: 198228556
Test: build pass.
Signed-off-by: davidycchen <davidycchen@google.com>
Change-Id: I1c91f177c1180e50803cd6f2b8461c05acb4c1de
-rw-r--r-- | syna_tcm2_sysfs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/syna_tcm2_sysfs.c b/syna_tcm2_sysfs.c index 84677bc..c2034f5 100644 --- a/syna_tcm2_sysfs.c +++ b/syna_tcm2_sysfs.c @@ -159,7 +159,11 @@ struct fifo_queue { struct list_head next; unsigned char *fifo_data; unsigned int data_length; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)) + struct timespec64 timestamp; +#else struct timeval timestamp; +#endif }; @@ -664,7 +668,11 @@ static int syna_cdev_insert_fifo(struct syna_tcm *tcm, pfifo_data->data_length = length; memcpy((void *)pfifo_data->fifo_data, (void *)buf_ptr, length); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)) + ktime_get_real_ts64(&(pfifo_data->timestamp)); +#else do_gettimeofday(&(pfifo_data->timestamp)); +#endif /* append the data to the tail for FIFO queueing */ list_add_tail(&pfifo_data->next, &tcm->frame_fifo_queue); tcm->fifo_remaining_frame++; @@ -1586,7 +1594,8 @@ static int syna_cdev_ioctl_old_dispatch(struct syna_tcm *tcm, * @return * on success, 0; otherwise, negative value on error. */ -#ifdef HAVE_UNLOCKED_IOCTL +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) || \ + defined (HAVE_UNLOCKED_IOCTL) static long syna_cdev_ioctls(struct file *filp, unsigned int cmd, unsigned long arg) #else @@ -1935,7 +1944,8 @@ static int syna_cdev_release(struct inode *inp, struct file *filp) */ static const struct file_operations device_fops = { .owner = THIS_MODULE, -#ifdef HAVE_UNLOCKED_IOCTL +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) || \ + defined (HAVE_UNLOCKED_IOCTL) .unlocked_ioctl = syna_cdev_ioctls, #if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL) .compat_ioctl = syna_cdev_compat_ioctls, |