lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 29 May 2015 22:52:12 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Greg KH <gregkh@...uxfoundation.org>
Cc:	Rachel Kim <rachel.kim@...el.com>, Dean Lee <dean.lee@...el.com>,
	Chris Park <chris.park@...el.com>, devel@...verdev.osuosl.org,
	nicolas.ferre@...el.com, Johnny Kim <johnny.kim@...el.com>,
	linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>
Subject: [PATCH 01/16] staging: wilc1000: remove linux version checks

For code that is integrated into mainline Linux, checks for
the kernel version make no sense, because we know which version
we are compiling against.

This removes all checks and the associated dead code.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 drivers/staging/wilc1000/linux_wlan.c             |  88 +---
 drivers/staging/wilc1000/wilc_sleep.c             |   8 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 486 +---------------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   7 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |   8 -
 5 files changed, 5 insertions(+), 592 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 18f1bd00201a..3f8b3c54f196 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -180,7 +180,6 @@ linux_wlan_t *g_linux_wlan;
 wilc_wlan_oup_t *gpstrWlanOps;
 WILC_Bool bEnablePS = WILC_TRUE;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
 static const struct net_device_ops wilc_netdev_ops = {
 	.ndo_init = mac_init_fn,
 	.ndo_open = mac_open,
@@ -191,37 +190,7 @@ static const struct net_device_ops wilc_netdev_ops = {
 	.ndo_set_rx_mode  = wilc_set_multicast_list,
 
 };
-#define wilc_set_netdev_ops(ndev) do { (ndev)->netdev_ops = &wilc_netdev_ops; } while (0)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
 
-static const struct net_device_ops wilc_netdev_ops = {
-	.ndo_init = mac_init_fn,
-	.ndo_open = mac_open,
-	.ndo_stop = mac_close,
-	.ndo_start_xmit = mac_xmit,
-	.ndo_do_ioctl = mac_ioctl,
-	.ndo_get_stats = mac_stats,
-	.ndo_set_multicast_list = wilc_set_multicast_list,
-
-};
-
-#define wilc_set_netdev_ops(ndev) do { (ndev)->netdev_ops = &wilc_netdev_ops; } while (0)
-
-#else
-
-static void wilc_set_netdev_ops(struct net_device *ndev)
-{
-
-	ndev->init = mac_init_fn;
-	ndev->open = mac_open;
-	ndev->stop = mac_close;
-	ndev->hard_start_xmit = mac_xmit;
-	ndev->do_ioctl = mac_ioctl;
-	ndev->get_stats = mac_stats;
-	ndev->set_multicast_list = wilc_set_multicast_list,
-}
-
-#endif
 #ifdef DEBUG_MODE
 
 extern volatile int timeNo;
@@ -594,12 +563,7 @@ static void linux_wlan_msleep(uint32_t msc)
 {
 	if (msc <= 4000000) {
 		WILC_Uint32 u32Temp = msc * 1000;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
 		usleep_range(u32Temp, u32Temp);
-#else
-		/* This is delay not sleep !!!, has to be changed*/
-		msleep(msc);
-#endif
 	} else {
 		msleep(msc);
 	}
@@ -2195,7 +2159,6 @@ struct net_device_stats *mac_stats(struct net_device *dev)
 }
 
 /* Setup the multicast filter */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
 static void wilc_set_multicast_list(struct net_device *dev)
 {
 
@@ -2251,55 +2214,6 @@ static void wilc_set_multicast_list(struct net_device *dev)
 
 }
 
-#else
-
-static void wilc_set_multicast_list(struct net_device *dev)
-{
-	/* BIG Warning, Beware : Uncompiled, untested... */
-	struct dev_mc_list *mc_ptr;
-	int i = 0;
-
-	if (!dev)
-		return;
-
-	PRINT_D(INIT_DBG, "Setting Multicast List. \n");
-	PRINT_D(INIT_DBG, "dev->mc_count = %d\n", dev->mc_count);
-
-	if (dev->flags & IFF_PROMISC) {
-		/* Normally, we should configure the chip to retrive all packets
-		 * but we don't wanna support this right now */
-		/* TODO: add promiscuous mode support */
-		PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets \n");
-		return;
-	}
-
-	/* If there's more addresses than we handle, get all multicast
-	 * packets and sort them out in software. */
-	if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > WILC_MULTICAST_TABLE_SIZE)) {
-		PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n");
-		host_int_setup_multicast_filter((WILC_WFIDrvHandle)gWFiDrvHandle, WILC_FALSE, 0);
-		return;
-	}
-
-	/* No multicast?  Just get our own stuff */
-	if (dev->mc_count == 0) {
-		PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n");
-		host_int_setup_multicast_filter((WILC_WFIDrvHandle)gWFiDrvHandle, WILC_TRUE, 0);
-		return;
-	}
-
-	/* Store all of the multicast addresses in the hardware filter */
-
-	for (mc_ptr = dev->mc_list; mc_ptr; mc_ptr = mc_ptr->next, i++) {
-		WILC_memcpy(gau8MulticastMacAddrList[i], mc_ptr->dmi_addr, ETH_ALEN)
-		i++;
-	}
-
-	host_int_setup_multicast_filter((WILC_WFIDrvHandle)gWFiDrvHandle, WILC_TRUE, (dev->mc_count));
-
-}
-#endif
-
 static void linux_wlan_tx_complete(void *priv, int status)
 {
 
@@ -2765,7 +2679,7 @@ int wilc_netdev_init(void)
 		nic->wilc_netdev = ndev;
 		g_linux_wlan->strInterfaceInfo[g_linux_wlan->u8NoIfcs].wilc_netdev = ndev;
 		g_linux_wlan->u8NoIfcs++;
-		wilc_set_netdev_ops(ndev);
+		ndev->netdev_ops = &wilc_netdev_ops;
 
 		#ifdef USE_WIRELESS
 		{
diff --git a/drivers/staging/wilc1000/wilc_sleep.c b/drivers/staging/wilc1000/wilc_sleep.c
index 368157175f40..b8f45146956b 100644
--- a/drivers/staging/wilc1000/wilc_sleep.c
+++ b/drivers/staging/wilc1000/wilc_sleep.c
@@ -12,11 +12,7 @@ void WILC_Sleep(WILC_Uint32 u32TimeMilliSec)
 {
 	if (u32TimeMilliSec <= 4000000)	{
 		WILC_Uint32 u32Temp = u32TimeMilliSec * 1000;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
 		usleep_range(u32Temp, u32Temp);
-#else
-		udelay(u32Temp);
-#endif
 	} else {
 		msleep(u32TimeMilliSec);
 	}
@@ -27,10 +23,6 @@ void WILC_Sleep(WILC_Uint32 u32TimeMilliSec)
 /* #ifdef CONFIG_WILC_SLEEP_HI_RES */
 void WILC_SleepMicrosec(WILC_Uint32 u32TimeMicoSec)
 {
-	#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
 	usleep_range(u32TimeMicoSec, u32TimeMicoSec);
-	#else
-	udelay(u32TimeMicoSec);
-	#endif
 }
 /* #endif */
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 648472925de0..c1d511825147 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -126,9 +126,7 @@ static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
 /*BugID_5137*/
 struct add_key_params {
 	u8 key_idx;
-	#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 	bool pairwise;
-	#endif
 	u8 *mac_addr;
 };
 struct add_key_params g_add_gtk_key_params;
@@ -202,30 +200,15 @@ void refresh_scan(void *pUserVoid, uint8_t all, WILC_Bool bDirectScan)
 
 			if (pstrNetworkInfo != WILC_NULL) {
 
-				#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
 				s32Freq = ieee80211_channel_to_frequency((WILC_Sint32)pstrNetworkInfo->u8channel, IEEE80211_BAND_2GHZ);
-				#else
-				s32Freq = ieee80211_channel_to_frequency((WILC_Sint32)pstrNetworkInfo->u8channel);
-				#endif
-
 				channel = ieee80211_get_channel(wiphy, s32Freq);
 
 				rssi = get_rssi_avg(pstrNetworkInfo);
 				if (WILC_memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7) || bDirectScan)	{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
 					bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo,
 								  pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs,
 								  (size_t)pstrNetworkInfo->u16IEsLen, (((WILC_Sint32)rssi) * 100), GFP_KERNEL);
-#else
-					bss = cfg80211_inform_bss(wiphy, channel, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo,
-								  pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs,
-								  (size_t)pstrNetworkInfo->u16IEsLen, (((WILC_Sint32)rssi) * 100), GFP_KERNEL);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
 					cfg80211_put_bss(wiphy, bss);
-#else
-					cfg80211_put_bss(bss);
-#endif
 				}
 			}
 
@@ -417,11 +400,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
 			}
 
 			if (pstrNetworkInfo != WILC_NULL) {
-				#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
 				s32Freq = ieee80211_channel_to_frequency((WILC_Sint32)pstrNetworkInfo->u8channel, IEEE80211_BAND_2GHZ);
-				#else
-				s32Freq = ieee80211_channel_to_frequency((WILC_Sint32)pstrNetworkInfo->u8channel);
-				#endif
 				channel = ieee80211_get_channel(wiphy, s32Freq);
 
 				WILC_NULLCHECK(s32Error, channel);
@@ -448,20 +427,10 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
 						/*P2P peers are sent to WPA supplicant and added to shadow table*/
 
 						if (!(WILC_memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7))) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
 							bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN,  pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo,
 										  pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs,
 										  (size_t)pstrNetworkInfo->u16IEsLen, (((WILC_Sint32)pstrNetworkInfo->s8rssi) * 100), GFP_KERNEL);
