[PATCH 03/61] rtl8192e: Remove extra ifdefs

Larry Finger Larry.Finger at lwfinger.net
Wed Aug 24 03:44:14 UTC 2011


From: Mike McCormack <mikem at ring3k.org>

Signed-off-by: Larry Finger <Larry.Finger at lwfinger.net>
Signed-off-by: Mike McCormack <mikem at ring3k.org>
---
 drivers/staging/rtl8192e/internal.h          |   21 --
 drivers/staging/rtl8192e/r8192E_cmdpkt.c     |   30 +--
 drivers/staging/rtl8192e/r8192E_firmware.c   |   15 -
 drivers/staging/rtl8192e/r8192E_phy.c        |   78 +-----
 drivers/staging/rtl8192e/rtl819x_HTProc.c    |   27 +--
 drivers/staging/rtl8192e/rtl819x_Qos.h       |    8 -
 drivers/staging/rtl8192e/rtl819x_TSProc.c    |    8 +-
 drivers/staging/rtl8192e/rtl_cam.c           |    2 -
 drivers/staging/rtl8192e/rtl_core.c          |  129 +--------
 drivers/staging/rtl8192e/rtl_core.h          |   36 +---
 drivers/staging/rtl8192e/rtl_debug.c         |   13 -
 drivers/staging/rtl8192e/rtl_debug.h         |    6 -
 drivers/staging/rtl8192e/rtl_dm.c            |  394 +-------------------------
 drivers/staging/rtl8192e/rtl_ethtool.c       |    6 -
 drivers/staging/rtl8192e/rtl_pci.c           |  352 -----------------------
 drivers/staging/rtl8192e/rtl_pm.c            |   16 -
 drivers/staging/rtl8192e/rtl_pm.h            |    4 -
 drivers/staging/rtl8192e/rtl_ps.c            |   63 ----
 drivers/staging/rtl8192e/rtllib.h            |  167 +-----------
 drivers/staging/rtl8192e/rtllib_crypt.h      |    8 -
 drivers/staging/rtl8192e/rtllib_crypt_ccmp.c |   49 +---
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c |  189 +------------
 drivers/staging/rtl8192e/rtllib_crypt_wep.c  |   91 +------
 drivers/staging/rtl8192e/rtllib_rx.c         |  141 +---------
 drivers/staging/rtl8192e/rtllib_softmac.c    |   49 +---
 drivers/staging/rtl8192e/rtllib_softmac_wx.c |    9 -
 26 files changed, 39 insertions(+), 1872 deletions(-)

diff --git a/drivers/staging/rtl8192e/internal.h b/drivers/staging/rtl8192e/internal.h
index 1c39c00..3041f0f 100644
--- a/drivers/staging/rtl8192e/internal.h
+++ b/drivers/staging/rtl8192e/internal.h
@@ -19,12 +19,8 @@
 #include <linux/highmem.h>
 #include <linux/init.h>
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12))
-#include <asm/hardirq.h>
-#else
 #include <linux/hardirq.h>
 #include <linux/sched.h>
-#endif
 #include <asm/kmap_types.h>
 
 #ifdef BUILT_IN_CRYPTO
@@ -37,23 +33,6 @@
 #endif
 #endif /* BUILT_IN_CRYPTO */
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
-#define list_for_each_entry(pos, head, member)				\
-	for (pos = list_entry((head)->next, typeof(*pos), member),	\
-		     prefetch(pos->member.next);			\
-	     &pos->member != (head);					\
-	     pos = list_entry(pos->member.next, typeof(*pos), member),	\
-		     prefetch(pos->member.next))
-
-static inline void cond_resched(void)
-{
-	if (need_resched()) {
-		set_current_state(TASK_RUNNING);
-		schedule();
-	}
-}
-#endif
-
 extern enum km_type crypto_km_types[];
 
 static inline enum km_type crypto_kmap_type(int out)
diff --git a/drivers/staging/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/r8192E_cmdpkt.c
index 11506db..ea9fa57 100644
--- a/drivers/staging/rtl8192e/r8192E_cmdpkt.c
+++ b/drivers/staging/rtl8192e/r8192E_cmdpkt.c
@@ -114,56 +114,36 @@ cmpk_count_txstatistic(
 	pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState));
 
 	if (rtState == eRfOff)
-	{
 		return;
-	}
 #endif
 
-#ifdef TODO
-	if (pAdapter->bInHctTest)
-		return;
-#endif
-	if (pstx_fb->tok)
-	{
+	if (pstx_fb->tok) {
 		priv->stats.txfeedbackok++;
 		priv->stats.txoktotal++;
 		priv->stats.txokbytestotal += pstx_fb->pkt_length;
 		priv->stats.txokinperiod++;
 
-		if (pstx_fb->pkt_type == PACKET_MULTICAST)
-		{
+		if (pstx_fb->pkt_type == PACKET_MULTICAST) {
 			priv->stats.txmulticast++;
 			priv->stats.txbytesmulticast += pstx_fb->pkt_length;
-		}
-		else if (pstx_fb->pkt_type == PACKET_BROADCAST)
-		{
+		} else if (pstx_fb->pkt_type == PACKET_BROADCAST) {
 			priv->stats.txbroadcast++;
 			priv->stats.txbytesbroadcast += pstx_fb->pkt_length;
-		}
-		else
-		{
+		} else {
 			priv->stats.txunicast++;
 			priv->stats.txbytesunicast += pstx_fb->pkt_length;
 		}
-	}
-	else
-	{
+	} else {
 		priv->stats.txfeedbackfail++;
 		priv->stats.txerrtotal++;
 		priv->stats.txerrbytestotal += pstx_fb->pkt_length;
 
 		if (pstx_fb->pkt_type == PACKET_MULTICAST)
-		{
 			priv->stats.txerrmulticast++;
-		}
 		else if (pstx_fb->pkt_type == PACKET_BROADCAST)
-		{
 			priv->stats.txerrbroadcast++;
-		}
 		else
-		{
 			priv->stats.txerrunicast++;
-		}
 	}
 
 	priv->stats.txretrycount += pstx_fb->retry_cnt;
diff --git a/drivers/staging/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/r8192E_firmware.c
index 6d49029..8c77d13 100644
--- a/drivers/staging/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/r8192E_firmware.c
@@ -17,19 +17,11 @@
  * wlanfae <wlanfae at realtek.com>
 ******************************************************************************/
 
-#if (defined(RTL8192E) || defined(RTL8190P))
-
 #include "rtl_core.h"
 #include "r8192E_hw.h"
-#ifdef RTL8190P
-#include "r8190P_hwimg.h"
-#elif defined RTL8192E
 #include "r8192E_hwimg.h"
-#endif
 #include "r8192E_firmware.h"
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 #include <linux/firmware.h>
-#endif
 
 extern void firmware_init_param(struct net_device *dev)
 {
@@ -308,17 +300,12 @@ bool init_firmware(struct net_device *dev)
 		 RT_TRACE(COMP_FIRMWARE, "PlatformInitFirmware: undefined firmware state\n");
 	}
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) && defined(USE_FW_SOURCE_IMG_FILE)
 	priv->firmware_source = FW_SOURCE_IMG_FILE;
-#else
-	priv->firmware_source = FW_SOURCE_HEADER_FILE;
-#endif
 	for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
 		if (rst_opt == OPT_SYSTEM_RESET) {
 			switch (priv->firmware_source) {
 			case FW_SOURCE_IMG_FILE:
 			{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) && defined(USE_FW_SOURCE_IMG_FILE)
 				if (pfirmware->firmware_buf_size[init_step] == 0) {
 					const char *fw_name[3] = { "RTL8192E/boot.img",
 						                   "RTL8192E/main.img",
@@ -352,7 +339,6 @@ bool init_firmware(struct net_device *dev)
 				}
 				mapped_file = pfirmware->firmware_buf[init_step];
 				file_length = pfirmware->firmware_buf_size[init_step];
-#endif
 				break;
 			}
 			case FW_SOURCE_HEADER_FILE:
@@ -393,4 +379,3 @@ download_firmware_fail:
 	return rt_status;
 
 }
-#endif
diff --git a/drivers/staging/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/r8192E_phy.c
index a20451b..78395a1 100644
--- a/drivers/staging/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/r8192E_phy.c
@@ -815,83 +815,7 @@ void rtl8192_phy_setTxPower(struct net_device* dev, u8 channel)
 			(bXBTxAGC|bXCTxAGC|bXDTxAGC), u4RegValue);
 		}
 	}
-#ifdef TODO
-	if (	pMgntInfo->OpMode == RT_OP_MODE_INFRASTRUCTURE &&
-		pMgntInfo->bWithCcxCellPwr &&
-		channel == pMgntInfo->dot11CurrentChannelNumber)
-	{
-		u8	CckCellPwrIdx = DbmToTxPwrIdx(dev, WIRELESS_MODE_B, pMgntInfo->CcxCellPwr);
-		u8	LegacyOfdmCellPwrIdx = DbmToTxPwrIdx(dev, WIRELESS_MODE_G, pMgntInfo->CcxCellPwr);
-		u8	OfdmCellPwrIdx = DbmToTxPwrIdx(dev, WIRELESS_MODE_N_24G, pMgntInfo->CcxCellPwr);
-
-		RT_TRACE(COMP_TXAGC, DBG_LOUD,
-			("CCX Cell Limit: %d dbm => CCK Tx power index : %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n",
-			pMgntInfo->CcxCellPwr, CckCellPwrIdx, LegacyOfdmCellPwrIdx, OfdmCellPwrIdx));
-		RT_TRACE(COMP_TXAGC, DBG_LOUD,
-			("EEPROM channel(%d) => CCK Tx power index: %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n",
-			channel, powerlevel, powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff, powerlevelOFDM24G));
-
-		if (powerlevel > CckCellPwrIdx)
-			powerlevel = CckCellPwrIdx;
-		if (powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff > OfdmCellPwrIdx)
-		{
-			if ((OfdmCellPwrIdx - pHalData->LegacyHTTxPowerDiff) > 0)
-			{
-				powerlevelOFDM24G = OfdmCellPwrIdx - pHalData->LegacyHTTxPowerDiff;
-			}
-			else
-			{
-				LegacyOfdmCellPwrIdx = 0;
-			}
-		}
-
-		RT_TRACE(COMP_TXAGC, DBG_LOUD,
-			("Altered CCK Tx power index : %d, Legacy OFDM Tx power index: %d, OFDM Tx power index: %d\n",
-			powerlevel, powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff, powerlevelOFDM24G));
-	}
-
-	pHalData->CurrentCckTxPwrIdx = powerlevel;
-	pHalData->CurrentOfdm24GTxPwrIdx = powerlevelOFDM24G;
-
-	RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_GET_CHANNEL, &channel, &pChannelInfo);
-
-	if (pChannelInfo)
-	{
-		if (pChannelInfo->MaxTxPwrDbm != UNSPECIFIED_PWR_DBM)
-		{
-			u1Byte CckMaxPwrIdx = DbmToTxPwrIdx(Adapter, WIRELESS_MODE_B, pChannelInfo->MaxTxPwrDbm);
-			u1Byte LegacyOfdmMaxPwrIdx = DbmToTxPwrIdx(Adapter, WIRELESS_MODE_G, pChannelInfo->MaxTxPwrDbm);
-			u1Byte OfdmMaxPwrIdx = DbmToTxPwrIdx(Adapter, WIRELESS_MODE_N_24G, pChannelInfo->MaxTxPwrDbm);
-
-			RT_TRACE(COMP_TXAGC, DBG_LOUD,
-					("CCX Cell Limit: %ld dbm => CCK Tx power index : %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n",
-					pChannelInfo->MaxTxPwrDbm, CckMaxPwrIdx, LegacyOfdmMaxPwrIdx, OfdmMaxPwrIdx));
-			RT_TRACE(COMP_TXAGC, DBG_LOUD,
-					("EEPROM channel(%d) => CCK Tx power index: %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n",
-					channel, powerlevel, powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff, powerlevelOFDM24G));
-
-			if (powerlevel > CckMaxPwrIdx)
-				powerlevel = CckMaxPwrIdx;
-			if (powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff > OfdmMaxPwrIdx)
-			{
-				if ((OfdmMaxPwrIdx - pHalData->LegacyHTTxPowerDiff) > 0)
-				{
-					powerlevelOFDM24G = OfdmMaxPwrIdx - pHalData->LegacyHTTxPowerDiff;
-				}
-				else
-				{
-					LegacyOfdmMaxPwrIdx = 0;
-				}
-			}
-
-			RT_TRACE(COMP_TXAGC, DBG_LOUD,
-					("Altered CCK Tx power index : %d, Legacy OFDM Tx power index: %d, OFDM Tx power index: %d\n",
-					powerlevel, powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff, powerlevelOFDM24G));
-		}
-	}
-#endif
-	switch (priv->rf_chip)
-	{
+	switch (priv->rf_chip) {
 	case RF_8225:
 		break;
 	case RF_8256:
diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c
index eaf7367..1aa7d80 100644
--- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
@@ -958,14 +958,6 @@ void HTConstructRT2RTAggElement(struct rtllib_device* ieee, u8* posRT2RTAgg, u8*
 	*len = 6 + 2;
 
 	return;
-
-#ifdef TODO
-	posRT2RTAgg->Length = 6;
-#endif
-
-
-
-
 }
 
 u8 HT_PickMCSRate(struct rtllib_device* ieee, u8* pOperateMCS)
@@ -1410,8 +1402,7 @@ void HTUseDefaultSetting(struct rtllib_device* ieee)
 {
 	PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
 
-	if (pHTInfo->bEnableHT)
-	{
+	if (pHTInfo->bEnableHT) {
 		pHTInfo->bCurrentHTSupport = true;
 		pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK;
 
@@ -1434,27 +1425,15 @@ void HTUseDefaultSetting(struct rtllib_device* ieee)
 
 
 		HTFilterMCSRate(ieee, ieee->Regdot11TxHTOperationalRateSet, ieee->dot11HTOperationalRateSet);
-#ifdef TODO
-		Adapter->HalFunc.InitHalRATRTableHandler( Adapter, &pMgntInfo->dot11OperationalRateSet, pMgntInfo->dot11HTOperationalRateSet);
-#endif
 		ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, MCS_FILTER_ALL);
 		ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
 
-#if (defined RTL8192SE || defined RTL8192SU || defined RTL8192CE)
-		if (ieee->SetHwRegHandler != NULL) {
-			ieee->SetHwRegHandler( ieee->dev, HW_VAR_SHORTGI_DENSITY,  (u8*)(&ieee->MaxMssDensity));
-			ieee->SetHwRegHandler(ieee->dev, HW_VAR_AMPDU_FACTOR, &pHTInfo->CurrentAMPDUFactor);
-			ieee->SetHwRegHandler(ieee->dev, HW_VAR_AMPDU_MIN_SPACE, &pHTInfo->CurrentMPDUDensity);
-		}
-#endif
-
-	}
-	else
-	{
+	} else {
 		pHTInfo->bCurrentHTSupport = false;
 	}
 	return;
 }
+
 u8 HTCCheck(struct rtllib_device* ieee, u8*	pFrame)
 {
 	if (ieee->pHTInfo->bCurrentHTSupport)
diff --git a/drivers/staging/rtl8192e/rtl819x_Qos.h b/drivers/staging/rtl8192e/rtl819x_Qos.h
index 4c89a76..8f5e0fdd 100644
--- a/drivers/staging/rtl8192e/rtl819x_Qos.h
+++ b/drivers/staging/rtl8192e/rtl819x_Qos.h
@@ -54,14 +54,6 @@
 #define BIT30                   0x40000000
 #define BIT31                   0x80000000
 
-#ifndef RTK_DMP_PLATFORM
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
-#ifndef bool
-typedef enum{false = 0, true} bool;
-#endif
-#endif
-#endif
-
 typedef union _QOS_TSINFO{
 	u8		charData[3];
 	struct {
diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
index 0900bfa..4159cb8 100644
--- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
@@ -20,13 +20,7 @@
 #include <linux/etherdevice.h>
 #include "rtl819x_TS.h"
 extern void _setup_timer( struct timer_list*, void*, unsigned long);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define list_for_each_entry_safe(pos, n, head, member) \
-	for (pos = list_entry((head)->next, typeof(*pos), member), \
-		n = list_entry(pos->member.next, typeof(*pos), member); \
-		&pos->member != (head); \
-		pos = n, n = list_entry(n->member.next, typeof(*n), member))
-#endif
+
 void TsSetupTimeOut(unsigned long data)
 {
 }
diff --git a/drivers/staging/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl_cam.c
index c2d51bc..31f198c 100644
--- a/drivers/staging/rtl8192e/rtl_cam.c
+++ b/drivers/staging/rtl8192e/rtl_cam.c
@@ -170,9 +170,7 @@ void setKey(struct net_device *dev,
 			if (KeyContent != NULL) {
 				write_nic_dword(dev, WCAMI, (u32)(*(KeyContent+i-2)) );
 				write_nic_dword(dev, RWCAM, TargetCommand);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
 				udelay(100);
-#endif
 			}
 		}
 	}
diff --git a/drivers/staging/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl_core.c
index 9551c5e..18030d6 100644
--- a/drivers/staging/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl_core.c
@@ -570,11 +570,7 @@ void rtl8192_tx_timeout(struct net_device *dev)
 {
     struct r8192_priv *priv = rtllib_priv(dev);
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
     schedule_work(&priv->reset_wq);
-#else
-    schedule_task(&priv->reset_wq);
-#endif
     printk("TXTIMEOUT");
 }
 
@@ -700,13 +696,8 @@ static struct rtllib_qos_parameters def_qos_parameters = {
 
 void rtl8192_update_beacon(void *data)
 {
-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
 	struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, update_beacon_wq.work);
 	struct net_device *dev = priv->rtllib->dev;
-#else
-	struct net_device *dev = (struct net_device *)data;
-        struct r8192_priv *priv = rtllib_priv(dev);
-#endif
 	struct rtllib_device* ieee = priv->rtllib;
 	struct rtllib_network* net = &ieee->current_network;
 
@@ -718,20 +709,12 @@ void rtl8192_update_beacon(void *data)
 }
 
 #define MOVE_INTO_HANDLER
-#ifdef RTL8192CE
-int WDCAPARA_ADD[] = {REG_EDCA_BE_PARAM,REG_EDCA_BK_PARAM,REG_EDCA_VI_PARAM,REG_EDCA_VO_PARAM};
-#else
 int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO};
-#endif
+
 void rtl8192_qos_activate(void *data)
 {
-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
 	struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, qos_activate);
 	struct net_device *dev = priv->rtllib->dev;
-#else
-	struct net_device *dev = (struct net_device *)data;
-	struct r8192_priv *priv = rtllib_priv(dev);
-#endif
 #ifndef MOVE_INTO_HANDLER
         struct rtllib_qos_parameters *qos_parameters = &priv->rtllib->current_network.qos_data.parameters;
         u8 mode = priv->rtllib->current_network.mode;
@@ -743,11 +726,7 @@ void rtl8192_qos_activate(void *data)
         if (priv == NULL)
                 return;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-	down(&priv->mutex);
-#else
         mutex_lock(&priv->mutex);
-#endif
         if (priv->rtllib->state != RTLLIB_LINKED)
 		goto success;
 	RT_TRACE(COMP_QOS,"qos active process with associate response received\n");
@@ -767,11 +746,7 @@ void rtl8192_qos_activate(void *data)
 	}
 
 success:
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-	up(&priv->mutex);
-#else
         mutex_unlock(&priv->mutex);
-#endif
 }
 
 static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
@@ -1199,11 +1174,7 @@ int rtl8192_sta_down(struct net_device *dev, bool shutdownrf)
 
 	del_timer_sync(&priv->watch_dog_timer);
 	rtl8192_cancel_deferred_work(priv);
-#ifndef RTL8190P
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	cancel_delayed_work(&priv->rtllib->hw_wakeup_wq);
-#endif
-#endif
 
 	rtllib_softmac_stop_protocol(priv->rtllib, 0, true);
 	spin_lock_irqsave(&priv->rf_ps_lock,flags);
@@ -1481,11 +1452,7 @@ static void rtl8192_init_priv_lock(struct r8192_priv* priv)
 #endif
 	sema_init(&priv->wx_sem,1);
 	sema_init(&priv->rf_sem,1);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-	sema_init(&priv->mutex, 1);
-#else
 	mutex_init(&priv->mutex);
-#endif
 }
 
 static void rtl8192_init_priv_task(struct net_device* dev)
