fix ST NFC driver compile error

Some API changed with Kernel 5.4 version
fix ST NFC driver compile error on Kernel 5.4

Change-Id: I1be44a5405907e4d2abdf26c2723302b3063ec29
Signed-off-by: Ningkai Zhuang <zhuangnk1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1702766
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Zishang Zhou <zhouzs1@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Ningkai Zhuang 2020-07-23 15:40:15 +08:00
commit b5a4e03b9f

View file

@ -384,11 +384,19 @@ static long st21nfc_dev_ioctl(struct file *filp, unsigned int cmd,
* from the kernel perspective; so they look reversed.
*/
if (_IOC_DIR(cmd) & _IOC_READ)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
ret = !access_ok((void __user *)arg, _IOC_SIZE(cmd));
#else
ret = !access_ok(VERIFY_WRITE,
(void __user *)arg, _IOC_SIZE(cmd));
#endif
if (ret == 0 && _IOC_DIR(cmd) & _IOC_WRITE)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
ret = !access_ok((void __user *)arg, _IOC_SIZE(cmd));
#else
ret = !access_ok(VERIFY_READ,
(void __user *)arg, _IOC_SIZE(cmd));
#endif
if (ret)
return -EFAULT;