Преглед изворни кода

qcacld-3.0: Use in_compat_syscall() to check compatness

Use in_compat_syscall() to query the syscall type, so it works properly
on all architectures. Also maintain backward compatibility with older
kernel.

Change-Id: Ife19c9874dcacc18c5d19c1175988bee66ea1cdd
CRs-Fixed: 2215566
Mahesh Kumar Kalikot Veetil пре 7 година
родитељ
комит
885a77b67c

+ 10 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -113,6 +113,16 @@
 #define NUM_TX_QUEUES 4
 #endif
 
+/*
+ * API in_compat_syscall() is introduced in 4.6 kernel to check whether we're
+ * in a compat syscall or not. It is a new way to query the syscall type, which
+ * works properly on all architectures.
+ *
+ */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
+static inline bool in_compat_syscall(void) { return is_compat_task(); }
+#endif
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \
 	defined(CFG80211_REMOVE_IEEE80211_BACKPORT)
 #define HDD_NL80211_BAND_2GHZ   NL80211_BAND_2GHZ

+ 1 - 1
core/hdd/src/wlan_hdd_ftm.c

@@ -205,7 +205,7 @@ int wlan_hdd_qcmbr_unified_ioctl(struct hdd_adapter *adapter,
 {
 	int ret = 0;
 
-	if (is_compat_task())
+	if (in_compat_syscall())
 		ret = wlan_hdd_qcmbr_compat_ioctl(adapter, ifr);
 	else
 		ret = wlan_hdd_qcmbr_ioctl(adapter, ifr);

+ 1 - 1
core/hdd/src/wlan_hdd_ioctl.c

@@ -7081,7 +7081,7 @@ static int __hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
 	switch (cmd) {
 	case (SIOCDEVPRIVATE + 1):
-		if (is_compat_task())
+		if (in_compat_syscall())
 			ret = hdd_driver_compat_ioctl(adapter, ifr);
 		else
 			ret = hdd_driver_ioctl(adapter, ifr);

+ 2 - 2
core/hdd/src/wlan_hdd_wext.c

@@ -2952,7 +2952,7 @@ int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
 		return -EINVAL;
 
 #ifdef CONFIG_COMPAT
-	if (is_compat_task()) {
+	if (in_compat_syscall()) {
 		struct compat_iw_point *p_compat_priv_data;
 
 		/* Compat task:
@@ -6979,7 +6979,7 @@ static int __iw_setnone_getnone(struct net_device *dev,
 	 * compat support in the kernel does not handle this case.  so we
 	 * need to explicitly handle it here.
 	 */
-	if (is_compat_task()) {
+	if (in_compat_syscall()) {
 		struct compat_iw_point *compat_iw_point =
 			(struct compat_iw_point *)&wrqu->data;
 		sub_cmd = compat_iw_point->flags;