@@ -2032,13 +1999,8 @@ void rtl819x_update_rxcounts(struct r8192_priv *priv,
 
 void	rtl819x_watchdog_wqcallback(void *data)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 	struct r8192_priv *priv = container_of_dwork_rsl(data,struct r8192_priv,watch_dog_wq);
 	struct net_device *dev = priv->rtllib->dev;
-#else
-	struct net_device *dev = (struct net_device *)data;
-	struct r8192_priv *priv = rtllib_priv(dev);
-#endif
 	struct rtllib_device* ieee = priv->rtllib;
 	RESET_TYPE	ResetType = RESET_TYPE_NORESET;
 	static u8	check_reset_cnt = 0;
@@ -3005,33 +2967,11 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv)
 *****************************************************************************/
 void rtl8192_cancel_deferred_work(struct r8192_priv* priv)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	cancel_delayed_work(&priv->watch_dog_wq);
 	cancel_delayed_work(&priv->update_beacon_wq);
-#ifndef RTL8190P
 	cancel_delayed_work(&priv->rtllib->hw_sleep_wq);
-#endif
-#if defined RTL8192SE
-	cancel_delayed_work(&priv->check_hw_scan_wq);
-	cancel_delayed_work(&priv->hw_scan_simu_wq);
-	cancel_delayed_work(&priv->start_hw_scan_wq);
-	cancel_delayed_work(&priv->rtllib->update_assoc_sta_info_wq);
-	cancel_delayed_work(&priv->rtllib->check_tsf_wq);
-#endif
-#endif
-
-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,22)
 	cancel_work_sync(&priv->reset_wq);
 	cancel_work_sync(&priv->qos_activate);
-#elif ((LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)))
-	cancel_delayed_work(&priv->reset_wq);
-	cancel_delayed_work(&priv->qos_activate);
-#if defined RTL8192SE
-	cancel_delayed_work(&priv->rtllib->update_assoc_sta_info_wq);
-	cancel_delayed_work(&priv->rtllib->check_tsf_wq);
-#endif
-#endif
-
 }
 
 int _rtl8192_up(struct net_device *dev,bool is_silent_reset)
@@ -3123,13 +3063,8 @@ void rtl8192_commit(struct net_device *dev)
 
 void rtl8192_restart(void *data)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 	struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, reset_wq);
 	struct net_device *dev = priv->rtllib->dev;
-#else
-	struct net_device *dev = (struct net_device *)data;
-        struct r8192_priv *priv = rtllib_priv(dev);
-#endif
 
 	down(&priv->wx_sem);
 
@@ -3165,11 +3100,7 @@ int r8192_set_mac_adr(struct net_device *dev, void *mac)
 
 	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 	schedule_work(&priv->reset_wq);
-#else
-	schedule_task(&priv->reset_wq);
-#endif
 	up(&priv->wx_sem);
 
 	return 0;
@@ -3515,11 +3446,7 @@ irqreturn_type rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs)
 
 done:
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	return;
-#else
 	return IRQ_HANDLED;
-#endif
 }
 
 
@@ -3547,9 +3474,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 	unsigned long ioaddr = 0;
 	struct net_device *dev = NULL;
 	struct r8192_priv *priv= NULL;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	struct rtl819x_ops *ops = (struct rtl819x_ops *)(id->driver_data);
-#endif
 
 #ifdef CONFIG_RTL8192_IO_MAP
 	unsigned long pio_start, pio_len, pio_flags;
@@ -3569,10 +3494,6 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 
 	pci_set_master(pdev);
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
-#define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL < (n)) -1))
-#endif
-
 #ifdef CONFIG_64BIT_DMA
 	if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
 		printk("RTL819xCE: Using 64bit DMA\n");
@@ -3586,13 +3507,11 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 #endif
 	{
 		if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 			if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
 				printk( "Unable to obtain 32bit DMA for consistent allocations\n");
 				pci_disable_device(pdev);
 				return -ENOMEM;
 			}
-#endif
 		}
 	}
 	dev = alloc_rtllib(sizeof(struct r8192_priv));
@@ -3603,26 +3522,16 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 		dev->features |= NETIF_F_HIGHDMA;
 	}
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
-	SET_MODULE_OWNER(dev);
-#endif
-
 	pci_set_drvdata(pdev, dev);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	SET_NETDEV_DEV(dev, &pdev->dev);
-#endif
 	priv = rtllib_priv(dev);
 	priv->rtllib = (struct rtllib_device *)netdev_priv_rsl(dev);
 	priv->pdev=pdev;
 	priv->rtllib->pdev=pdev;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-	if ((pdev->subsystem_vendor == PCI_VENDOR_ID_DLINK)&&(pdev->subsystem_device == 0x3304)){
+	if ((pdev->subsystem_vendor == PCI_VENDOR_ID_DLINK)&&(pdev->subsystem_device == 0x3304))
 		priv->rtllib->bSupportRemoteWakeUp = 1;
-	} else
-#endif
-	{
+	else
 		priv->rtllib->bSupportRemoteWakeUp = 0;
-	}
 
 #ifdef CONFIG_RTL8192_IO_MAP
 	pio_start = (unsigned long)pci_resource_start (pdev, 0);
@@ -3687,15 +3596,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 	if (pdev->device == 0x8192 && revision_id == 0x10)
 		goto fail1;
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	priv->ops = ops;
-#else
-#if defined RTL8190P || defined RTL8192E
-	priv->ops = &rtl819xp_ops;
-#else
-	priv->ops = &rtl8192se_ops;
-#endif
-#endif
 
 	if (rtl8192_pci_findadapter(pdev, dev) == false)
 		goto fail1;
@@ -3721,9 +3622,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 #endif
         dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def;
 #endif
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	dev->ethtool_ops = &rtl819x_ethtool_ops;
-#endif
 
 	dev->type = ARPHRD_ETHER;
 	dev->watchdog_timeo = HZ*3;
@@ -3825,9 +3724,7 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev)
 
 #ifdef ENABLE_GPIO_RADIO_CTL
 		del_timer_sync(&priv->gpio_polling_timer);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 		cancel_delayed_work(&priv->gpio_change_rf_wq);
-#endif
 		priv->polling_timer_on = 0;
 #endif
 		rtl_debug_module_remove(priv);
@@ -3837,14 +3734,11 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev)
 #ifdef CONFIG_ASPM_OR_D3
 		;
 #endif
