diff -Naur a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c
--- a/os_dep/linux/ioctl_linux.c	2016-02-07 05:05:49.000000000 -0800
+++ b/os_dep/linux/ioctl_linux.c	2016-04-19 12:35:27.647180055 -0700
@@ -13908,7 +13908,11 @@
 static int rtw_ioctl_wext_private(struct net_device *dev, struct ifreq *rq)
 {
 #ifdef CONFIG_COMPAT
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
+    if(in_compat_syscall())
+#else
     if(is_compat_task())
+#endif
         return rtw_ioctl_compat_wext_private( dev, rq );
     else
 #endif // CONFIG_COMPAT
diff -Naur a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c
--- a/os_dep/linux/rtw_android.c	2016-02-07 05:05:49.000000000 -0800
+++ b/os_dep/linux/rtw_android.c	2016-04-19 12:39:24.551833041 -0700
@@ -577,7 +577,11 @@
             goto exit;
     }
 #ifdef CONFIG_COMPAT
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
+    if (in_compat_syscall()) {
+#else
     if (is_compat_task()) {
+#endif
         /* User space is 32-bit, use compat ioctl */
         compat_android_wifi_priv_cmd compat_priv_cmd;
 