-#else
-							bss = cfg80211_inform_bss(wiphy, channel, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo,
-										  pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs,
-										  (size_t)pstrNetworkInfo->u16IEsLen, (((WILC_Sint32)pstrNetworkInfo->s8rssi) * 100), GFP_KERNEL);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
 							cfg80211_put_bss(wiphy, bss);
-#else
-							cfg80211_put_bss(bss);
-#endif
 						}
 
 
@@ -730,27 +699,8 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
  *  @date	01 MAR 2012
  *  @version	1.0
  */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
-/*
- *	struct changed from v3.8.0
- *	tony, sswd, WILC-KR, 2013-10-29
- *	struct cfg80211_chan_def {
- *       struct ieee80211_channel *chan;
- *       enum nl80211_chan_width width;
- *       u32 center_freq1;
- *       u32 center_freq2;
- *      };
- */
 static int WILC_WFI_CfgSetChannel(struct wiphy *wiphy,
 				  struct cfg80211_chan_def *chandef)
-#else
-static int WILC_WFI_CfgSetChannel(struct wiphy *wiphy,
-	#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
-				  struct net_device *netdev,
-	#endif
-				  struct ieee80211_channel *channel,
-				  enum nl80211_channel_type channel_type)
-#endif
 {
 
 	WILC_Uint32 channelnum = 0;
@@ -758,14 +708,8 @@ static int WILC_WFI_CfgSetChannel(struct wiphy *wiphy,
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	priv = wiphy_priv(wiphy);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) /* tony for v3.8.0 support */
 	channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq);
 	PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq);
-#else
-	channelnum = ieee80211_frequency_to_channel(channel->center_freq);
-
-	PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, channel->center_freq);
-#endif
 
 	u8CurrChannel = channelnum;
 	s32Error   = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
@@ -793,11 +737,7 @@ static int WILC_WFI_CfgSetChannel(struct wiphy *wiphy,
  *	kernel version 3.8.8 supported
  *	tony, sswd, WILC-KR, 2013-10-29
  */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
 static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
-#else
-static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_scan_request *request)
-#endif
 {
 	struct WILC_WFI_priv *priv;
 	WILC_Uint32 i;
@@ -807,10 +747,6 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct net_device *dev, struct
 
 	priv = wiphy_priv(wiphy);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)
-	PRINT_D(CORECONFIG_DBG, "Scan on netdev [%p] host if [%x]\n", dev, (WILC_Uint32)priv->hWILCWFIDrv);
-#endif
-
 	/*if(connecting)
 	 *              return -EBUSY; */
 