-		if (priv->pFirmware)
-		{
+		if (priv->pFirmware) {
 			vfree(priv->pFirmware);
 			priv->pFirmware = NULL;
 		}
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 		destroy_workqueue(priv->priv_wq);
-#endif
                 {
                     u32 i;
                     rtl8192_free_rx_ring(dev);
@@ -4012,12 +3906,7 @@ static int __init rtl8192_pci_module_init(void)
 	}
 
 	rtl8192_proc_module_init();
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
-      if (0!=pci_module_init(&rtl8192_pci_driver))
-#else
-      if (0!=pci_register_driver(&rtl8192_pci_driver))
-#endif
-	{
+	if (0!=pci_register_driver(&rtl8192_pci_driver)) {
 		DMESG("No device found");
 		/*pci_unregister_driver (&rtl8192_pci_driver);*/
 		return -ENODEV;
@@ -4070,20 +3959,12 @@ module_exit(rtl8192_pci_module_exit);
 
 MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards");
 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 MODULE_VERSION(DRV_VERSION);
-#endif
 MODULE_LICENSE("GPL");
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
 module_param(ifname, charp, S_IRUGO|S_IWUSR );
 module_param(hwwep,int, S_IRUGO|S_IWUSR);
 module_param(channels,int, S_IRUGO|S_IWUSR);
-#else
-MODULE_PARM(ifname, "s");
-MODULE_PARM(hwwep,"i");
-MODULE_PARM(channels,"i");
-#endif
 
 MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default");
 MODULE_PARM_DESC(hwwep," Try to use hardware WEP support(default use hw. set 0 to use software security)");
diff --git a/drivers/staging/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl_core.h
index d858cc9..1e56ceb 100644
--- a/drivers/staging/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl_core.h
@@ -46,9 +46,6 @@
 #include <linux/random.h>
 #include <linux/version.h>
 #include <asm/io.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
-#include <asm/semaphore.h>
-#endif
 #include "rtllib.h"
 
 #ifdef ENABLE_DOT11D
@@ -95,31 +92,8 @@
 	.driver_data = (kernel_ulong_t)&(cfg)
 	typedef irqreturn_t irqreturn_type;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
-
-#if !defined(PCI_CAP_ID_EXP)
-#define PCI_CAP_ID_EXP			    0x10
-#endif
-#if !defined(PCI_EXP_LNKCTL)
-#define PCI_EXP_LNKCTL			    0x10
-#endif
 
-typedef int __bitwise pci_power_t;
-#define PCI_D0		((pci_power_t __force) 0)
-#define PCI_D1		((pci_power_t __force) 1)
-#define PCI_D2		((pci_power_t __force) 2)
-#define PCI_D3hot	((pci_power_t __force) 3)
-#define PCI_D3cold	((pci_power_t __force) 4)
-#define PCI_UNKNOWN	((pci_power_t __force) 5)
-#define PCI_POWER_ERROR	((pci_power_t __force) -1)
-
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
-	#define rtl8192_interrupt(x,y,z) rtl8192_interrupt_rsl(x,y,z)
-#else
-	#define rtl8192_interrupt(x,y,z) rtl8192_interrupt_rsl(x,y)
-#endif
+#define rtl8192_interrupt(x,y,z) rtl8192_interrupt_rsl(x,y)
 
 #define RTL_MAX_SCAN_SIZE 128
 
@@ -592,10 +566,6 @@ typedef struct r8192_priv
 	struct pci_dev *pdev;
 	struct pci_dev *bridge_pdev;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
-	u32		pci_state;
-#endif
-
 	bool		bfirst_init;
 	bool		bfirst_after_down;
 	bool		initialized_at_probe;
@@ -684,11 +654,7 @@ typedef struct r8192_priv
 
 	struct semaphore			wx_sem;
 	struct semaphore			rf_sem;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
-	struct semaphore			mutex;
-#else
 	struct mutex				mutex;
-#endif
 
 	struct Stats				stats;
 	struct iw_statistics			wstats;
diff --git a/drivers/staging/rtl8192e/rtl_debug.c b/drivers/staging/rtl8192e/rtl_debug.c
index 6883994..cec8998 100644
--- a/drivers/staging/rtl8192e/rtl_debug.c
+++ b/drivers/staging/rtl8192e/rtl_debug.c
@@ -243,12 +243,7 @@ int rtl_debug_module_init(struct r8192_priv *priv, const char *name)
 	if (!rtl_debugfs_root)
 		return -ENOENT;
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
 	debug = kzalloc(sizeof(rtl_fs_debug), GFP_KERNEL);
-#else
-	rtl_fs_debug = kmalloc(sizeof(*rtl_fs_debug), GFP_KERNEL);
-	memset(rtl_fs_debug,0,sizeof(*rtl_fs_debug));
-#endif
 	if (!debug) {
 		ret = -ENOMEM;
 		goto err;
@@ -1086,21 +1081,13 @@ static int proc_get_stats_rx(char *page, char **start,
 void rtl8192_proc_module_init(void)
 {
 	RT_TRACE(COMP_INIT, "Initializing proc filesystem");
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-	rtl8192_proc=create_proc_entry(DRV_NAME, S_IFDIR, proc_net);
-#else
 	rtl8192_proc=create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net);
-#endif
 }
 
 
 void rtl8192_proc_module_remove(void)
 {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-	remove_proc_entry(DRV_NAME, proc_net);
-#else
 	remove_proc_entry(DRV_NAME, init_net.proc_net);
-#endif
 }
 
 
diff --git a/drivers/staging/rtl8192e/rtl_debug.h b/drivers/staging/rtl8192e/rtl_debug.h
index 5ae7c7d..8d85979 100644
--- a/drivers/staging/rtl8192e/rtl_debug.h
+++ b/drivers/staging/rtl8192e/rtl_debug.h
@@ -27,9 +27,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
 #include <linux/debugfs.h>
-#endif
 
 struct r8192_priv;
 struct _tx_desc_8192se;
@@ -272,11 +270,7 @@ typedef struct _rtl_fs_debug
 	struct dentry *debug_register;
 	u32 hw_type;
 	u32 hw_offset;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
 	bool hw_holding;
-#else
-	u8 hw_holding;
-#endif
 } rtl_fs_debug;
 
 void print_buffer(u32 *buffer, int len);
diff --git a/drivers/staging/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl_dm.c
index 5ea11c5..e864acb 100644
--- a/drivers/staging/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl_dm.c
@@ -25,41 +25,6 @@
 #include "r8192E_cmdpkt.h"
 
 /*---------------------------Define Local Constant---------------------------*/
-#ifdef  RTL8190P
-static u32 edca_setting_DL[HT_IOT_PEER_MAX] =
-{ 0x5e4322,
-   0x5e4322,
-   0x5ea44f,
-   0x5e4322,
-   0x604322,
-   0xa44f,
-   0x5e4322,
-   0x5e4322
- };
-
-static u32 edca_setting_DL_GMode[HT_IOT_PEER_MAX] =
-{ 0x5e4322,
-   0x5e4322,
-   0x5e4322,
-   0x5e4322,
-   0x604322,
-   0xa44f,
-   0x5e4322,
-   0x5e4322
-};
-
-static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
-{ 0x5e4322,
-   0xa44f,
-   0x5ea44f,
-   0x5e4322,
-   0x604322,
-   0x5e4322,
-   0x5e4322,
-   0x5e4322
-};
-
-#elif defined RTL8192E
 static u32 edca_setting_DL[HT_IOT_PEER_MAX] =
 { 0x5e4322,
    0x5e4322,
@@ -93,48 +58,6 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
    0x5e4332
 };
 
-#elif defined(RTL8192SE)
-static u32 edca_setting_DL[HT_IOT_PEER_MAX] =
-{ 0xa44f,
-   0x5ea44f,
-   0x5ea44f,
-   0xa630,
-   0xa44f,
-   0xa630,
-   0xa630,
-   0xa42b,
-   0x5e4322,
-   0x5e4322
- };
-
-static u32 edca_setting_DL_GMode[HT_IOT_PEER_MAX] =
-
-{ 0x4322,
-   0xa44f,
-   0x5ea44f,
-   0xa42b,
-   0x5e4322,
-   0x4322,
-   0xa430,
-   0x5ea44f,
-   0x5e4322,
-   0x5e4322
-};
-
-static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
-{ 0x5e4322,
-   0xa44f,
-   0x5ea44f,
-   0x5ea322,
-   0x5ea422,
-   0x5ea322,
-   0x3ea44f,
-   0x5ea44f,
-   0x5e4322,
-   0x5e4322
- };
-#endif
-
 #define RTK_UL_EDCA 0xa44f
 #define RTK_DL_EDCA 0x5e4322
 /*---------------------------Define Local Constant---------------------------*/
@@ -1255,24 +1178,13 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev)
 
 void	dm_txpower_trackingcallback(void *data)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 	struct r8192_priv *priv = container_of_dwork_rsl(data,struct r8192_priv,txpower_tracking_wq);
 	struct net_device *dev = priv->rtllib->dev;
-#else
-	struct net_device *dev = (struct net_device *)data;
-	struct r8192_priv *priv = rtllib_priv(dev);
-#endif
 
-#ifdef RTL8190P
-	dm_TXPowerTrackingCallback_TSSI(dev);
-#elif defined(RTL8192E)
 	if (priv->IC_Cut >= IC_VersionCut_D)
 		dm_TXPowerTrackingCallback_TSSI(dev);
 	else
 		dm_TXPowerTrackingCallback_ThermalMeter(dev);
-#elif defined(RTL8192SE)
-	dm_TXPowerTrackingCallback_ThermalMeter(dev);
-#endif
 }
 
 #ifndef RTL8192SE
@@ -1776,16 +1688,10 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
 
 }
 #endif
-#ifndef RTL8190P
 static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-#ifdef RTL8192SE
-		priv->btxpower_tracking = false;
-		priv->txpower_count       = 0;
-		priv->btxpower_trackingInit = false;
-#else
 
 	if (priv->rtllib->FwRWRF)
 		priv->btxpower_tracking = true;
@@ -1793,16 +1699,12 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev)
 		priv->btxpower_tracking = false;
 	priv->txpower_count       = 0;
 	priv->btxpower_trackingInit = false;
-#endif
 	RT_TRACE(COMP_POWER_TRACKING, "pMgntInfo->bTXPowerTracking = %d\n", priv->btxpower_tracking);
 }
-#endif
 
 void dm_initialize_txpower_tracking(struct net_device *dev)
 {
-#ifdef RTL8192E
 	struct r8192_priv *priv = rtllib_priv(dev);
-#endif
 #ifdef RTL8190P
 	dm_InitializeTXPowerTracking_TSSI(dev);
 #elif defined RTL8192E
@@ -3365,13 +3267,8 @@ static	void	dm_check_pbc_gpio(struct net_device *dev)
 
 extern	void	dm_CheckRfCtrlGPIO(void *data)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
        struct r8192_priv *priv = container_of_dwork_rsl(data,struct r8192_priv,gpio_change_rf_wq);
        struct net_device *dev = priv->rtllib->dev;
-#else
-	struct r8192_priv *priv = rtllib_priv((struct net_device *)data);
-	struct net_device *dev = priv->rtllib->dev;
-#endif
 	u8 tmp1byte;
 	RT_RF_POWER_STATE	eRfPowerStateToSet;
 	bool bActuallySet = false;
@@ -3652,13 +3549,8 @@ u8 RfOnOffDetect(struct net_device *dev)
 
 extern void dm_CheckRfCtrlGPIO(void *data)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
-	struct r8192_priv *priv = container_of_dwork_rsl(data,struct r8192_priv,gpio_change_rf_wq);
-	struct net_device *dev = priv->rtllib->dev;
-#else
 	struct net_device *dev = (struct net_device *)data;
 	struct r8192_priv *priv = rtllib_priv(dev);
-#endif
 
 	RT_RF_POWER_STATE	eRfPowerStateToSet, CurRfState;
 	bool					bActuallySet = false;
@@ -3707,13 +3599,6 @@ extern void dm_CheckRfCtrlGPIO(void *data)
 		RT_DISABLE_ASPM(dev);
 		RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
 	}
-	else if ((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3) && RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3))
-	{
-#ifdef TODO
-		RT_LEAVE_D3(dev, false);
-		RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
-#endif
-	}
 
 #endif
 	if (RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC))
@@ -3753,20 +3638,12 @@ extern void dm_CheckRfCtrlGPIO(void *data)
 	if (bActuallySet) {
 		priv->bHwRfOffAction = 1;
 #ifdef CONFIG_ASPM_OR_D3
-		if (eRfPowerStateToSet == eRfOn)
-		{
-			if ((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) && RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM))
-			{
+		if (eRfPowerStateToSet == eRfOn) {
+			if ((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) &&
+			     RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM)) {
 				RT_DISABLE_ASPM(dev);
 				RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
 			}
-#ifdef TODO
-			else if ((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3) && RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3))
-			{
-				RT_LEAVE_D3(dev, false);
-				RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
-			}
-#endif
 		}
 #endif
 		spin_lock_irqsave(&priv->rf_ps_lock,flag);
@@ -3797,54 +3674,33 @@ extern void dm_CheckRfCtrlGPIO(void *data)
 
 		if (eRfPowerStateToSet == eRfOff)
 		{
-			if (priv->pwrdown){
-
+			if (priv->pwrdown)
 				write_nic_byte(dev, SYS_FUNC_EN+1, 0x31);
-			}
 #ifdef CONFIG_ASPM_OR_D3
-			if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM)
-			{
+			if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) {
 				RT_ENABLE_ASPM(dev);
 				RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
 			}
-#ifdef TODO
-			else if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3)
-			{
-				RT_ENTER_D3(dev, false);
-				RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
-			}
-#endif
 #endif
 		}
-	}
-	else if (eRfPowerStateToSet == eRfOff || CurRfState == eRfOff || priv->bDriverIsGoingToUnload)
-	{
+	} else if (eRfPowerStateToSet == eRfOff || CurRfState == eRfOff ||
+		   priv->bDriverIsGoingToUnload) {
 
-		if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC && turnonbypowerdomain)
-		{
+		if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC &&
+		    turnonbypowerdomain) {
 			PHY_SetRtl8192seRfHalt(dev);
 			RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC);
 		}
 #ifdef CONFIG_ASPM_OR_D3
-		if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM)
-		{
+		if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) {
 			RT_ENABLE_ASPM(dev);
 			RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
 		}
-#ifdef TODO
-		else if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3)
-		{
-			RT_ENTER_D3(dev, false);
-			RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
-		}
-#endif
 #endif
 		spin_lock_irqsave(&priv->rf_ps_lock,flag);
 		priv->RFChangeInProgress = false;
 		spin_unlock_irqrestore(&priv->rf_ps_lock,flag);
-	}
-	else
-	{
+	} else {
 		spin_lock_irqsave(&priv->rf_ps_lock,flag);
 		priv->RFChangeInProgress = false;
 		spin_unlock_irqrestore(&priv->rf_ps_lock,flag);
@@ -3854,20 +3710,13 @@ extern void dm_CheckRfCtrlGPIO(void *data)
 #endif
 void	dm_rf_pathcheck_workitemcallback(void *data)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 	struct r8192_priv *priv = container_of_dwork_rsl(data,struct r8192_priv,rfpath_check_wq);
 	struct net_device *dev =priv->rtllib->dev;
-#else
-	struct net_device *dev = (struct net_device *)data;
-	struct r8192_priv *priv = rtllib_priv(dev);
-#endif
 	u8 rfpath = 0, i;
 
-
 	rfpath = read_nic_byte(dev, 0xc04);
 
-	for (i = 0; i < RF90_PATH_MAX; i++)
-	{
+	for (i = 0; i < RF90_PATH_MAX; i++) {
 		if (rfpath & (0x01<<i))
 			priv->brfpath_rxenable[i] = 1;
 		else
@@ -4161,21 +4010,12 @@ static void dm_init_fsync (struct net_device *dev)
 	priv->rtllib->fsync_time_interval = 500;
 	priv->rtllib->fsync_rate_bitmap = 0x0f000800;
 	priv->rtllib->fsync_rssi_threshold = 30;
-#ifdef RTL8190P
-	priv->rtllib->bfsync_enable = true;
-#elif defined RTL8192E || defined RTL8192SE
 	priv->rtllib->bfsync_enable = false;
-#endif
 	priv->rtllib->fsync_multiple_timeinterval = 3;
 	priv->rtllib->fsync_firstdiff_ratethreshold= 100;
 	priv->rtllib->fsync_seconddiff_ratethreshold= 200;
 	priv->rtllib->fsync_state = Default_Fsync;
-
-#ifdef RTL8192SE
-	priv->framesyncMonitor = 0;
-#elif defined RTL8192E || defined RTL8190P
 	priv->framesyncMonitor = 1;
-#endif
 
 	init_timer(&priv->fsync_timer);
 	setup_timer(&priv->fsync_timer, dm_fsync_timer_callback,(unsigned long) dev);
@@ -4314,31 +4154,22 @@ extern void dm_fsync_timer_callback(unsigned long data)
 
 static void dm_StartHWFsync(struct net_device *dev)
 {
-#if defined RTL8192E
 	u8 rf_timing = 0x77;
 	struct r8192_priv *priv = rtllib_priv(dev);
 	RT_TRACE(COMP_HALDM, "%s\n", __func__);
 	write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cf);
 	priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, (u8*)(&rf_timing));
 	write_nic_byte(dev, 0xc3b, 0x41);
-#elif defined RTL8192SE
-	write_nic_byte(dev, rOFDM0_RxDetector3, 0x96);
-#endif
 }
 
 static void dm_EndHWFsync(struct net_device *dev)
 {
-#if defined RTL8192E
 	u8 rf_timing = 0xaa;
 	struct r8192_priv *priv = rtllib_priv(dev);
 	RT_TRACE(COMP_HALDM,"%s\n", __func__);
 	write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd);
 	priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, (u8*)(&rf_timing));
 	write_nic_byte(dev, 0xc3b, 0x49);
