[WCNCR00152844] cfg80211: Fix compile errors for linux-4.1.y

[Description]
Fix compile errors for linux-4.1.y due to:
- linux-4.0.y cfg80211: removed station_info_flags and changed to
  use nl80211_sta_info (in nl80211)
- linux-4.1.y cfg80211: added a new parameter to .add_virtual_intf
  callback in struct cfg80211_ops
- commit <32adcebc> ("Fix coding style to follow Kernel 4.4")

Test build ok with following Linux kernel versions:
3.10, 3.13, 3.18, 4.1, 4.4

Change-Id: Ie927cd66474f52216646e936cad4bfb8ed672742
CR-Id: WCNCR00152844
Feature: cfg80211
Signed-off-by: George Kuo <george.kuo@mediatek.com>
diff --git a/os/linux/gl_cfg80211.c b/os/linux/gl_cfg80211.c
index 2a61d2f..9952451 100644
--- a/os/linux/gl_cfg80211.c
+++ b/os/linux/gl_cfg80211.c
@@ -461,7 +461,7 @@
 		rStatus = kalIoctl(prGlueInfo,
 				   wlanoidQueryLinkSpeed, &u4Rate, sizeof(u4Rate), TRUE, FALSE, FALSE, &u4BufLen);
 
-#if KERNEL_VERSION(4, 4, 0) <= CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 0, 0) <= CFG80211_VERSION_CODE
 		sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
 #else
 		sinfo->filled |= STATION_INFO_TX_BITRATE;
@@ -489,7 +489,7 @@
 		rStatus = kalIoctl(prGlueInfo,
 				   wlanoidQueryRssi, &i4Rssi, sizeof(i4Rssi), TRUE, FALSE, FALSE, &u4BufLen);
 
-#if KERNEL_VERSION(4, 4, 0) <= CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 0, 0) <= CFG80211_VERSION_CODE
 		sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
 #else
 		sinfo->filled |= STATION_INFO_SIGNAL;
@@ -510,7 +510,7 @@
 
 	if (prDevStats) {
 		/* 4. fill RX_PACKETS */
-#if KERNEL_VERSION(4, 4, 0) <= CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 0, 0) <= CFG80211_VERSION_CODE
 		sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
 #else
 		sinfo->filled |= STATION_INFO_RX_PACKETS;
@@ -518,7 +518,7 @@
 		sinfo->rx_packets = prDevStats->rx_packets;
 
 		/* 5. fill TX_PACKETS */
-#if KERNEL_VERSION(4, 4, 0) <= CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 0, 0) <= CFG80211_VERSION_CODE
 		sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
 #else
 		sinfo->filled |= STATION_INFO_TX_PACKETS;
@@ -544,7 +544,7 @@
 			u4TotalError = rQueryStaStatistics.u4TxFailCount + rQueryStaStatistics.u4TxLifeTimeoutCount;
 			prDevStats->tx_errors += u4TotalError;
 		}
-#if KERNEL_VERSION(4, 4, 0) <= CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 0, 0) <= CFG80211_VERSION_CODE
 		sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED);
 #else
 		sinfo->filled |= STATION_INFO_TX_FAILED;
diff --git a/os/linux/gl_p2p_cfg80211.c b/os/linux/gl_p2p_cfg80211.c
index cd4ce9a..58cd879 100644
--- a/os/linux/gl_p2p_cfg80211.c
+++ b/os/linux/gl_p2p_cfg80211.c
@@ -260,7 +260,7 @@
 
 }				/* mtk_Netdev_To_RoleIdx */
 
-#if KERNEL_VERSION(4, 4, 0) <= CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE
 struct wireless_dev *mtk_p2p_cfg80211_add_iface(struct wiphy *wiphy,
 						const char *name, unsigned char name_assign_type,
 						enum nl80211_iftype type, u32 *flags, struct vif_params *params)
@@ -822,7 +822,7 @@
 		p2pFuncGetStationInfo(prGlueInfo->prAdapter, (PUINT_8)mac, &rP2pStaInfo);
 
 		/* Inactive time. */
-#if KERNEL_VERSION(4, 4, 0) <= CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 0, 0) <= CFG80211_VERSION_CODE
 		sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);
 #else
 		sinfo->filled |= STATION_INFO_INACTIVE_TIME;
diff --git a/os/linux/gl_p2p_kal.c b/os/linux/gl_p2p_kal.c
index cd709b6..c1f42ab 100644
--- a/os/linux/gl_p2p_kal.c
+++ b/os/linux/gl_p2p_kal.c
@@ -1253,7 +1253,7 @@
 
 			kalMemZero(&rStationInfo, sizeof(rStationInfo));
 
-#if KERNEL_VERSION(4, 4, 0) > CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 0, 0) > CFG80211_VERSION_CODE
 			rStationInfo.filled = STATION_INFO_ASSOC_REQ_IES;
 #endif
 			rStationInfo.generation = ++prP2pGlueInfo->i4Generation;
diff --git a/os/linux/include/gl_kal.h b/os/linux/include/gl_kal.h
index d316665..4067987 100644
--- a/os/linux/include/gl_kal.h
+++ b/os/linux/include/gl_kal.h
@@ -582,7 +582,7 @@
 /* Move memory block with specific size */
 #define kalMemMove(pvDst, pvSrc, u4Size)            memmove(pvDst, pvSrc, u4Size)
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
+#if KERNEL_VERSION(4, 0, 0) <= LINUX_VERSION_CODE
 #define strnicmp(s1, s2, n)                         strncasecmp(s1, s2, n)
 #endif
 
diff --git a/os/linux/include/gl_p2p_ioctl.h b/os/linux/include/gl_p2p_ioctl.h
index 9711aa4..4b2462a 100644
--- a/os/linux/include/gl_p2p_ioctl.h
+++ b/os/linux/include/gl_p2p_ioctl.h
@@ -369,7 +369,7 @@
 
 #if (CFG_ENABLE_WIFI_DIRECT_CFG_80211 != 0)
 
-#if KERNEL_VERSION(4, 4, 0) <= CFG80211_VERSION_CODE
+#if KERNEL_VERSION(4, 1, 0) <= CFG80211_VERSION_CODE
 struct wireless_dev *mtk_p2p_cfg80211_add_iface(struct wiphy *wiphy,
 						const char *name, unsigned char name_assign_type,
 						enum nl80211_iftype type, u32 *flags, struct vif_params *params);