@@ -819,18 +755,10 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct net_device *dev, struct
 	/*requests "create group" during a running scan*/
 	/* host_int_set_wfi_drv_handler(priv->hWILCWFIDrv); */
 #if 0
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) /* tony for v3.8.0 support */
 	if (priv->dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP) {
 		PRINT_D(GENERIC_DBG, "Required scan while in AP mode");
 		return s32Error;
 	}
-#else
-	if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP) {
-		PRINT_D(GENERIC_DBG, "Required scan while in AP mode");
-		s32Error = WILC_BUSY;
-		return s32Error;
-	}
-#endif
 #endif /* end of if 0 */
 	priv->pstrScanReq = request;
 
@@ -1224,9 +1152,7 @@ static int WILC_WFI_disconnect(struct wiphy *wiphy, struct net_device *dev, u16
  *  @version	1.0
  */
 static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
-	#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 			    bool pairwise,
-	#endif
 			    const u8 *mac_addr, struct key_params *params)
 
 {
@@ -1316,11 +1242,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
 
 
 
-					#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 			if (!pairwise)
-					#else
-			if (!mac_addr || is_broadcast_ether_addr(mac_addr))
-					#endif
 			{
 				if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
 					u8gmode = ENCRYPT_ENABLED | WPA | TKIP;
@@ -1419,11 +1341,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
 
 		{
 			u8mode = 0;
-			 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 			if (!pairwise)
-			 #else
-			if (!mac_addr || is_broadcast_ether_addr(mac_addr))
-			#endif
 			{
 				if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
 					/* swap the tx mic by rx mic */
@@ -1436,9 +1354,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
 				/*save keys only on interface 0 (wifi interface)*/
 				if (!g_gtk_keys_saved && netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
 					g_add_gtk_key_params.key_idx = key_index;
-						#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 					g_add_gtk_key_params.pairwise = pairwise;
-						#endif
 					if (!mac_addr) {
 						g_add_gtk_key_params.mac_addr = NULL;
 					} else {
@@ -1476,9 +1392,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
 				/*save keys only on interface 0 (wifi interface)*/
 				if (!g_ptk_keys_saved && netdev == g_linux_wlan->strInterfaceInfo[0].wilc_netdev) {
 					g_add_ptk_key_params.key_idx = key_index;
-						#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 					g_add_ptk_key_params.pairwise = pairwise;
-						#endif
 					if (!mac_addr) {
 						g_add_ptk_key_params.mac_addr = NULL;
 					} else {
@@ -1533,9 +1447,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
  */
 static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
 			    u8 key_index,
-	#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 			    bool pairwise,
-	#endif
 			    const u8 *mac_addr)
 {
 	struct WILC_WFI_priv *priv;
@@ -1645,9 +1557,7 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev,
  *  @version	1.0
  */
 static int WILC_WFI_get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
-	#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 			    bool pairwise,
-	#endif
 			    const u8 *mac_addr, void *cookie, void (*callback)(void *cookie, struct key_params *))
 {
 
@@ -1659,11 +1569,7 @@ static int WILC_WFI_get_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
 	priv = wiphy_priv(wiphy);
 
 
-		#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 	if (!pairwise)
-		#else
-	if (!mac_addr || is_broadcast_ether_addr(mac_addr))
-		#endif
 	{
 		PRINT_D(CFG80211_DBG, "Getting group key idx: %x\n", key_index);
 
@@ -1700,11 +1606,8 @@ static int WILC_WFI_get_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
  *  @date	01 MAR 2012
  *  @version	1.0
  */
-static int WILC_WFI_set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index
-	#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 37)
-				    , bool unicast, bool multicast
-	#endif
-				    )
+static int WILC_WFI_set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
+				    bool unicast, bool multicast)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	struct WILC_WFI_priv *priv;
@@ -1794,11 +1697,7 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
 			return s32Error;
 		}
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)	//0421
 		sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);
-#else
-		sinfo->filled |= STATION_INFO_INACTIVE_TIME;
-#endif
 
 		host_int_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time));
 		sinfo->inactive_time = 1000 * inactive_time;
@@ -1816,26 +1715,16 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
 		 * tx_failed introduced more than
 		 * kernel version 3.0.0
 		 */
-	#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)	//0421
 		sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
 						BIT( NL80211_STA_INFO_RX_PACKETS) |
 						BIT(NL80211_STA_INFO_TX_PACKETS) |
 						BIT(NL80211_STA_INFO_TX_FAILED) |
 						BIT(NL80211_STA_INFO_TX_BITRATE);
-    #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
-		sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS
-			| STATION_INFO_TX_FAILED | STATION_INFO_TX_BITRATE;
-    #else
-		sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS
-			| STATION_INFO_TX_BITRATE;
-    #endif
 
 		sinfo->signal		=  strStatistics.s8RSSI;
 		sinfo->rx_packets   =  strStatistics.u32RxCount;
 		sinfo->tx_packets   =  strStatistics.u32TxCount + strStatistics.u32TxFailureCount;
-    #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
 		sinfo->tx_failed	=  strStatistics.u32TxFailureCount;
-    #endif
 		sinfo->txrate.legacy = strStatistics.u8LinkSpeed * 10;
 
 #ifdef TCP_ENHANCEMENTS
@@ -1846,13 +1735,8 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
 		}
 #endif
 
-    #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
 		PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets,
 			sinfo->tx_failed, sinfo->txrate.legacy);
-    #else
-		PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets,
-			sinfo->txrate.legacy);
-    #endif
 	}
 	return s32Error;
 }