-#elif defined RTL8192SE
-	write_nic_byte(dev, rOFDM0_RxDetector3, 0x94);
-#endif
-
 }
 
 static void dm_EndSWFsync(struct net_device *dev)
@@ -4650,205 +4481,4 @@ static void dm_send_rssi_tofw(struct net_device *dev)
 								DESC_PACKET_TYPE_INIT, sizeof(DCMD_TXCMD_T));
 }
 
-#if defined RTL8192SE
-/*-----------------------------------------------------------------------------
- * Function:	dm_RefreshRateAdaptiveMask()
- *
- * Overview:	Update rate table mask according to rssi
- *
- * Input:		NONE
- *
- * Output:		NONE
- *
- * Return:		NONE
- *
- * Revised History:
- *	When		Who		Remark
- *	05/27/2009	hpfan	Create Version 0.
- *
- *---------------------------------------------------------------------------*/
-static void dm_RefreshRateAdaptiveMask(struct net_device *dev)
-{
-	struct r8192_priv *priv = rtllib_priv(dev);
-	prate_adaptive	pRA = (prate_adaptive)&priv->rate_adaptive;
-	u32	LowRSSIThreshForRA = 0, HighRSSIThreshForRA = 0;
-	u8	rssi_level;
-
-	if (IS_NIC_DOWN(priv)){
-		RT_TRACE(COMP_RATE,"<---- dm_RefreshRateAdaptiveMask(): driver is going to unload\n");
-		return;
-	}
-
-	if (!priv->rtllib->bUseRAMask){
-		return;
-	}
-
-	if (priv->pFirmware->FirmwareVersion >= 61 && !priv->bInformFWDriverControlDM){
-		RT_TRACE(COMP_RATE, "<---- dm_RefreshRateAdaptiveMask(): inform fw driver control dm\n");
-		priv->rtllib->SetFwCmdHandler(dev, FW_CMD_CTRL_DM_BY_DRIVER);
-		priv->bInformFWDriverControlDM = true;
-	}
-
-	if ((priv->rtllib->state == RTLLIB_LINKED &&
-	    (priv->rtllib->iw_mode == IW_MODE_INFRA))) {
-
-		switch (pRA->PreRATRState){
-		case DM_RATR_STA_HIGH:
-			HighRSSIThreshForRA = 50;
-			LowRSSIThreshForRA = 20;
-			break;
-		case DM_RATR_STA_MIDDLE:
-			HighRSSIThreshForRA = 55;
-			LowRSSIThreshForRA = 20;
-			break;
-		case DM_RATR_STA_LOW:
-			HighRSSIThreshForRA = 50;
-			LowRSSIThreshForRA = 25;
-			break;
-		default:
-			HighRSSIThreshForRA = 50;
-			LowRSSIThreshForRA = 20;
-			break;
-		}
-
-		if (priv->undecorated_smoothed_pwdb > (long)HighRSSIThreshForRA) {
-			pRA->ratr_state = DM_RATR_STA_HIGH;
-			rssi_level = 1;
-		} else if (priv->undecorated_smoothed_pwdb > (long)LowRSSIThreshForRA) {
-			pRA->ratr_state = DM_RATR_STA_MIDDLE;
-			rssi_level = 2;
-		} else {
-			pRA->ratr_state = DM_RATR_STA_LOW;
-			rssi_level = 3;
-		}
-		if ((pRA->PreRATRState != pRA->ratr_state) ||
-		    ((pRA->PreRATRState == pRA->ratr_state) &&
-		    (rssi_level != priv->rssi_level))) {
-			RT_TRACE(COMP_RATE, "Target AP addr : "MAC_FMT"\n",
-				 MAC_ARG(priv->rtllib->current_network.bssid));
-			RT_TRACE(COMP_RATE, "RSSI = %ld\n",
-				 priv->undecorated_smoothed_pwdb);
-			RT_TRACE(COMP_RATE, "RSSI_LEVEL = %d\n", rssi_level);
-			RT_TRACE(COMP_RATE, "PreState = %d, CurState = %d\n",
-				 pRA->PreRATRState, pRA->ratr_state);
-			priv->rtllib->UpdateHalRAMaskHandler(dev, false, 0,
-					 priv->rtllib->pHTInfo->PeerMimoPs,
-					 priv->rtllib->mode,
-					 priv->rtllib->pHTInfo->bCurTxBW40MHz,
-					 rssi_level);
-			priv->rssi_level = rssi_level;
-			pRA->PreRATRState = pRA->ratr_state;
-		}
-	}
-	if ((priv->rtllib->state == RTLLIB_LINKED) &&
-	    (priv->rtllib->iw_mode == IW_MODE_ADHOC)) {
-		int i;
-		struct sta_info *pEntry;
-
-		for (i = 0; i < PEER_MAX_ASSOC; i++) {
-			pEntry = priv->rtllib->peer_assoc_list[i];
-			if (NULL != pEntry) {
-				pRA = &pEntry->rate_adaptive;
-				switch (pRA->PreRATRState){
-				case DM_RATR_STA_HIGH:
-					HighRSSIThreshForRA = 50;
-					LowRSSIThreshForRA = 20;
-					break;
-				case DM_RATR_STA_MIDDLE:
-					HighRSSIThreshForRA = 55;
-					LowRSSIThreshForRA = 20;
-					break;
-				case DM_RATR_STA_LOW:
-					HighRSSIThreshForRA = 50;
-					LowRSSIThreshForRA = 25;
-					break;
-				default:
-					HighRSSIThreshForRA = 50;
-					LowRSSIThreshForRA = 20;
-					break;
-				}
-
-				if (pEntry->rssi_stat.UndecoratedSmoothedPWDB > HighRSSIThreshForRA) {
-					pRA->ratr_state = DM_RATR_STA_HIGH;
-					rssi_level = 1;
-				} else if (pEntry->rssi_stat.UndecoratedSmoothedPWDB > LowRSSIThreshForRA) {
-					pRA->ratr_state = DM_RATR_STA_MIDDLE;
-					rssi_level = 2;
-				} else {
-					pRA->ratr_state = DM_RATR_STA_LOW;
-					rssi_level = 3;
-				}
-
-				if (pRA->PreRATRState != pRA->ratr_state) {
-					RT_TRACE(COMP_RATE, "AsocEntry addr : "
-						 MAC_FMT"\n",
-						 MAC_ARG(pEntry->macaddr));
-					RT_TRACE(COMP_RATE, "RSSI = %ld\n",
-						 pEntry->rssi_stat.UndecoratedSmoothedPWDB);
-					RT_TRACE(COMP_RATE,
-						 "RSSI_LEVEL = %d\n",
-						 rssi_level);
-					RT_TRACE(COMP_RATE,
-						 "PreState = %d, CurState = %d\n",
-						 pRA->PreRATRState,
-						 pRA->ratr_state);
-					priv->rtllib->UpdateHalRAMaskHandler(
-							dev, false,
-							pEntry->aid+1,
-							pEntry->htinfo.MimoPs,
-							pEntry->wireless_mode,
-							pEntry->htinfo.bCurTxBW40MHz,
-							rssi_level);
-					pRA->PreRATRState = pRA->ratr_state;
-				}
-
-			}
-		}
-	}
-}
-
-void Adhoc_InitRateAdaptive(struct net_device *dev,struct sta_info  *pEntry)
-{
-	prate_adaptive	pRA = (prate_adaptive)&pEntry->rate_adaptive;
-	struct r8192_priv *priv = rtllib_priv(dev);
-
-	pRA->ratr_state = DM_RATR_STA_MAX;
-	pRA->high2low_rssi_thresh_for_ra = RateAdaptiveTH_High;
-	pRA->low2high_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M+5;
-	pRA->low2high_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M+5;
-
-	pRA->high_rssi_thresh_for_ra = RateAdaptiveTH_High+5;
-	pRA->low_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M;
-	pRA->low_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M;
-
-	if (priv->rf_type == RF_2T4R) {
-		/* 2008/01/11 MH Modify 2T RATR table for different RSSI. */
-		pRA->upper_rssi_threshold_ratr		=	0x8f0f0000;
-		pRA->middle_rssi_threshold_ratr		=	0x8d0ff000;
-		pRA->low_rssi_threshold_ratr		=	0x8f0ff003;
-		pRA->low_rssi_threshold_ratr_40M	=	0x8f0ff007;
-		pRA->low_rssi_threshold_ratr_20M	=	0x8f0ff003;
-	}
-	else if (priv->rf_type == RF_1T2R)
-	{
-		pRA->upper_rssi_threshold_ratr		=	0x000f0000;
-		pRA->middle_rssi_threshold_ratr		=	0x000ff000;
-		pRA->low_rssi_threshold_ratr		=	0x000ff003;
-		pRA->low_rssi_threshold_ratr_40M	=	0x000ff007;
-		pRA->low_rssi_threshold_ratr_20M	=	0x000ff003;
-	}
-
-}
-
-
-void Adhoc_InitRateAdaptiveState(struct net_device *dev,struct sta_info  *pEntry)
-{
-	prate_adaptive	pRA = (prate_adaptive)&pEntry->rate_adaptive;
-
-	pRA->ratr_state = DM_RATR_STA_MAX;
-	pRA->PreRATRState = DM_RATR_STA_MAX;
-}
-
-
-#endif
 /*---------------------------Define function prototype------------------------*/
diff --git a/drivers/staging/rtl8192e/rtl_ethtool.c b/drivers/staging/rtl8192e/rtl_ethtool.c
index 6c732e1..36452fb 100644
--- a/drivers/staging/rtl8192e/rtl_ethtool.c
+++ b/drivers/staging/rtl8192e/rtl_ethtool.c
@@ -29,7 +29,6 @@
 
 #include "rtl_core.h"
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 static void rtl819x_ethtool_get_drvinfo(struct net_device *dev,
 		struct ethtool_drvinfo *info)
 {
@@ -37,10 +36,6 @@ static void rtl819x_ethtool_get_drvinfo(struct net_device *dev,
 
 	strcpy(info->driver, DRV_NAME);
 	strcpy(info->version, DRV_VERSION);
-#if defined RTL8192SE
-	snprintf(info->fw_version, sizeof(info->fw_version), "%d",
-			priv->pFirmware->FirmwareVersion);
-#endif
 	strcpy(info->bus_info, pci_name(priv->pdev));
 }
 
@@ -56,4 +51,3 @@ const struct ethtool_ops rtl819x_ethtool_ops = {
 	.get_drvinfo = rtl819x_ethtool_get_drvinfo,
 	.get_link = rtl819x_ethtool_get_link,
 };
-#endif
diff --git a/drivers/staging/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl_pci.c
index 39b96c1..2416db1 100644
--- a/drivers/staging/rtl8192e/rtl_pci.c
+++ b/drivers/staging/rtl8192e/rtl_pci.c
@@ -25,337 +25,6 @@
 #include "rtl_pci.h"
 #include "rtl_core.h"
 
-#if defined RTL8192CE || defined RTL8192SE
-bool
-rtl8192_get_LinkControl_field(
-	struct net_device *dev,
-	u8			BusNum,
-	u8			DevNum,
-	u8			FuncNum
-	)
-{
-	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
-
-	RT_PCI_CAPABILITIES_HEADER		CapabilityHdr;
-	unsigned char	CapabilityOffset, Num4Bytes;
-	u32			PciCfgAddrPort=0;
-	u8			LinkCtrlReg;
-	bool			Status = false;
-
-	if ( BusNum == 0xff && DevNum == 0xff && FuncNum == 0xff ){
-		printk("GetLinkControlField(): Fail to find PCIe Capability\n");
-		return false;
-	}
-
-
-	PciCfgAddrPort= (BusNum<< 16)|(DevNum << 11)|(FuncNum <<  8)|(1 << 31);
-
-
-	Num4Bytes = 0x34/4;
-	NdisRawWritePortUlong(PCI_CONF_ADDRESS , PciCfgAddrPort+( Num4Bytes<< 2));
-	NdisRawReadPortUchar(PCI_CONF_DATA, &CapabilityOffset);
-
-
-	while (CapabilityOffset != 0)
-	{
-		Num4Bytes = CapabilityOffset/4;
-
-
-		NdisRawWritePortUlong(PCI_CONF_ADDRESS , PciCfgAddrPort+( Num4Bytes<< 2));
-		NdisRawReadPortUshort(PCI_CONF_DATA, (u16*)&CapabilityHdr);
-
-		if (CapabilityHdr.CapabilityID == PCI_CAPABILITY_ID_PCI_EXPRESS)
-		{
-			break;
-		}
-		else
-		{
-			CapabilityOffset = CapabilityHdr.Next;
-		}
-	}
-
-
-	if (CapabilityHdr.CapabilityID == PCI_CAPABILITY_ID_PCI_EXPRESS)
-	{
-		Num4Bytes = (CapabilityOffset+0x10)/4;
-
-		NdisRawWritePortUlong(PCI_CONF_ADDRESS , PciCfgAddrPort+(Num4Bytes << 2));
-		NdisRawReadPortUchar(PCI_CONF_DATA, &LinkCtrlReg);
-
-		priv->NdisAdapter.PciBridgePCIeHdrOffset = CapabilityOffset;
-		priv->NdisAdapter.PciBridgeLinkCtrlReg = LinkCtrlReg;
-
-		Status = true;
-	}
-	else
-	{
-		printk("GetLinkControlField(): Cannot Find PCIe Capability\n");
-	}
-
-	return Status;
-}
-
-bool
-rtl8192_get_pci_BusInfo(
-	struct net_device *dev,
-	u16			VendorId,
-	u16			DeviceId,
-	u8			IRQL,
-	u8			BaseCode,
-	u8			SubClass,
-	u8			filed19val,
-	u8*			BusNum,
-	u8*			DevNum,
-	u8*			FuncNum
-	)
-{
-
-	u8			busNumIdx, deviceNumIdx, functionNumIdx;
-	u32			PciCfgAddrPort=0;
-	u32			devVenID = 0, classCode, field19, headertype;
-	u16			venId, devId;
-	u8			basec, subc, irqLine;
-	u16			RegOffset;
-	bool			bSingleFunc = false;
-	bool			bBridgeChk = false;
-
-	*BusNum = 0xFF;
-	*DevNum = 0xFF;
-	*FuncNum = 0xFF;
-
-	if ((BaseCode == PCI_CLASS_BRIDGE_DEV) && (SubClass==PCI_SUBCLASS_BR_PCI_TO_PCI) && (filed19val==U1DONTCARE))
-		bBridgeChk = true;
-
-	for (busNumIdx = 0; busNumIdx < PCI_MAX_BRIDGE_NUMBER  ; busNumIdx++)
-	{
-		for (deviceNumIdx = 0; deviceNumIdx < PCI_MAX_DEVICES; deviceNumIdx ++)
-		{
-			bSingleFunc = false;
-			for (functionNumIdx = 0; functionNumIdx < PCI_MAX_FUNCTION; functionNumIdx++)
-			{
-
-				if (functionNumIdx == 0)
-				{
-					PciCfgAddrPort= (busNumIdx << 16)|(deviceNumIdx << 11)|(functionNumIdx <<  8)|(1 << 31);
-					NdisRawWritePortUlong(PCI_CONF_ADDRESS ,  PciCfgAddrPort + (3 << 2));
-					NdisRawReadPortUlong(PCI_CONF_DATA, &headertype);
-					headertype = ((headertype >> 16) & 0x0080) >> 7;
-					if ( headertype == 0)
-						bSingleFunc = true;
-				}
-				else
-				{
-					if (bSingleFunc == true) break;
-				}
-
-				PciCfgAddrPort= (busNumIdx << 16)|(deviceNumIdx << 11)|(functionNumIdx <<  8)|(1 << 31);
-
-				NdisRawWritePortUlong(PCI_CONF_ADDRESS , PciCfgAddrPort);
-				NdisRawReadPortUlong(PCI_CONF_DATA, &devVenID);
-
-				if ( devVenID == 0xFFFFFFFF||devVenID == 0 ) continue;
-
-				RegOffset = 0x3C;
-				PciCfgAddrPort= (busNumIdx << 16)|(deviceNumIdx << 11)|(functionNumIdx <<  8)|(1 << 31)|(RegOffset & 0xFFFFFFFC);
-				NdisRawWritePortUlong(PCI_CONF_ADDRESS , PciCfgAddrPort);
-				NdisRawReadPortUchar((PCI_CONF_DATA+ (RegOffset & 0x3)), &irqLine);
-
-				venId = (u16)(devVenID >>  0)& 0xFFFF;
-				devId = (u16)(devVenID >> 16)& 0xFFFF;
-
-				if (!bBridgeChk && (venId != VendorId) && (VendorId != U2DONTCARE))
-					continue;
-
-				if (!bBridgeChk && (devId != DeviceId) && (DeviceId != U2DONTCARE))
-					continue;
-
-				if (!bBridgeChk && (irqLine != IRQL) && (IRQL != U1DONTCARE))
-					continue;
-
-				PciCfgAddrPort= (busNumIdx << 16)|(deviceNumIdx << 11)|(functionNumIdx <<  8)|(1 << 31);
-				NdisRawWritePortUlong(PCI_CONF_ADDRESS ,  PciCfgAddrPort + (2 << 2));
-				NdisRawReadPortUlong(PCI_CONF_DATA, &classCode);
-				classCode = classCode >> 8;
-
-				basec = (u8)(classCode >>16 ) & 0xFF;
-				subc = (u8)(classCode >>8 ) & 0xFF;
-				if (bBridgeChk && (venId != VendorId) &&(basec == BaseCode) && (subc== SubClass ) )
-					return true;
-
-				if (bBridgeChk && (venId != VendorId) && (VendorId != U2DONTCARE))
-					continue;
-
-				if (bBridgeChk && (devId != DeviceId) && (DeviceId != U2DONTCARE))
-					continue;
-
-				if (bBridgeChk && (irqLine != IRQL) && (IRQL != U1DONTCARE))
-					continue;
-
-
-				NdisRawWritePortUlong(PCI_CONF_ADDRESS ,  PciCfgAddrPort + (6 << 2));
-				NdisRawReadPortUlong(PCI_CONF_DATA, &field19);
-				field19 = (field19 >> 8)& 0xFF;
-
-				if ((basec == BaseCode) && (subc== SubClass ) && ((field19 == filed19val) ||(filed19val==U1DONTCARE) ))
-				{
-					*BusNum = busNumIdx;
-					*DevNum = deviceNumIdx;
-					*FuncNum = functionNumIdx;
-
-					printk( "GetPciBusInfo(): Find Device(%X:%X)  bus=%d dev=%d, func=%d\n",VendorId, DeviceId, busNumIdx, deviceNumIdx, functionNumIdx);
-					return true;
-				}
-			}
-		}
-	}
-
-	printk( "GetPciBusInfo(): Cannot Find Device(%X:%X:%X)\n",VendorId, DeviceId, devVenID);
-	return false;
-}
-
-bool rtl8192_get_pci_BridegInfo(
-	struct net_device *dev,
-	u8			BaseCode,
-	u8			SubClass,
-	u8			filed19val,
-	u8*			BusNum,
-	u8*			DevNum,
-	u8*			FuncNum,
-	u16*		VendorId,
-	u16*		DeviceId
-	)
-
-{
-
-	u8			busNumIdx, deviceNumIdx, functionNumIdx;
-	u32			PciCfgAddrPort=0;
-	u32			devVenID, classCode, field19, headertype;
-	u16			venId, devId;
-	u8			basec, subc, irqLine;
-	u16			RegOffset;
-	bool			bSingleFunc = false;
-
-	*BusNum = 0xFF;
-	*DevNum = 0xFF;
-	*FuncNum = 0xFF;
-
-	for (busNumIdx = 0; busNumIdx < PCI_MAX_BRIDGE_NUMBER  ; busNumIdx++)
-	{
-		for (deviceNumIdx = 0; deviceNumIdx < PCI_MAX_DEVICES; deviceNumIdx ++)
-		{
-			bSingleFunc = false;
-			for (functionNumIdx = 0; functionNumIdx < PCI_MAX_FUNCTION; functionNumIdx++)
-			{
-
-				if (functionNumIdx == 0)
-				{
-					PciCfgAddrPort= (busNumIdx << 16)|(deviceNumIdx << 11)|(functionNumIdx <<  8)|(1 << 31);
-					NdisRawWritePortUlong(PCI_CONF_ADDRESS ,  PciCfgAddrPort + (3 << 2));
-					NdisRawReadPortUlong(PCI_CONF_DATA, &headertype);
-					headertype = ((headertype >> 16) & 0x0080) >> 7;
-					if ( headertype == 0)
-						bSingleFunc = true;
-				}
-				else
-				{
-					if ( bSingleFunc ==true ) break;
-				}
-
-				PciCfgAddrPort= (busNumIdx << 16)|(deviceNumIdx << 11)|(functionNumIdx <<  8)|(1 << 31);
-
-				NdisRawWritePortUlong(PCI_CONF_ADDRESS , PciCfgAddrPort);
-				NdisRawReadPortUlong(PCI_CONF_DATA, &devVenID);
-
-				RegOffset = 0x3C;
-				PciCfgAddrPort= (busNumIdx << 16)|(deviceNumIdx << 11)|(functionNumIdx <<  8)|(1 << 31)|(RegOffset & 0xFFFFFFFC);
-				NdisRawWritePortUlong(PCI_CONF_ADDRESS , PciCfgAddrPort);
-				NdisRawReadPortUchar((PCI_CONF_DATA+ (RegOffset & 0x3)), &irqLine);
-
-				venId = (u16)(devVenID >>  0)& 0xFFFF;
-				devId = (u16)(devVenID >> 16)& 0xFFFF;
-
-				PciCfgAddrPort= (busNumIdx << 16)|(deviceNumIdx << 11)|(functionNumIdx <<  8)|(1 << 31);
-				NdisRawWritePortUlong(PCI_CONF_ADDRESS ,  PciCfgAddrPort + (2 << 2));
-				NdisRawReadPortUlong(PCI_CONF_DATA, &classCode);
-				classCode = classCode >> 8;
-
-				basec = (u8)(classCode >>16 ) & 0xFF;
-				subc = (u8)(classCode >>8 ) & 0xFF;
-
-				NdisRawWritePortUlong(PCI_CONF_ADDRESS ,  PciCfgAddrPort + (6 << 2));
-				NdisRawReadPortUlong(PCI_CONF_DATA, &field19);
-				field19 = (field19 >> 8)& 0xFF;
-
-				if ((basec == BaseCode) && (subc== SubClass ) && ((field19 == filed19val) ||(filed19val==U1DONTCARE) ))
-				{
-					*BusNum = busNumIdx;
-					*DevNum = deviceNumIdx;
-					*FuncNum = functionNumIdx;
-					*VendorId = venId;
-					*DeviceId = devId;
-
-					printk("GetPciBridegInfo : Find Device(%X:%X)  bus=%d dev=%d, func=%d\n",
-						venId, devId, busNumIdx, deviceNumIdx, functionNumIdx);
-
-					return true;
-				}
-			}
-		}
-	}
-
-	printk( "GetPciBridegInfo(): Cannot Find PciBridge for Device\n");
-
-	return false;
-}
-
-
-static u16 PciBridgeVendorArray[PCI_BRIDGE_VENDOR_MAX]
-	= {INTEL_VENDOR_ID,ATI_VENDOR_ID,AMD_VENDOR_ID,SIS_VENDOR_ID};
-
-void
-rtl8192_pci_find_BridgeInfo(struct net_device *dev)
-{
-	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
-
-	u8	PciBridgeBusNum = 0xff;
-	u8	PciBridgeDevNum = 0xff;
-	u8	PciBridgeFuncNum = 0xff;
-	u16	PciBridgeVendorId= 0xff;
-	u16	PciBridgeDeviceId = 0xff;
-	u8	tmp = 0;
-
-	rtl8192_get_pci_BridegInfo(dev,
-		PCI_CLASS_BRIDGE_DEV,
-		PCI_SUBCLASS_BR_PCI_TO_PCI ,
-		priv->NdisAdapter.BusNumber,
-		&PciBridgeBusNum,
-		&PciBridgeDevNum,
-		&PciBridgeFuncNum,
-		&PciBridgeVendorId,
-		&PciBridgeDeviceId);
-
-
-	priv->NdisAdapter.PciBridgeVendor = PCI_BRIDGE_VENDOR_UNKNOWN;
-
-	for (tmp = 0; tmp < PCI_BRIDGE_VENDOR_MAX; tmp++) {
-		if (PciBridgeVendorId == PciBridgeVendorArray[tmp]) {
-			priv->NdisAdapter.PciBridgeVendor = tmp;
-			printk("Pci Bridge Vendor is found index: %d\n",tmp);
-			break;
-		}
-	}
-	printk("Pci Bridge Vendor is %x\n",PciBridgeVendorArray[tmp]);
-
-	priv->NdisAdapter.PciBridgeBusNum = PciBridgeBusNum;
-	priv->NdisAdapter.PciBridgeDevNum = PciBridgeDevNum;
-	priv->NdisAdapter.PciBridgeFuncNum = PciBridgeFuncNum;
-	priv->NdisAdapter.PciBridgeVendorId = PciBridgeVendorId;
-	priv->NdisAdapter.PciBridgeDeviceId = PciBridgeDeviceId;
-
-
-}
-#endif
-
 static void rtl8192_parse_pci_configuration(struct pci_dev *pdev, struct net_device *dev)
 {
 	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
@@ -417,27 +86,6 @@ bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev)
 		return false;
 	}
 
-#if defined RTL8192CE || defined RTL8192SE
-	rtl8192_get_pci_BusInfo(dev,
-		VenderID,
-		DeviceID,
-		(u8)IrqLine,
-		0x02,0x80, U1DONTCARE,
-		&priv->NdisAdapter.BusNumber,
-		&priv->NdisAdapter.DevNumber,
-		&priv->NdisAdapter.FuncNumber);
-
-	rtl8192_pci_find_BridgeInfo(dev);
-
-#ifdef RTL8192SE
-	if (priv->NdisAdapter.PciBridgeVendor != PCI_BRIDGE_VENDOR_UNKNOWN)
-#endif
-	{
-		rtl8192_get_LinkControl_field(dev, priv->NdisAdapter.PciBridgeBusNum,
-			priv->NdisAdapter.PciBridgeDevNum, priv->NdisAdapter.PciBridgeFuncNum);
-	}
-#endif
-
 	rtl8192_parse_pci_configuration(pdev, dev);
 
 	return true;
diff --git a/drivers/staging/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl_pm.c
index 4fbe819..bcefe2d 100644
--- a/drivers/staging/rtl8192e/rtl_pm.c
+++ b/drivers/staging/rtl8192e/rtl_pm.c
@@ -34,9 +34,7 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct r8192_priv *priv = rtllib_priv(dev);
-#if !(defined RTL8192SE || defined RTL8192CE)
 	u32	ulRegRead;
-#endif
 
         RT_TRACE(COMP_POWER, "============> r8192E suspend call.\n");
         printk("============> r8192E suspend call.\n");
@@ -59,7 +57,6 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
 #endif
 	netif_device_detach(dev);
 
-#if !(defined RTL8192SE || defined RTL8192CE)
 	if (!priv->rtllib->bSupportRemoteWakeUp) {
 		MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT,true);
 		ulRegRead = read_nic_dword(dev, CPU_GEN);
@@ -69,18 +66,9 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
 		write_nic_dword(dev, WFCRC0, 0xffffffff);
 		write_nic_dword(dev, WFCRC1, 0xffffffff);
 		write_nic_dword(dev, WFCRC2, 0xffffffff);
-#ifdef RTL8190P
-		{
-			u8	ucRegRead;
-			ucRegRead = read_nic_byte(dev, GPO);
-			ucRegRead |= BIT0;
-			write_nic_byte(dev, GPO, ucRegRead);
-		}
-#endif
 		write_nic_byte(dev, PMR, 0x5);
 		write_nic_byte(dev, MacBlkCtrl, 0xa);
 	}
-#endif
 out_pci_suspend:
 	RT_TRACE(COMP_POWER, "r8192E support WOL call??????????????????????\n");
 	printk("r8192E support WOL call??????????????????????\n");
@@ -101,9 +89,7 @@ out_pci_suspend:
 int rtl8192E_resume (struct pci_dev *pdev)
 {
     struct net_device *dev = pci_get_drvdata(pdev);
-#if defined ENABLE_GPIO_RADIO_CTL || !(defined RTL8192SE || defined RTL8192CE)
     struct r8192_priv *priv = rtllib_priv(dev);
-#endif
     int err;
     u32 val;
 
@@ -146,11 +132,9 @@ int rtl8192E_resume (struct pci_dev *pdev)
     dev->open(dev);
 #endif
 
-#if !(defined RTL8192SE || defined RTL8192CE)
     if (!priv->rtllib->bSupportRemoteWakeUp) {
 	    MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT,true);
     }