@@ -2008,7 +1892,7 @@ static int WILC_WFI_set_wiphy_params(struct wiphy *wiphy, u32 changed)
 
 	return s32Error;
 }
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
+
 /**
  *  @brief      WILC_WFI_set_bitrate_mask
  *  @details    set the bitrate mask configuration
@@ -2166,7 +2050,6 @@ static int  WILC_WFI_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
 
 	return 0;
 }
-#endif
 
 #ifdef WILC_P2P
 
@@ -2388,29 +2271,17 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size)
 	if (pkt_offset & IS_MANAGMEMENT_CALLBACK) {
 		if (buff[FRAME_TYPE_ID] == IEEE80211_STYPE_PROBE_RESP) {
 			PRINT_D(GENERIC_DBG, "Probe response ACK\n");
-			#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
-			cfg80211_mgmt_tx_status(dev, priv->u64tx_cookie, buff, size, true, GFP_KERNEL);
-			#else
 			cfg80211_mgmt_tx_status(priv->wdev, priv->u64tx_cookie, buff, size, true, GFP_KERNEL);
-			#endif
 			return;
 		} else {
 			if (pkt_offset & IS_MGMT_STATUS_SUCCES)	{
 				PRINT_D(GENERIC_DBG, "Success Ack - Action frame category: %x Action Subtype: %d Dialog T: %x OR %x\n", buff[ACTION_CAT_ID], buff[ACTION_SUBTYPE_ID],
 					buff[ACTION_SUBTYPE_ID + 1], buff[P2P_PUB_ACTION_SUBTYPE + 1]);
-				#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
-				cfg80211_mgmt_tx_status(dev, priv->u64tx_cookie, buff, size, true, GFP_KERNEL);
-				#else
 				cfg80211_mgmt_tx_status(priv->wdev, priv->u64tx_cookie, buff, size, true, GFP_KERNEL);
-				#endif
 			} else {
 				PRINT_D(GENERIC_DBG, "Fail Ack - Action frame category: %x Action Subtype: %d Dialog T: %x OR %x\n", buff[ACTION_CAT_ID], buff[ACTION_SUBTYPE_ID],
 					buff[ACTION_SUBTYPE_ID + 1], buff[P2P_PUB_ACTION_SUBTYPE + 1]);
-				#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
-				cfg80211_mgmt_tx_status(dev, priv->u64tx_cookie, buff, size, false, GFP_KERNEL);
-				#else
 				cfg80211_mgmt_tx_status(priv->wdev, priv->u64tx_cookie, buff, size, false, GFP_KERNEL);
-				#endif
 			}
 			return;
 		}
@@ -2420,11 +2291,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size)
 
 		/*BugID_5442*/
 		/*Upper layer is informed that the frame is received on this freq*/
-		#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)
 		s32Freq = ieee80211_channel_to_frequency(u8CurrChannel, IEEE80211_BAND_2GHZ);
-		#else
-		s32Freq = ieee80211_channel_to_frequency(u8CurrChannel);
-		#endif
 
 		if (ieee80211_is_action(buff[FRAME_TYPE_ID])) {
 			PRINT_D(GENERIC_DBG, "Rx Action Frame Type: %x %x\n", buff[ACTION_SUBTYPE_ID], buff[P2P_PUB_ACTION_SUBTYPE]);
@@ -2478,18 +2345,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size)
 					if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (bWilc_ie))	{
 						PRINT_D(GENERIC_DBG, "Sending P2P to host without extra elemnt\n");
 						/* extra attribute for sig_dbm: signal strength in mBm, or 0 if unknown */
-							#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
 						cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0);
-							#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
-						cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0, GFP_ATOMIC);
-							#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-						cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, GFP_ATOMIC);
-							#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
-						cfg80211_rx_mgmt(dev, s32Freq, 0, buff, size - 7, GFP_ATOMIC);          /* rachel */
-							#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0))
-						cfg80211_rx_mgmt(dev, s32Freq, buff, size - 7, GFP_ATOMIC);
-							#endif
-
 						return;
 					}
 					break;
@@ -2501,17 +2357,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size)
 			}
 		}
 
-		#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
 		cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0);
-		#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0))
-		cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0, GFP_ATOMIC);
-		#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-		cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size, GFP_ATOMIC);
-		#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
-		cfg80211_rx_mgmt(dev, s32Freq, 0, buff, size, GFP_ATOMIC);
-		#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0))
-		cfg80211_rx_mgmt(dev, s32Freq, buff, size, GFP_ATOMIC);
-		#endif
 	}
 }
 
@@ -2553,20 +2399,11 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid)
 
 	priv->bInP2PlistenState = WILC_TRUE;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
 	cfg80211_ready_on_channel(priv->wdev,
 				  priv->strRemainOnChanParams.u64ListenCookie,
 				  priv->strRemainOnChanParams.pstrListenChan,
 				  priv->strRemainOnChanParams.u32ListenDuration,
 				  GFP_KERNEL);
-#else
-	cfg80211_ready_on_channel(priv->dev,
-				  priv->strRemainOnChanParams.u64ListenCookie,
-				  priv->strRemainOnChanParams.pstrListenChan,
-				  priv->strRemainOnChanParams.tenuChannelType,
-				  priv->strRemainOnChanParams.u32ListenDuration,
-				  GFP_KERNEL);
-#endif
 }
 
 /**
@@ -2591,18 +2428,10 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, WILC_Uint32 u32Sess
 		priv->bInP2PlistenState = WILC_FALSE;
 
 		/*Inform wpas of remain-on-channel expiration*/
-	#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
 		cfg80211_remain_on_channel_expired(priv->wdev,
 						   priv->strRemainOnChanParams.u64ListenCookie,
 						   priv->strRemainOnChanParams.pstrListenChan,
 						   GFP_KERNEL);