-#endif
 
 out:
     RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
diff --git a/drivers/staging/rtl8192e/rtl_pm.h b/drivers/staging/rtl8192e/rtl_pm.h
index edf8427..22df290 100644
--- a/drivers/staging/rtl8192e/rtl_pm.h
+++ b/drivers/staging/rtl8192e/rtl_pm.h
@@ -25,10 +25,6 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
-#define pm_message_t u32
-#endif
-
 int rtl8192E_save_state (struct pci_dev *dev, pm_message_t state);
 int rtl8192E_suspend (struct pci_dev *dev, pm_message_t state);
 int rtl8192E_resume (struct pci_dev *dev);
diff --git a/drivers/staging/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl_ps.c
index cf40135..65bb397 100644
--- a/drivers/staging/rtl8192e/rtl_ps.c
+++ b/drivers/staging/rtl8192e/rtl_ps.c
@@ -156,13 +156,6 @@ void InactivePsWorkItemCallback(struct net_device *dev)
 			RT_DISABLE_ASPM(dev);
 			RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
 		}
-#ifdef TODO
-		else if ((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3) && RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3))
-		{
-			RT_LEAVE_D3(dev, false);
-			RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
-		}
-#endif
 	}
 #endif
 	MgntActSet_RF_State(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS,false);
@@ -175,13 +168,6 @@ void InactivePsWorkItemCallback(struct net_device *dev)
 			RT_ENABLE_ASPM(dev);
 			RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
 		}
-#ifdef TODO
-		else if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3)
-		{
-			RT_ENTER_D3(dev, false);
-			RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
-		}
-#endif
 	}
 #endif
 
@@ -466,18 +452,6 @@ bool PlatformSwitchClkReq(struct net_device *dev, u8 value)
 	pci_write_config_byte(priv->pdev,0x81,value);
 	bResult = true;
 
-#ifdef TODO
-	if (Buffer) {
-		priv->ClkReqState = true;
-	} else {
-		priv->ClkReqState = false;
-	}
-#endif
-
-#ifdef RTL8192SE
-	udelay(100);
-#endif
-
 	return bResult;
 }
 
@@ -542,15 +516,6 @@ void PlatformEnableASPM(struct net_device *dev)
 		return;
 	}
 
-#ifdef RTL8192SE
-	if (priv->NdisAdapter.PciBridgeVendor != PCI_BRIDGE_VENDOR_INTEL )
-	{
-		RT_TRACE(COMP_POWER, "%s(): Dont modify ASPM for non intel chipset. For Bridge Vendor %d.\n"
-			,__func__,priv->NdisAdapter.PciBridgeVendor);
-		return;
-	}
-#endif
-
 	ASPMLevel |= priv->RegDevicePciASPMSetting;
 	uDeviceASPMSetting = priv->NdisAdapter.LinkCtrlReg;
 
@@ -586,34 +551,6 @@ bool PlatformSetPMCSR(struct net_device *dev,u8 value,bool bTempSetting)
 
 	Buffer= value;
 	spin_lock_irqsave(&priv->D3_lock,flag);
-#ifdef TODO
-	if (bTempSetting)
-	{
-		if (Buffer==0x00)
-		{
-			priv->LeaveD3Cnt++;
-
-			{
-				bActuallySet =true;
-			}
-		}
-		else
-		{
-			priv->LeaveD3Cnt--;
-
-			if (priv->LeaveD3Cnt == 0)
-			{
-				bActuallySet=true;
-			}
-		}
-	}
-	else
-	{
-		priv->LeaveD3Cnt=0;
-		bActuallySet=true;
-		bSetFunc=true;
-	}
-#endif
 	if (bActuallySet) {
 		if (Buffer) {
 			PlatformSwitchClkReq(dev, 0x01);
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 61780a2..c2eae51 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -28,12 +28,7 @@
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 #include <linux/jiffies.h>
-#else
-#include <linux/jffs.h>
-#include <linux/tqueue.h>
-#endif
 #include <linux/timer.h>
 #include <linux/sched.h>
 
@@ -73,27 +68,6 @@
 #define IW_CUSTOM_MAX	256	/* In bytes */
 #endif
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define jiffies_to_msecs(t)  ((t) * 1000 / HZ)
-#ifndef __bitwise
-#define __bitwise __attribute__((bitwise))
-#endif
-typedef __u16  __le16;
-
-#if (WIRELESS_EXT < 16)
-struct iw_spy_data{
-	/* --- Standard spy support --- */
-	int			spy_number;
-	u_char			spy_address[IW_MAX_SPY][ETH_ALEN];
-	struct iw_quality	spy_stat[IW_MAX_SPY];
-	/* --- Enhanced spy support (event) */
-	struct iw_quality	spy_thr_low; /* Low threshold */
-	struct iw_quality	spy_thr_high; /* High threshold */
-	u_char			spy_thr_under[IW_MAX_SPY];
-};
-#endif
-#endif
-
 #ifndef container_of
 /**
  * container_of - cast a member of a structure out to the containing structure
@@ -108,115 +82,32 @@ struct iw_spy_data{
         (type *)( (char *)__mptr - offsetof(type,member) );})
 #endif
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
 #define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb)
-#else
-#define skb_tail_pointer_rsl(skb) skb->tail
-#endif
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-	#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x)
-#else
-	#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL_NOVERS(x)
-#endif
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data)
-{
-	task->routine = func;
-	task->data	= data;
-	INIT_LIST_HEAD(&task->list);
-	task->sync = 0;
-}
-#endif
+#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x)
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
-static inline void setup_timer(struct timer_list * timer, void(*function)(unsigned long), unsigned long data)
-{
-	timer->function = function;
-	timer->data	= data;
-}
-#endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 	typedef struct delayed_work delayed_work_struct_rsl;
 	#define queue_delayed_work_rsl(x,y,z) queue_delayed_work(x,y,z)
 	#define INIT_DELAYED_WORK_RSL(x,y,z) INIT_DELAYED_WORK(x,y)
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
-	typedef struct tq_struct delayed_work_struct_rsl;
-	#define queue_delayed_work_rsl(x,y,z) schedule_task(y)
-	#define INIT_DELAYED_WORK_RSL(x,y,z) tq_init(x,y,z)
-#else
-	typedef struct work_struct delayed_work_struct_rsl;
-	#define queue_delayed_work_rsl(x,y,z) queue_delayed_work(x,y,z)
-	#define INIT_DELAYED_WORK_RSL(x,y,z) INIT_WORK(x,y,z)
-#endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 	typedef struct work_struct work_struct_rsl;
 	#define queue_work_rsl(x,y) queue_work(x,y)
 	#define INIT_WORK_RSL(x,y,z) INIT_WORK(x,y)
-#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
-	typedef struct tq_struct work_struct_rsl;
-	#define queue_work_rsl(x,y) schedule_task(y)
-	#define INIT_WORK_RSL(x,y,z) tq_init(x,y,z)
-#else
-	typedef struct work_struct work_struct_rsl;
-	#define queue_work_rsl(x,y) queue_work(x,y)
-	#define INIT_WORK_RSL(x,y,z) INIT_WORK(x,y,z)
-#endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 	#define container_of_work_rsl(x,y,z) container_of(x,y,z)
 	#define container_of_dwork_rsl(x,y,z) container_of(container_of(x, struct delayed_work, work), y, z)
-#else
-	#define container_of_work_rsl(x,y,z) (x)
-	#define container_of_dwork_rsl(x,y,z) (x)
-#endif
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-static inline char *
-iwe_stream_add_event_rsl(struct iw_request_info *info,
-			char *     stream,         /* Stream of events */
-			char *     ends,           /* End of stream */
-			struct iw_event *iwe,      /* Payload */
-			int        event_len)      /* Real size of payload */
-{
-        /* Check if it's possible */
-        if ((stream + event_len) < ends) {
-                iwe->len = event_len;
-		ndelay(1);
-                memcpy(stream, (char *) iwe, event_len);
-                stream += event_len;
-        }
-        return stream;
-}
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
 	#define iwe_stream_add_event_rsl(info,start,stop,iwe,len) iwe_stream_add_event(info,start,stop,iwe,len)
-#else
-	#define iwe_stream_add_event_rsl(info,start,stop,iwe,len) iwe_stream_add_event(start,stop,iwe,len)
-#endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
 	#define iwe_stream_add_point_rsl(info,start,stop,iwe,p) iwe_stream_add_point(info,start,stop,iwe,p)
-#else
-	#define iwe_stream_add_point_rsl(info,start,stop,iwe,p) iwe_stream_add_point(start,stop,iwe,p)
-#endif
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	#define usb_alloc_urb_rsl(x,y) usb_alloc_urb(x,y)
 	#define usb_submit_urb_rsl(x,y) usb_submit_urb(x,y)
-#else
-	#define usb_alloc_urb_rsl(x,y) usb_alloc_urb(x)
-	#define usb_submit_urb_rsl(x,y) usb_submit_urb(x)
-#endif
 
 static inline void *netdev_priv_rsl(struct net_device *dev)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	return netdev_priv(dev);
-#else
-	return dev->priv;
-#endif
 }
 
 #define KEY_TYPE_NA		0x0
@@ -645,34 +536,8 @@ typedef struct ieee_param {
 #define IW_QUAL_NOISE_UPDATED  0x4
 #endif
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
-#define MSECS(t)	(HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
-static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
-{
-         unsigned long timeout = MSECS(msecs) + 1;
-
-         while (timeout) {
-                 set_current_state(TASK_INTERRUPTIBLE);
-                 timeout = schedule_timeout(timeout);
-         }
-         return timeout;
-}
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
-static inline void msleep(unsigned int msecs)
-{
-         unsigned long timeout = MSECS(msecs) + 1;
-
-         while (timeout) {
-                 set_current_state(TASK_UNINTERRUPTIBLE);
-                 timeout = schedule_timeout(timeout);
-         }
-}
-#endif
-#else
 #define MSECS(t) msecs_to_jiffies(t)
 #define msleep_interruptible_rsl  msleep_interruptible
-#endif
 
 #define RTLLIB_DATA_LEN		2304
 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -1572,11 +1437,7 @@ typedef union _frameqos {
  * main rates information element... */
 #define MAX_RATES_LENGTH                  ((u8)12)
 #define MAX_RATES_EX_LENGTH               ((u8)16)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define MAX_NETWORK_COUNT                  16
-#else
 #define MAX_NETWORK_COUNT                  96
-#endif
 
 #define MAX_CHANNEL_NUMBER                 161
 #define RTLLIB_SOFTMAC_SCAN_TIME	   100
@@ -1980,21 +1841,6 @@ enum rtllib_state {
 #define RTLLIB_52GHZ_MAX_CHANNEL 165
 #define RTLLIB_52GHZ_CHANNELS (RTLLIB_52GHZ_MAX_CHANNEL - \
                                   RTLLIB_52GHZ_MIN_CHANNEL + 1)
-
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
-{
-        return ((addr[0] != 0xff) && (0x01 & addr[0]));
-}
-#endif
-
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
-{
-	return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&   \
-		(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
-}
-#endif
 #ifndef eqMacAddr
 #define eqMacAddr(a,b)		( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 )
 #endif
@@ -3080,17 +2926,6 @@ static inline int rtllib_is_cck_rate(u8 rate)
 }
 
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
-static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
-{
-	const u16 *a = (const u16 *) addr1;
-	const u16 *b = (const u16 *) addr2;
-
-	BUILD_BUG_ON(ETH_ALEN != 6);
-	return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
-}
-#endif
-
 /* rtllib.c */
 extern void free_rtllib(struct net_device *dev);
 extern struct net_device *alloc_rtllib(int sizeof_priv);
diff --git a/drivers/staging/rtl8192e/rtllib_crypt.h b/drivers/staging/rtl8192e/rtllib_crypt.h
index 5f8990c..5772252 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt.h
+++ b/drivers/staging/rtl8192e/rtllib_crypt.h
@@ -82,12 +82,4 @@ void rtllib_crypt_deinit_entries(struct rtllib_device *, int);
 void rtllib_crypt_deinit_handler(unsigned long);
 void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee,
 				    struct rtllib_crypt_data **crypt);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
-#endif
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
-#define crypto_alloc_tfm crypto_alloc_tfm_rsl
-#define crypto_free_tfm crypto_free_tfm_rsl
-#endif
-
 #endif
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
index 80b56b4..ef17c99 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
@@ -22,17 +22,9 @@
 #include <linux/wireless.h>
 #include "rtllib.h"
 
-#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include "rtl_crypto.h"
-#else
 #include <linux/crypto.h>
-#endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-    #include <asm/scatterlist.h>
-#else
-    #include <linux/scatterlist.h>
-#endif
+#include <linux/scatterlist.h>
 
 #define AES_BLOCK_LEN 16
 #define CCMP_HDR_LEN 8
@@ -64,27 +56,7 @@ struct rtllib_ccmp_data {
 void rtllib_ccmp_aes_encrypt(struct crypto_tfm *tfm,
 			     const u8 pt[16], u8 ct[16])
 {
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	struct scatterlist src, dst;
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-	src.page = virt_to_page(pt);
-	src.offset = offset_in_page(pt);
-	src.length = AES_BLOCK_LEN;
-
-	dst.page = virt_to_page(ct);
-	dst.offset = offset_in_page(ct);
-	dst.length = AES_BLOCK_LEN;
-
-#else
-	sg_init_one(&src, pt, AES_BLOCK_LEN);
-	sg_init_one(&dst, ct, AES_BLOCK_LEN);
-#endif
-
-	crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
-#else
 	crypto_cipher_encrypt_one((void*)tfm, ct, pt);
-#endif
 }
 
 static void * rtllib_ccmp_init(int key_idx)
@@ -97,32 +69,19 @@ static void * rtllib_ccmp_init(int key_idx)
 	memset(priv, 0, sizeof(*priv));
 	priv->key_idx = key_idx;
 
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	priv->tfm = crypto_alloc_tfm("aes", 0);
-	if (priv->tfm == NULL) {
-		printk(KERN_DEBUG "rtllib_crypt_ccmp: could not allocate "
-		       "crypto API aes\n");
-		goto fail;
-	}
-       #else
-       priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+	priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(priv->tfm)) {
 		printk(KERN_DEBUG "rtllib_crypt_ccmp: could not allocate "
 		       "crypto API aes\n");
 		priv->tfm = NULL;
 		goto fail;
 	}
-	#endif
 	return priv;
 
 fail:
 	if (priv) {
 		if (priv->tfm)
-			#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
-			crypto_free_tfm(priv->tfm);
-                    #else
 			crypto_free_cipher((void*)priv->tfm);
-		      #endif
 		kfree(priv);
 	}
 
@@ -134,11 +93,7 @@ static void rtllib_ccmp_deinit(void *priv)
 {
 	struct rtllib_ccmp_data *_priv = priv;
 	if (_priv && _priv->tfm)
-#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
-		crypto_free_tfm(_priv->tfm);
-#else
 		crypto_free_cipher((void*)_priv->tfm);
-#endif
 	kfree(priv);
 }
 
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
index ad9a62f..366c943 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
@@ -22,16 +22,8 @@
 #include "rtllib.h"
 
 
-#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include "rtl_crypto.h"
-#else
 #include <linux/crypto.h>
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-    #include <asm/scatterlist.h>
-#else
-        #include <linux/scatterlist.h>
-#endif
+#include <linux/scatterlist.h>
 
 #include <linux/crc32.h>
 
@@ -58,17 +50,10 @@ struct rtllib_tkip_data {
 	u32 dot11RSNAStatsTKIPLocalMICFailures;
 
 	int key_idx;
-#if  ( !defined(BUILT_IN_CRYPTO) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) )
 	struct crypto_blkcipher *rx_tfm_arc4;
 	struct crypto_hash *rx_tfm_michael;
 	struct crypto_blkcipher *tx_tfm_arc4;
 	struct crypto_hash *tx_tfm_michael;
-#else
-	struct crypto_tfm *tx_tfm_arc4;
-	struct crypto_tfm *tx_tfm_michael;
-	struct crypto_tfm *rx_tfm_arc4;
-	struct crypto_tfm *rx_tfm_michael;
-#endif
 	/* scratch buffers for virt_to_page() (crypto API) */
 	u8 rx_hdr[16], tx_hdr[16];
 };
@@ -82,35 +67,6 @@ static void * rtllib_tkip_init(int key_idx)
 		goto fail;
 	memset(priv, 0, sizeof(*priv));
 	priv->key_idx = key_idx;
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0);
-	if (priv->tx_tfm_arc4 == NULL) {
-		printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate "
-				"crypto API arc4\n");
-		goto fail;
-	}
-
-	priv->tx_tfm_michael = crypto_alloc_tfm("michael_mic", 0);
-	if (priv->tx_tfm_michael == NULL) {
-		printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate "
-				"crypto API michael_mic\n");
-		goto fail;
-	}
-
-	priv->rx_tfm_arc4 = crypto_alloc_tfm("arc4", 0);
-	if (priv->rx_tfm_arc4 == NULL) {
-		printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate "
-				"crypto API arc4\n");
-		goto fail;
-	}
-
-	priv->rx_tfm_michael = crypto_alloc_tfm("michael_mic", 0);
-	if (priv->rx_tfm_michael == NULL) {
-		printk(KERN_DEBUG "rtllib_crypt_tkip: could not allocate "
-				"crypto API michael_mic\n");
-		goto fail;
-	}
-#else
 	priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
 			CRYPTO_ALG_ASYNC);
 	if (IS_ERR(priv->tx_tfm_arc4)) {
@@ -146,22 +102,10 @@ static void * rtllib_tkip_init(int key_idx)
 		priv->rx_tfm_michael = NULL;
 		goto fail;
 	}
-#endif
 	return priv;
 
 fail:
 	if (priv) {
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-		if (priv->tx_tfm_michael)
-			crypto_free_tfm(priv->tx_tfm_michael);
-		if (priv->tx_tfm_arc4)
-			crypto_free_tfm(priv->tx_tfm_arc4);
-		if (priv->rx_tfm_michael)
-			crypto_free_tfm(priv->rx_tfm_michael);
-		if (priv->rx_tfm_arc4)
-			crypto_free_tfm(priv->rx_tfm_arc4);
-
-#else
 		if (priv->tx_tfm_michael)
 			crypto_free_hash(priv->tx_tfm_michael);
 		if (priv->tx_tfm_arc4)
@@ -170,7 +114,6 @@ fail:
 			crypto_free_hash(priv->rx_tfm_michael);
 		if (priv->rx_tfm_arc4)
 			crypto_free_blkcipher(priv->rx_tfm_arc4);
-#endif
 		kfree(priv);
 	}
 
@@ -181,16 +124,7 @@ fail:
 static void rtllib_tkip_deinit(void *priv)
 {
 	struct rtllib_tkip_data *_priv = priv;
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	if (_priv->tx_tfm_michael)
-		crypto_free_tfm(_priv->tx_tfm_michael);
-	if (_priv->tx_tfm_arc4)
-		crypto_free_tfm(_priv->tx_tfm_arc4);
-	if (_priv->rx_tfm_michael)
-		crypto_free_tfm(_priv->rx_tfm_michael);
-	if (_priv->rx_tfm_arc4)
-		crypto_free_tfm(_priv->rx_tfm_arc4);
-#else
+
 	if (_priv) {
 		if (_priv->tx_tfm_michael)
 			crypto_free_hash(_priv->tx_tfm_michael);
@@ -201,7 +135,6 @@ static void rtllib_tkip_deinit(void *priv)
 		if (_priv->rx_tfm_arc4)
 			crypto_free_blkcipher(_priv->rx_tfm_arc4);
 	}
-#endif
 	kfree(priv);
 }
 
@@ -371,11 +304,8 @@ static int rtllib_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	u8 *pos;
 	struct rtllib_hdr_4addr *hdr;
 	cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
-
-	#if ( !defined(BUILT_IN_CRYPTO) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) )
 	struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4};
 	int ret = 0;
-	#endif
 	u8 rc4key[16],  *icv;
 	u32 crc;
 	struct scatterlist sg;
@@ -426,23 +356,11 @@ static int rtllib_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 		icv[2] = crc >> 16;
 		icv[3] = crc >> 24;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-		sg.page = virt_to_page(pos);
-		sg.offset = offset_in_page(pos);
-		sg.length = len + 4;
-#else
 		sg_init_one(&sg, pos, len+4);
-#endif
 
 
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-		crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
-		crypto_cipher_encrypt(tkey->tx_tfm_arc4, &sg, &sg, len + 4);
-#else
 		crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
 		ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
-#endif
-
 	}
 
 	tkey->tx_iv16++;
@@ -452,11 +370,7 @@ static int rtllib_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	}
 
 	if (!tcb_desc->bHwSec)
-	#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-		return 0;
-	#else
 		return ret;
-	#endif
 	else
 		return 0;
 
@@ -471,9 +385,7 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	u16 iv16;
 	struct rtllib_hdr_4addr *hdr;
 	cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
-	#if ( !defined(BUILT_IN_CRYPTO) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) )
 	struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4};
-	#endif
 	u8 rc4key[16];
 	u8 icv[4];
 	u32 crc;
@@ -533,18 +445,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 
 		plen = skb->len - hdr_len - 12;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-		sg.page = virt_to_page(pos);
-		sg.offset = offset_in_page(pos);
-		sg.length = plen + 4;
-#else
 		sg_init_one(&sg, pos, plen+4);
-#endif
 
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-		crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
-		crypto_cipher_decrypt(tkey->rx_tfm_arc4, &sg, &sg, plen + 4);
-#else
 		crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
 		if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) {
 			if (net_ratelimit()) {
@@ -554,13 +456,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 			}
 			return -7;
 		}
-#endif
 
-	#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 		crc = ~crc32_le(~0, pos, plen);
-	#else
-		crc = ~ether_crc_le(plen, pos);
-	#endif
 		icv[0] = crc;
 		icv[1] = crc >> 8;
 		icv[2] = crc >> 16;
@@ -607,51 +504,6 @@ if ( ((u16*)skb->data)[0] & 0x4000){
 }
 
 
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-static int michael_mic(struct crypto_tfm * tfm_michael, u8 *key, u8 *hdr,
-		       u8 *data, size_t data_len, u8 *mic)
-{
-	struct scatterlist sg[2];
-#if ( !defined(BUILT_IN_CRYPTO) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) )
-        struct hash_desc desc;
-        int ret = 0;
-#endif
-
-	if (tfm_michael == NULL){
-		printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
-		return -1;
-	}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
-	sg[0].page = virt_to_page(hdr);
-	sg[0].offset = offset_in_page(hdr);
-	sg[0].length = 16;
-
-	sg[1].page = virt_to_page(data);
-	sg[1].offset = offset_in_page(data);
-	sg[1].length = data_len;
-#else
-	sg_init_table(sg, 2);
-	sg_set_buf(&sg[0], hdr, 16);
-	sg_set_buf(&sg[1], data, data_len);
-#endif
-
-#if ( defined(BUILT_IN_CRYPTO) || LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) )
-	crypto_digest_init(tfm_michael);
-        crypto_digest_setkey(tfm_michael, key, 8);
-        crypto_digest_update(tfm_michael, sg, 2);
-        crypto_digest_final(tfm_michael, mic);
-        return 0;
-#else
-if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
-                return -1;
-
-              desc.tfm = tkey->tfm_michael;
-              desc.flags = 0;
-              ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
-              return ret;
-#endif
-}
-#else
 static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
                        u8 * data, size_t data_len, u8 * mic)
 {
@@ -662,19 +514,9 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
                 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
                 return -1;
         }
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
-        sg[0].page = virt_to_page(hdr);
-        sg[0].offset = offset_in_page(hdr);
-        sg[0].length = 16;
-
-        sg[1].page = virt_to_page(data);
-        sg[1].offset = offset_in_page(data);
-        sg[1].length = data_len;
-#else
         sg_init_table(sg, 2);
         sg_set_buf(&sg[0], hdr, 16);
         sg_set_buf(&sg[1], data, data_len);
-#endif
 
         if (crypto_hash_setkey(tfm_michael, key, 8))
                 return -1;
@@ -683,9 +525,6 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
         desc.flags = 0;
         return crypto_hash_digest(&desc, sg, data_len + 16, mic);
 }
-#endif
-
-
 
 static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
 {
@@ -739,13 +578,8 @@ static int rtllib_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
 		tkey->tx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07;
 	}
 	pos = skb_put(skb, 8);
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
 	if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
 				skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
-#else
-	if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
-				skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
-#endif
 		return -1;
 
 	return 0;
@@ -814,13 +648,8 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
 		tkey->rx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07;
 	}
 
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
-				skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
-#else
 	if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
 				skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