-	#else
-		cfg80211_remain_on_channel_expired(priv->dev,
-						   priv->strRemainOnChanParams.u64ListenCookie,
-						   priv->strRemainOnChanParams.pstrListenChan,
-						   priv->strRemainOnChanParams.tenuChannelType,
-						   GFP_KERNEL);
-	#endif
 	} else {
 		PRINT_D(GENERIC_DBG, "Received ID 0x%x Expected ID 0x%x (No match)\n", u32SessionID
 			, priv->strRemainOnChanParams.u32ListenSessionID);
@@ -2624,15 +2453,8 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, WILC_Uint32 u32Sess
  *  @version	1.0
  */
 static int  WILC_WFI_remain_on_channel(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
 				       struct wireless_dev *wdev,
-#else
-				       struct net_device *dev,
-#endif
 				       struct ieee80211_channel *chan,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
-				       enum nl80211_channel_type channel_type,
-#endif
 				       unsigned int duration, u64 *cookie)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
@@ -2645,26 +2467,16 @@ static int  WILC_WFI_remain_on_channel(struct wiphy *wiphy,
 	/*This check is to handle the situation when user*/
 	/*requests "create group" during a running scan*/
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
 	if (wdev->iftype == NL80211_IFTYPE_AP) {
 		PRINT_D(GENERIC_DBG, "Required remain-on-channel while in AP mode");
 		return s32Error;
 	}
-#else
-	if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP) {
-		PRINT_D(GENERIC_DBG, "Required remain-on-channel while in AP mode");
-		return s32Error;
-	}
-#endif
 
 	u8CurrChannel = chan->hw_value;
 
 	/*Setting params needed by WILC_WFI_RemainOnChannelExpired()*/
 	priv->strRemainOnChanParams.pstrListenChan = chan;
 	priv->strRemainOnChanParams.u64ListenCookie = *cookie;
-	#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
-	priv->strRemainOnChanParams.tenuChannelType = channel_type;
-	#endif
 	priv->strRemainOnChanParams.u32ListenDuration = duration;
 	priv->strRemainOnChanParams.u32ListenSessionID++;
 
@@ -2693,11 +2505,7 @@ static int  WILC_WFI_remain_on_channel(struct wiphy *wiphy,
  *  @version	1.0
  */
 static int   WILC_WFI_cancel_remain_on_channel(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
 					       struct wireless_dev *wdev,
-#else
-					       struct net_device *dev,
-#endif
 					       u64 cookie)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
@@ -2736,57 +2544,14 @@ void WILC_WFI_add_wilcvendorspec(WILC_Uint8 *buff)
 extern linux_wlan_t *g_linux_wlan;
 extern WILC_Bool bEnablePS;
 int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
 			struct wireless_dev *wdev,
 			struct cfg80211_mgmt_tx_params *params,
 			u64 *cookie)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
-			struct wireless_dev *wdev,
-			struct ieee80211_channel *chan,
-			bool offchan,
-			unsigned int wait,
-			const u8 *buf,
-			size_t len,
-			bool no_cck,
-			bool dont_wait_for_ack, u64 *cookie)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-			struct wireless_dev *wdev,
-			struct ieee80211_channel *chan, bool offchan,
-			enum nl80211_channel_type channel_type,
-			bool channel_type valid,
-			unsigned int wait, const u8 *buf,
-			size_t len, bool no_cck,
-			bool dont_wait_for_ack, u64 *cookie)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-			struct net_device *dev,
-			struct ieee80211_channel *chan, bool offchan,
-			enum nl80211_channel_type channel_type,
-			bool channel_type_valid,
-			unsigned int wait, const u8 *buf,
-			size_t len, bool no_cck,
-			bool dont_wait_for_ack, u64 *cookie)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
-			struct net_device *dev,
-			struct ieee80211_channel *chan, bool offchan,
-			enum nl80211_channel_type channel_type,
-			bool channel_type_valid,
-			unsigned int wait, const u8 *buf,
-			size_t len, bool no_cck, u64 *cookie)
-#else
-			struct net_device *dev,
-			struct ieee80211_channel *chan, bool offchan,
-			enum nl80211_channel_type channel_type,
-			bool channel_type_valid,
-			unsigned int wait, const u8 *buf,
-			size_t len, u64 *cookie)
-#endif
 {
-	#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
 	struct ieee80211_channel *chan = params->chan;
 	unsigned int wait = params->wait;
 	const u8 *buf = params->buf;
 	size_t len = params->len;
-	#endif
 	const struct ieee80211_mgmt *mgmt;
 	struct p2p_mgmt_data *mgmt_tx;
 	struct WILC_WFI_priv *priv;
@@ -2796,11 +2561,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
 	perInterface_wlan_t *nic;
 	WILC_Uint32 buf_len = len + sizeof(u8P2P_vendorspec) + sizeof(u8P2Plocalrandom);
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
 	nic = netdev_priv(wdev->netdev);
-#else
-	nic = netdev_priv(dev);
-#endif
 	priv = wiphy_priv(wiphy);
 	pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv;
 
@@ -2938,11 +2699,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
 }
 
 int   WILC_WFI_mgmt_tx_cancel_wait(struct wiphy *wiphy,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
 				   struct wireless_dev *wdev,
-#else
-				   struct net_device *dev,
-#endif
 				   u64 cookie)
 {
 	struct WILC_WFI_priv *priv;
@@ -2957,46 +2714,16 @@ int   WILC_WFI_mgmt_tx_cancel_wait(struct wiphy *wiphy,
 	if (priv->bInP2PlistenState == WILC_FALSE) {
 		/* Bug 5504: This is just to avoid connection failure when getting stuck when the supplicant
 		 *                      considers the driver falsely that it is in Listen state */
-		#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
 		cfg80211_remain_on_channel_expired(priv->wdev,
 						   priv->strRemainOnChanParams.u64ListenCookie,
 						   priv->strRemainOnChanParams.pstrListenChan,
 						   GFP_KERNEL);
-		#else
-		cfg80211_remain_on_channel_expired(priv->dev,
-						   priv->strRemainOnChanParams.u64ListenCookie,
-						   priv->strRemainOnChanParams.pstrListenChan,
-						   priv->strRemainOnChanParams.tenuChannelType,
-						   GFP_KERNEL);
-		#endif
-
 	}
 
 	return 0;
 }
 
 /**
- *  @brief      WILC_WFI_action
- *  @details Transmit an action frame
- *  @param[in]
- *  @return     int : Return 0 on Success.
- *  @author	mdaftedar
- *  @date	01 JUL 2012
- *  @version	1.0
- * */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
-int  WILC_WFI_action(struct wiphy *wiphy, struct net_device *dev,
-		     struct ieee80211_channel *chan, enum nl80211_channel_type channel_type,
-		     const u8 *buf, size_t len, u64 *cookie)
-{
-	PRINT_D(HOSTAPD_DBG, "In action function\n");
-	return WILC_SUCCESS;
-}
-#endif
-#else
-
-/**
  *  @brief      WILC_WFI_frame_register
  *  @details Notify driver that a management frame type was
  *              registered. Note that this callback may not sleep, and cannot run
@@ -3008,11 +2735,7 @@ int  WILC_WFI_action(struct wiphy *wiphy, struct net_device *dev,
  *  @version
  */
 void    WILC_WFI_frame_register(struct wiphy *wiphy,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
 				struct wireless_dev *wdev,
-#else
-				struct net_device *dev,
-#endif
 				u16 frame_type, bool reg)
 {
 
@@ -3060,7 +2783,6 @@ void    WILC_WFI_frame_register(struct wiphy *wiphy,
 
 
 }
-#endif
 #endif /*WILC_P2P*/
 
 /**
@@ -3107,11 +2829,7 @@ static int WILC_WFI_dump_station(struct wiphy *wiphy, struct net_device *dev,
 	priv = wiphy_priv(wiphy);
 	/* priv = netdev_priv(priv->wdev->netdev); */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))	//0421
 	sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
-#else
-	sinfo->filled |= STATION_INFO_SIGNAL;
-#endif
 
 	host_int_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal));
 
@@ -3279,18 +2997,14 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
 				WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
 						 g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
 						 g_add_ptk_key_params.key_idx,
-									#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 						 g_add_ptk_key_params.pairwise,
-									#endif
 						 g_add_ptk_key_params.mac_addr,
 						 (struct key_params *)(&g_key_ptk_params));
 
 				WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
 						 g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
 						 g_add_gtk_key_params.key_idx,
-									#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 						 g_add_gtk_key_params.pairwise,
-									#endif
 						 g_add_gtk_key_params.mac_addr,
 						 (struct key_params *)(&g_key_gtk_params));
 			}
@@ -3372,18 +3086,14 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
 				WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
 						 g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
 						 g_add_ptk_key_params.key_idx,
-									#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 						 g_add_ptk_key_params.pairwise,
-									#endif
 						 g_add_ptk_key_params.mac_addr,
 						 (struct key_params *)(&g_key_ptk_params));
 
 				WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
 						 g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
 						 g_add_gtk_key_params.key_idx,
-									#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 						 g_add_gtk_key_params.pairwise,
-									#endif
 						 g_add_gtk_key_params.mac_addr,
 						 (struct key_params *)(&g_key_gtk_params));
 			}
@@ -3531,18 +3241,14 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
 			WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
 					 g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
 					 g_add_ptk_key_params.key_idx,
-								#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 					 g_add_ptk_key_params.pairwise,
-								#endif
 					 g_add_ptk_key_params.mac_addr,
 					 (struct key_params *)(&g_key_ptk_params));
 
 			WILC_WFI_add_key(g_linux_wlan->strInterfaceInfo[0].wilc_netdev->ieee80211_ptr->wiphy,
 					 g_linux_wlan->strInterfaceInfo[0].wilc_netdev,
 					 g_add_gtk_key_params.key_idx,
-								#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
 					 g_add_gtk_key_params.pairwise,
-								#endif
 					 g_add_gtk_key_params.mac_addr,
 					 (struct key_params *)(&g_key_gtk_params));
 			#endif
@@ -3574,7 +3280,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev
 	return s32Error;
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
 /* (austin.2013-07-23)
  *
  *      To support revised cfg80211_ops
@@ -3614,12 +3319,10 @@ static int WILC_WFI_start_ap(struct wiphy *wiphy, struct net_device *dev,
 	PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = %d Tail length = %d\n",
 		settings->beacon_interval, settings->dtim_period, beacon->head_len, beacon->tail_len);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
 	s32Error = WILC_WFI_CfgSetChannel(wiphy, &settings->chandef);
 
 	if (s32Error != WILC_SUCCESS)
 		PRINT_ER("Error in setting channel\n");
-#endif
 
 	linux_wlan_set_bssid(dev, g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
 
@@ -3718,116 +3421,6 @@ static int  WILC_WFI_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	return s32Error;
 }
 
-#else /* here belows are original for < kernel 3.3 (austin.2013-07-23) */
-
-/**
- *  @brief      WILC_WFI_add_beacon
- *  @details    Add a beacon with given parameters, @head, @interval
- *                      and @dtim_period will be valid, @tail is optional.
- *  @param[in]   wiphy
- *  @param[in]   dev	The net device structure
- *  @param[in]   info	Parameters for the beacon to be added
- *  @return     int : Return 0 on Success.
- *  @author	mdaftedar
- *  @date	01 MAR 2012
- *  @version	1.0
- */
-static int WILC_WFI_add_beacon(struct wiphy *wiphy, struct net_device *dev,
-			       struct beacon_parameters *info)
-{
-	WILC_Sint32 s32Error = WILC_SUCCESS;
-	struct WILC_WFI_priv *priv;
-
-
-
-	priv = wiphy_priv(wiphy);
-	PRINT_D(HOSTAPD_DBG, "Adding Beacon\n");
-
-	PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = %d Tail length = %d\n", info->interval, info->dtim_period, info->head_len, info->tail_len);
-
-	linux_wlan_set_bssid(dev, g_linux_wlan->strInterfaceInfo[0].aSrcAddress);
-
-	#ifndef WILC_FULLY_HOSTING_AP
-	s32Error = host_int_add_beacon(priv->hWILCWFIDrv, info->interval,
-				       info->dtim_period,
-				       info->head_len, info->head,
-				       info->tail_len, info->tail);
-
-	#else
-	s32Error = host_add_beacon(priv->hWILCWFIDrv, info->interval,
-				   info->dtim_period,
-				   info->head_len, info->head,
-				   info->tail_len, info->tail);
-	#endif
-
-	return s32Error;
-}
-
-/**
- *  @brief      WILC_WFI_set_beacon
- *  @details    Change the beacon parameters for an access point mode
- *                      interface. This should reject the call when no beacon has been
- *                      configured.
- *  @param[in]
- *  @return     int : Return 0 on Success.
- *  @author	mdaftedar
- *  @date	01 MAR 2012
- *  @version	1.0
- */
-static int  WILC_WFI_set_beacon(struct wiphy *wiphy, struct net_device *dev,
-				struct beacon_parameters *info)
-{
-	WILC_Sint32 s32Error = WILC_SUCCESS;
-
-
-	PRINT_D(HOSTAPD_DBG, "Setting beacon\n");
-
-	s32Error = WILC_WFI_add_beacon(wiphy, dev, info);
-
-	return s32Error;
-}
-
-/**
- *  @brief      WILC_WFI_del_beacon
- *  @details    Remove beacon configuration and stop sending the beacon.
- *  @param[in]
- *  @return     int : Return 0 on Success.
- *  @author	mdaftedar
- *  @date	01 MAR 2012
- *  @version	1.0
- */
-static int  WILC_WFI_del_beacon(struct wiphy *wiphy, struct net_device *dev)
-{
-	WILC_Sint32 s32Error = WILC_SUCCESS;
-	struct WILC_WFI_priv *priv;
-	WILC_Uint8 NullBssid[ETH_ALEN] = {0};
-
-
-	WILC_NULLCHECK(s32Error, wiphy);
-
-	priv = wiphy_priv(wiphy);
-
-	PRINT_D(HOSTAPD_DBG, "Deleting beacon\n");
-
-	/*BugID_5188*/
-	linux_wlan_set_bssid(dev, NullBssid);
-
-	#ifndef WILC_FULLY_HOSTING_AP
-	s32Error = host_int_del_beacon(priv->hWILCWFIDrv);
-	#else
-	s32Error = host_del_beacon(priv->hWILCWFIDrv);
-	#endif
-
-	WILC_ERRORCHECK(s32Error);
-
-	WILC_CATCH(s32Error)
-	{
-	}
-	return s32Error;
-}
-
-#endif  /* linux kernel 3.4+ (austin.2013-07-23) */
-
 /**
  *  @brief      WILC_WFI_add_station
  *  @details    Add a new station.
@@ -3923,15 +3516,9 @@ static int  WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev,
  *  @version	1.0
  */
 static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
 				struct station_del_parameters *params)