-#endif
 		return -1;
 
 	if ((memcmp(mic, skb->data + skb->len - 8, 8) != 0)||(ieee->force_mic_error)) {
@@ -856,32 +685,18 @@ static int rtllib_tkip_set_key(void *key, int len, u8 *seq, void *priv)
 {
 	struct rtllib_tkip_data *tkey = priv;
 	int keyidx;
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	struct crypto_tfm *tfm = tkey->tx_tfm_michael;
-	struct crypto_tfm *tfm2 = tkey->tx_tfm_arc4;
-	struct crypto_tfm *tfm3 = tkey->rx_tfm_michael;
-	struct crypto_tfm *tfm4 = tkey->rx_tfm_arc4;
-#else
 	struct crypto_hash *tfm = tkey->tx_tfm_michael;
 	struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
 	struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
 	struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
-#endif
 
 	keyidx = tkey->key_idx;
 	memset(tkey, 0, sizeof(*tkey));
 	tkey->key_idx = keyidx;
-#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	tkey->tx_tfm_michael = tfm;
-	tkey->tx_tfm_arc4 = tfm2;
-	tkey->rx_tfm_michael = tfm3;
-	tkey->rx_tfm_arc4 = tfm4;
-#else
 	tkey->tx_tfm_michael = tfm;
 	tkey->tx_tfm_arc4 = tfm2;
 	tkey->rx_tfm_michael = tfm3;
 	tkey->rx_tfm_arc4 = tfm4;
-#endif
 
 	if (len == TKIP_KEY_LEN) {
 		memcpy(tkey->key, key, TKIP_KEY_LEN);
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
index 3867922..201e2ec 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
@@ -18,44 +18,19 @@
 #include <asm/string.h>
 #include "rtllib.h"
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
-#endif
-
-
-#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include "rtl_crypto.h"
-#else
 #include <linux/crypto.h>
-#endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-    #include <asm/scatterlist.h>
-#else
-    #include <linux/scatterlist.h>
-#endif
+#include <linux/scatterlist.h>
 #include <linux/crc32.h>
-/*
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include "rtl_crypto.h"
-#else
-#include <linux/crypto.h>
-#endif
 
-#include <asm/scatterlist.h>
-#include <linux/crc32.h>
-*/
 struct prism2_wep_data {
 	u32 iv;
 #define WEP_KEY_LEN 13
 	u8 key[WEP_KEY_LEN + 1];
 	u8 key_len;
 	u8 key_idx;
-	#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	struct crypto_tfm *tfm;
-	#else
         struct crypto_blkcipher *tx_tfm;
         struct crypto_blkcipher *rx_tfm;
-        #endif
 };
 
 
@@ -69,14 +44,6 @@ static void * prism2_wep_init(int keyidx)
 	memset(priv, 0, sizeof(*priv));
 	priv->key_idx = keyidx;
 
-	#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	priv->tfm = crypto_alloc_tfm("arc4", 0);
-	if (priv->tfm == NULL) {
-		printk(KERN_DEBUG "rtllib_crypt_wep: could not allocate "
-		       "crypto API arc4\n");
-		goto fail;
-	}
-	#else
 	priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
         if (IS_ERR(priv->tx_tfm)) {
                 printk(KERN_DEBUG "rtllib_crypt_wep: could not allocate "
@@ -91,7 +58,6 @@ static void * prism2_wep_init(int keyidx)
                 priv->rx_tfm = NULL;
                 goto fail;
         }
-        #endif
 
 	/* start WEP IV from a random value */
 	get_random_bytes(&priv->iv, 4);
@@ -99,13 +65,6 @@ static void * prism2_wep_init(int keyidx)
 	return priv;
 
 fail:
-	#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	if (priv) {
-		if (priv->tfm)
-			crypto_free_tfm(priv->tfm);
-		kfree(priv);
-	}
-	#else
 	if (priv) {
                 if (priv->tx_tfm)
                         crypto_free_blkcipher(priv->tx_tfm);
@@ -113,7 +72,6 @@ fail:
                         crypto_free_blkcipher(priv->rx_tfm);
                 kfree(priv);
         }
-        #endif
 	return NULL;
 }
 
@@ -121,17 +79,13 @@ fail:
 static void prism2_wep_deinit(void *priv)
 {
 	struct prism2_wep_data *_priv = priv;
-	#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-	if (_priv && _priv->tfm)
-		crypto_free_tfm(_priv->tfm);
-	#else
+
 	if (_priv) {
                 if (_priv->tx_tfm)
                         crypto_free_blkcipher(_priv->tx_tfm);
                 if (_priv->rx_tfm)
                         crypto_free_blkcipher(_priv->rx_tfm);
         }
-        #endif
 	kfree(priv);
 }
 
@@ -148,9 +102,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	u8 key[WEP_KEY_LEN + 3];
 	u8 *pos;
 	cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
-	#if ( !defined(BUILT_IN_CRYPTO) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) )
 	struct blkcipher_desc desc = {.tfm = wep->tx_tfm};
-	#endif
 	u32 crc;
 	u8 *icv;
 	struct scatterlist sg;
@@ -186,36 +138,19 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	/* Copy rest of the WEP key (the secret part) */
 	memcpy(key + 3, wep->key, wep->key_len);
 
-	if (!tcb_desc->bHwSec)
-	{
+	if (!tcb_desc->bHwSec) {
 
 		/* Append little-endian CRC32 and encrypt it to produce ICV */
-	#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 		crc = ~crc32_le(~0, pos, len);
-	#else
-		crc = ~ether_crc_le(len, pos);
-	#endif
 		icv = skb_put(skb, 4);
 		icv[0] = crc;
 		icv[1] = crc >> 8;
 		icv[2] = crc >> 16;
 		icv[3] = crc >> 24;
 
-	#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-		sg.page = virt_to_page(pos);
-		sg.offset = offset_in_page(pos);
-		sg.length = len + 4;
-	#else
 		sg_init_one(&sg, pos, len+4);
-	#endif
-	#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-		crypto_cipher_setkey(wep->tfm, key, klen);
-		crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
-		return 0;
-	#else
 		crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
 		return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
-	#endif
 	}
 
 	return 0;
@@ -236,9 +171,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	u8 key[WEP_KEY_LEN + 3];
 	u8 keyidx, *pos;
 	cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
-	#if ( !defined(BUILT_IN_CRYPTO) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) )
 	struct blkcipher_desc desc = {.tfm = wep->rx_tfm};
-	#endif
 	u32 crc;
 	u8 icv[4];
 	struct scatterlist sg;
@@ -261,28 +194,12 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	/* Apply RC4 to data and compute CRC32 over decrypted data */
 	plen = skb->len - hdr_len - 8;
 
-	if (!tcb_desc->bHwSec)
-	{
-	#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-		sg.page = virt_to_page(pos);
-		sg.offset = offset_in_page(pos);
-		sg.length = plen + 4;
-	#else
+	if (!tcb_desc->bHwSec) {
 		sg_init_one(&sg, pos, plen+4);
-	#endif
-	#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
-		crypto_cipher_setkey(wep->tfm, key, klen);
-		crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
-	#else
 		crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
 		if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
 			return -7;
-	#endif
-	#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 		crc = ~crc32_le(~0, pos, plen);
-	#else
-		crc = ~ether_crc_le(plen, pos);
-	#endif
 		icv[0] = crc;
 		icv[1] = crc >> 8;
 		icv[2] = crc >> 16;
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 2a7133c..7f03381 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -47,10 +47,6 @@
 #include "dot11d.h"
 #endif
 
-#if defined(RTLLIB_RADIOTAP) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
-#include <net/ieee80211_radiotap.h>
-#endif
-
 #if defined CONFIG_CFG_80211
 #include <linux/crc32.h>
 
@@ -321,140 +317,17 @@ void ieee80211_scan_rx(struct rtllib_device *ieee, struct sk_buff *skb, struct r
 }
 #endif
 
-
-#if defined(RTLLIB_RADIOTAP) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
-static int rtllib_rx_radiotap_len(struct rtllib_device *ieee, struct rtllib_rx_stats *rx_status)
-{
-	int len;
-
-	/* always present fields */
-	len = sizeof(struct ieee80211_radiotap_header) +
-		8 + /* TSFT */
-		1 + /* FLAGS */
-		1 + /* RATE */
-		2 + /* CHANNEL IN MHZ */
-		2 + /* CHANNEL BITFIELD */
-		1 + /* HW SIGNAL DBM */
-		1 + /* HW NOISE DBM */
-		1;  /* ANTENNA NUMBER */
-
-
-	if (len & 1) /* padding for RX_FLAGS if necessary */
-		len++;
-
-	/* make sure radiotap starts at a naturally aligned address */
-	if (len % 8)
-		len = roundup(len, 8);
-
-	return len;
-}
-
-static void rtllib_add_rx_radiotap_header(struct rtllib_device *ieee,
-		struct sk_buff *skb, int rtap_len, struct rtllib_rx_stats *rx_status)
-{
-	struct ieee80211_radiotap_header *rthdr;
-	unsigned char *pos;
-	printk("add header!\n");
-	rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len);
-	memset(rthdr, 0, rtap_len);
-
-	rthdr->it_version = PKTHDR_RADIOTAP_VERSION;
-	rthdr->it_pad = 0;
-	rthdr->it_len = cpu_to_le16(rtap_len);
-	/* radiotap header, set always present flags */
-	rthdr->it_present = cpu_to_le32(
-		(1 << IEEE80211_RADIOTAP_TSFT) |
-		(1 << IEEE80211_RADIOTAP_FLAGS) |
-		(1 << IEEE80211_RADIOTAP_RATE) |
-		(1 << IEEE80211_RADIOTAP_CHANNEL) |
-		(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
-		(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |
-		(1 << IEEE80211_RADIOTAP_ANTENNA));
-
-	pos = (unsigned char *)(rthdr+1);
-	/* the order of the following fields is important */
-	/* IEEE80211_RADIOTAP_TSFT */
-	*(__le64 *)pos = cpu_to_le64(rx_status->TimeStampLow);
-	pos += 8;
-
-	/* IEEE80211_RADIOTAP_FLAGS */
-	if (rx_status->bCRC)
-		*pos |= IEEE80211_RADIOTAP_F_BADFCS;
-	if (rx_status->bShortPreamble)
-		*pos |= IEEE80211_RADIOTAP_F_SHORTPRE;
-	pos++;
-
-	/* IEEE80211_RADIOTAP_RATE */
-	*pos = rx_status->rate / 5;
-	pos++;
-
-	/* IEEE80211_RADIOTAP_CHANNEL */
-	*(__le16 *)pos = cpu_to_le16(rx_status->received_channel);
-	pos += 2;
-	pos += 2;
-
-
-	/* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
-	*pos = rx_status->RxPower;
-	pos++;
-
-	/* IEEE80211_RADIOTAP_DBM_ANTNOISE */
-	*pos = rx_status->noise;
-	pos++;
-
-	/* IEEE80211_RADIOTAP_ANTENNA */
-	*pos = rx_status->Antenna;
-	pos++;
-
-	/* IEEE80211_RADIOTAP_DB_ANTNOISE is not used */
-
-	/* IEEE80211_RADIOTAP_RX_FLAGS */
-	/* ensure 2 byte alignment for the 2 byte field as required */
-}
-#endif
-
 static inline void rtllib_monitor_rx(struct rtllib_device *ieee,
 				struct sk_buff *skb,struct rtllib_rx_stats *rx_status,
 				size_t hdr_length)
 {
-
-#if defined(RTLLIB_RADIOTAP) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
-	int needed_headroom = 0;
-	struct sk_buff *radiotap_skb;
-
-	needed_headroom = rtllib_rx_radiotap_len(ieee, rx_status);
-	printk("needed_headroom = %d\n", needed_headroom);
-	radiotap_skb = skb_copy_expand(skb, needed_headroom, 0, GFP_ATOMIC);
-	dev_kfree_skb(skb);
-	if (!radiotap_skb) {
-		return;
-	}
-
-	rtllib_add_rx_radiotap_header(ieee, radiotap_skb, needed_headroom, rx_status);
-	radiotap_skb->dev = ieee->dev;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
-        skb_reset_mac_header(radiotap_skb);
-#else
-        radiotap_skb->mac.raw = radiotap_skb->data;
-#endif
-	radiotap_skb->ip_summed = CHECKSUM_UNNECESSARY;
-	radiotap_skb->pkt_type = PACKET_OTHERHOST;
-	radiotap_skb->protocol = htons(ETH_P_802_2);
-	memset(radiotap_skb->cb, 0, sizeof(radiotap_skb->cb));
-	netif_rx(radiotap_skb);
-#else
 	skb->dev = ieee->dev;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
         skb_reset_mac_header(skb);
-#else
-        skb->mac.raw = skb->data;
-#endif
 	skb_pull(skb, hdr_length);
 	skb->pkt_type = PACKET_OTHERHOST;
 	skb->protocol = __constant_htons(ETH_P_80211_RAW);
 	memset(skb->cb, 0, sizeof(skb->cb));
 	netif_rx(skb);
-#endif
 }
 
 /* Called only as a tasklet (software IRQ) */
@@ -3252,12 +3125,10 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 			{
 				RTLLIB_DEBUG_MGMT("MFIE_TYPE_WZC: %d bytes\n",
 						     info_element->len);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 				network->wzc_ie_len = min(info_element->len+2,
 							  MAX_WZC_IE_LEN);
 				memcpy(network->wzc_ie, info_element,
 						network->wzc_ie_len);
-#endif
 			}
 			break;
 
@@ -3489,9 +3360,7 @@ static inline int rtllib_network_init(
 
 	network->wpa_ie_len = 0;
 	network->rsn_ie_len = 0;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	network->wzc_ie_len = 0;
-#endif
 
         if (rtllib_parse_info_param(ieee,
 			beacon->info_element,
@@ -3624,10 +3493,8 @@ static inline void update_network(struct rtllib_network *dst,
 	dst->wpa_ie_len = src->wpa_ie_len;
 	memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
 	dst->rsn_ie_len = src->rsn_ie_len;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	memcpy(dst->wzc_ie, src->wzc_ie, src->wzc_ie_len);
 	dst->wzc_ie_len = src->wzc_ie_len;
-#endif
 
 	dst->last_scanned = jiffies;
 	/* qos related parameters */
@@ -3945,16 +3812,10 @@ static inline void rtllib_process_probe_response(
 #endif
 	unsigned long flags;
 	short renew;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
 	struct rtllib_network *network = kzalloc(sizeof(struct rtllib_network), GFP_ATOMIC);
-#else
-	struct rtllib_network *network = kmalloc(sizeof(*network), GFP_ATOMIC);
-	memset(network,0,sizeof(*network));
-#endif
 
-	if (!network) {
+	if (!network)
 		return;
-	}
 
 	RTLLIB_DEBUG_SCAN(
 		"'%s' (" MAC_FMT "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index a843de9..3ac740a 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -754,21 +754,13 @@ void rtllib_start_send_beacons(struct rtllib_device *ieee)
 
 void rtllib_softmac_stop_scan(struct rtllib_device *ieee)
 {
-
-
 	down(&ieee->scan_sem);
 	ieee->scan_watch_dog = 0;
-	if (ieee->scanning_continue == 1){
+	if (ieee->scanning_continue == 1) {
 		ieee->scanning_continue = 0;
 		ieee->actscanning = 0;
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,40)
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,67)
 		cancel_delayed_work(&ieee->softmac_scan_wq);
-#endif
-#else
-		del_timer_sync(&ieee->scan_timer);
-#endif
 	}
 
 	up(&ieee->scan_sem);
@@ -837,18 +829,6 @@ void rtllib_start_scan(struct rtllib_device *ieee)
 
 }
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
-void rtllib_softmac_scan_cb(unsigned long _dev)
-{
-	unsigned long flags;
-	struct rtllib_device *ieee = (struct rtllib_device *)_dev;
-
-	spin_lock_irqsave(&ieee->lock, flags);
-	rtllib_start_scan(ieee);
-	spin_unlock_irqrestore(&ieee->lock, flags);
-}
-#endif
-
 /* called with wx_sem held */
 void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh)
 {
@@ -2903,28 +2883,16 @@ void rtllib_stop_queue(struct rtllib_device *ieee)
 
 void rtllib_stop_all_queues(struct rtllib_device *ieee)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)
 	unsigned int i;
 	for (i=0; i < ieee->dev->num_tx_queues; i++)
                 netdev_get_tx_queue(ieee->dev,i)->trans_start = jiffies;
-#else
-	ieee->dev->trans_start = jiffies;
-#endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
-	netif_carrier_off(ieee->dev);
-#else
 	netif_tx_stop_all_queues(ieee->dev);
-#endif
 }
 
 void rtllib_wake_all_queues(struct rtllib_device *ieee)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
-	netif_carrier_on(ieee->dev);
-#else
 	netif_tx_wake_all_queues(ieee->dev);
-#endif
 }
 
 inline void rtllib_randomize_cell(struct rtllib_device *ieee)
@@ -3436,11 +3404,6 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
 	ieee->sta_edca_param[3] = 0x002F3262;
 	ieee->aggregation = true;
 	ieee->enable_rx_imm_BA = 1;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
-	_setup_timer(&ieee->scan_timer,
-		    rtllib_softmac_scan_cb,
-		    (unsigned long) ieee);
-#endif
 	ieee->tx_pending.txb = NULL;
 
 	_setup_timer(&ieee->associate_timer,
@@ -3451,19 +3414,12 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
 		    rtllib_send_beacon_cb,
 		    (unsigned long) ieee);
 
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
-	_setup_timer(&ieee->ibss_wait_timer,
-		    rtllib_ibss_wait_timeout,
-		    (unsigned long) ieee);
-#endif
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 #ifdef PF_SYNCTHREAD
 	ieee->wq = create_workqueue(DRV_NAME,0);
 #else
 	ieee->wq = create_workqueue(DRV_NAME);
 #endif
-#endif
 
 	INIT_DELAYED_WORK_RSL(&ieee->link_change_wq,(void*)rtllib_link_change_wq,ieee);
 	INIT_DELAYED_WORK_RSL(&ieee->start_ibss_wq,(void*)rtllib_start_ibss_wq,ieee);
@@ -3499,11 +3455,8 @@ void rtllib_softmac_free(struct rtllib_device *ieee)
 #endif
 	del_timer_sync(&ieee->associate_timer);
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	cancel_delayed_work(&ieee->associate_retry_wq);
 	destroy_workqueue(ieee->wq);
-#endif
-
 	up(&ieee->wx_sem);
 }
 
diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
index 7cda290..863b285 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
@@ -311,13 +311,8 @@ int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a,
 		goto out;
 
 	if (wrqu->mode == IW_MODE_MONITOR) {
-#if defined(RTLLIB_RADIOTAP) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
-		ieee->dev->type = ARPHRD_IEEE80211_RADIOTAP;
-#else
 		ieee->dev->type = ARPHRD_IEEE80211;
-#endif
 		rtllib_EnableNetMonitorMode(ieee->dev,false);
-
 	} else {
 		ieee->dev->type = ARPHRD_ETHER;
 		if (ieee->iw_mode == IW_MODE_MONITOR)
@@ -461,11 +456,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee,
 
 	proto_started = ieee->proto_started;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
-	len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-#else
 	len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length : IW_ESSID_MAX_SIZE;
-#endif
 
 	if (len > IW_ESSID_MAX_SIZE){
 		ret= -E2BIG;
-- 
1.7.3.4




More information about the devel mailing list