-#else
-				u8 *mac)
-#endif
 {
-	#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
 	u8 *mac = params->mac;
-	#endif
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	struct WILC_WFI_priv *priv;
 	perInterface_wlan_t *nic;
@@ -4055,35 +3642,14 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev,
  *  @date	01 JUL 2012
  *  @version	1.0
  */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
 struct wireless_dev *WILC_WFI_add_virt_intf(struct wiphy *wiphy, const char *name,
 						unsigned char name_assign_type,
 						enum nl80211_iftype type, u32 *flags,
 						struct vif_params *params)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)         /* tony for v3.8 support */
-struct wireless_dev *WILC_WFI_add_virt_intf(struct wiphy *wiphy, const char *name,
-					    enum nl80211_iftype type, u32 *flags,
-					    struct vif_params *params)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)       /* tony for v3.6 support */
-struct wireless_dev *WILC_WFI_add_virt_intf(struct wiphy *wiphy, char *name,
-					    enum nl80211_iftype type, u32 *flags,
-					    struct vif_params *params)
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
-int WILC_WFI_add_virt_intf(struct wiphy *wiphy, char *name,
-			   enum nl80211_iftype type, u32 *flags,
-			   struct vif_params *params)
-#else
-struct net_device *WILC_WFI_add_virt_intf(struct wiphy *wiphy, char *name,
-					  enum nl80211_iftype type, u32 *flags,
-					  struct vif_params *params)
-#endif
 {
 	perInterface_wlan_t *nic;
 	struct WILC_WFI_priv *priv;
 	/* struct WILC_WFI_mon_priv* mon_priv; */
-	#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
-	WILC_Sint32 s32Error = WILC_SUCCESS;
-	#endif
 	struct net_device *new_ifc = NULL;
 	priv = wiphy_priv(wiphy);
 
@@ -4110,16 +3676,7 @@ struct net_device *WILC_WFI_add_virt_intf(struct wiphy *wiphy, char *name,
 		} else
 			PRINT_ER("Error in initializing monitor interface\n ");
 	}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) /* tony for v3.8 support */
 	return priv->wdev;
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
-	return s32Error;
-#else
-	/* return priv->wdev->netdev; */
-	PRINT_D(HOSTAPD_DBG, "IFC[%p] created\n", new_ifc);
-	return new_ifc;
-#endif
-
 }
 
 /**
@@ -4131,11 +3688,7 @@ struct net_device *WILC_WFI_add_virt_intf(struct wiphy *wiphy, char *name,
  *  @date	01 JUL 2012
  *  @version	1.0
  */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
 int WILC_WFI_del_virt_intf(struct wiphy *wiphy, struct wireless_dev *wdev)      /* tony for v3.8 support */
-#else
-int WILC_WFI_del_virt_intf(struct wiphy *wiphy, struct net_device *dev)
-#endif
 {
 	PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n");
 	return WILC_SUCCESS;
@@ -4146,16 +3699,7 @@ int WILC_WFI_del_virt_intf(struct wiphy *wiphy, struct net_device *dev)
 #endif /*WILC_AP_EXTERNAL_MLME*/
 static struct cfg80211_ops WILC_WFI_cfg80211_ops = {
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
-	/*
-	 *	replaced set_channel by set_monitor_channel
-	 *	from v3.6
-	 *	tony, 2013-10-29
-	 */
 	.set_monitor_channel = WILC_WFI_CfgSetChannel,
-#else
-	.set_channel = WILC_WFI_CfgSetChannel,
-#endif
 	.scan = WILC_WFI_CfgScan,
 	.connect = WILC_WFI_CfgConnect,
 	.disconnect = WILC_WFI_disconnect,
@@ -4163,24 +3707,15 @@ static struct cfg80211_ops WILC_WFI_cfg80211_ops = {
 	.del_key = WILC_WFI_del_key,
 	.get_key = WILC_WFI_get_key,
 	.set_default_key = WILC_WFI_set_default_key,
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
 	/* .dump_survey = WILC_WFI_dump_survey, */
-#endif
 	#ifdef WILC_AP_EXTERNAL_MLME
 	.add_virtual_intf = WILC_WFI_add_virt_intf,
 	.del_virtual_intf = WILC_WFI_del_virt_intf,
 	.change_virtual_intf = WILC_WFI_change_virt_intf,
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
-	.add_beacon = WILC_WFI_add_beacon,
-	.set_beacon = WILC_WFI_set_beacon,
-	.del_beacon = WILC_WFI_del_beacon,
-#else
-	/* supports kernel 3.4+ change. austin.2013-07-23 */
 	.start_ap = WILC_WFI_start_ap,
 	.change_beacon = WILC_WFI_change_beacon,
 	.stop_ap = WILC_WFI_stop_ap,
-#endif
 	.add_station = WILC_WFI_add_station,
 	.del_station = WILC_WFI_del_station,
 	.change_station = WILC_WFI_change_station,
@@ -4196,7 +3731,6 @@ static struct cfg80211_ops WILC_WFI_cfg80211_ops = {
 	/* .disassoc = WILC_WFI_disassoc, */
 	.set_wiphy_params = WILC_WFI_set_wiphy_params,
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
 	/* .set_bitrate_mask = WILC_WFI_set_bitrate_mask, */
 	.set_pmksa = WILC_WFI_set_pmksa,
 	.del_pmksa = WILC_WFI_del_pmksa,
@@ -4205,15 +3739,8 @@ static struct cfg80211_ops WILC_WFI_cfg80211_ops = {
 	.remain_on_channel = WILC_WFI_remain_on_channel,
 	.cancel_remain_on_channel = WILC_WFI_cancel_remain_on_channel,
 	.mgmt_tx_cancel_wait = WILC_WFI_mgmt_tx_cancel_wait,
-	#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
-	#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
-	.action = WILC_WFI_action,
-	#endif
-	#else
 	.mgmt_tx = WILC_WFI_mgmt_tx,
 	.mgmt_frame_register = WILC_WFI_frame_register,
-	#endif
-#endif
 	/* .mgmt_tx_cancel_wait = WILC_WFI_mgmt_tx_cancel_wait, */
 	.set_power_mgmt = WILC_WFI_set_power_mgmt,
 	.set_cqm_rssi_config = WILC_WFI_set_cqm_rssi_config,
@@ -4378,11 +3905,9 @@ struct wireless_dev *WILC_WFI_WiphyRegister(struct net_device *net)
 
 	/*Maximum number of probed ssid to be added by user for the scan request*/
 	wdev->wiphy->max_scan_ssids = MAX_NUM_PROBED_SSID;
-	#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
 	/*Maximum number of pmkids to be cashed*/
 	wdev->wiphy->max_num_pmkids = WILC_MAX_NUM_PMKIDS;
 	PRINT_INFO(CFG80211_DBG, "Max number of PMKIDs = %d\n", wdev->wiphy->max_num_pmkids);
-	#endif
 
 	wdev->wiphy->max_scan_ie_len = 1000;
 
@@ -4392,20 +3917,15 @@ struct wireless_dev *WILC_WFI_WiphyRegister(struct net_device *net)
 	/*Set the availaible cipher suites*/
 	wdev->wiphy->cipher_suites = cipher_suites;
 	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
 	/*Setting default managment types: for register action frame:  */
 	wdev->wiphy->mgmt_stypes = wilc_wfi_cfg80211_mgmt_types;
-#endif
 
 #ifdef WILC_P2P
 	wdev->wiphy->max_remain_on_channel_duration = 500;
 	/*Setting the wiphy interfcae mode and type before registering the wiphy*/
 	wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_MONITOR) | BIT(NL80211_IFTYPE_P2P_GO) |
 		BIT(NL80211_IFTYPE_P2P_CLIENT);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
-
 	wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-#endif
 #else
 	wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_MONITOR);
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 9eb8f37542d0..508db6a3f6dd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -68,7 +68,6 @@
 #define nl80211_SCAN_RESULT_EXPIRE	(3 * HZ)
 #define SCAN_RESULT_EXPIRE				(40 * HZ)
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 30)
 static const u32 cipher_suites[] = {
 	WLAN_CIPHER_SUITE_WEP40,
 	WLAN_CIPHER_SUITE_WEP104,
@@ -76,11 +75,7 @@ static const u32 cipher_suites[] = {
 	WLAN_CIPHER_SUITE_CCMP,
 	WLAN_CIPHER_SUITE_AES_CMAC,
 };
-#endif
-
-
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
 static const struct ieee80211_txrx_stypes
 	wilc_wfi_cfg80211_mgmt_types[NL80211_IFTYPE_MAX] = {
 	[NL80211_IFTYPE_STATION] = {
@@ -110,7 +105,7 @@ static const struct ieee80211_txrx_stypes
 			BIT(IEEE80211_STYPE_DEAUTH >> 4)
 	}
 };
-#endif
+
 /* Time to stay on the channel */
 #define WILC_WFI_DWELL_PASSIVE 100
 #define WILC_WFI_DWELL_ACTIVE  40
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index aa30de932ca4..0abe653acc66 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -49,12 +49,7 @@
 #include <asm/checksum.h>
 #include "host_interface.h"
 #include "wilc_wlan.h"
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 30)
-#include <net/wireless.h>
-#else
 #include <linux/wireless.h>     /* tony, 2013-06-12 */
-#endif
-
 
 #define FLOW_CONTROL_LOWER_THRESHOLD	128
 #define FLOW_CONTROL_UPPER_THRESHOLD	256
@@ -163,9 +158,6 @@ struct WILC_WFI_priv {
 	tstrHostIFpmkidAttr pmkid_list;
 	struct WILC_WFI_stats netstats;
 	WILC_Uint8 WILC_WFI_wep_default;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
-#define WLAN_KEY_LEN_WEP104 13
-#endif
 	WILC_Uint8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
 	WILC_Uint8 WILC_WFI_wep_key_len[4];
 	struct net_device *real_ndev;   /* The real interface that the monitor is on */
-- 
2.1.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists