[PATCH 1/4] Staging: rtl8192su: remove kernel version compatibility wrappers

From: Bartlomiej Zolnierkiewicz
Date: Sat Jun 13 2009 - 12:36:29 EST


Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
---
drivers/staging/rtl8192su/ieee80211/dot11d.c | 11
drivers/staging/rtl8192su/ieee80211/ieee80211.h | 120 ----
drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c | 14
drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.h | 7
drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c | 51 -
drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c | 229 -------
drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c | 113 ---
drivers/staging/rtl8192su/ieee80211/ieee80211_module.c | 51 -
drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c | 9
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c | 176 -----
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c | 44 -
drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c | 9
drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c | 118 ---
drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c | 9
drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c | 12
drivers/staging/rtl8192su/r8192S_firmware.c | 18
drivers/staging/rtl8192su/r8192S_phy.c | 14
drivers/staging/rtl8192su/r8192S_phy.h | 5
drivers/staging/rtl8192su/r8192U.h | 40 -
drivers/staging/rtl8192su/r8192U_core.c | 388 -------------
drivers/staging/rtl8192su/r8192U_dm.c | 60 --
drivers/staging/rtl8192su/r8192U_dm.h | 8
drivers/staging/rtl8192su/r8192U_pm.c | 9
drivers/staging/rtl8192su/r8192U_wx.c | 19
drivers/staging/rtl8192su/r819xU_firmware.c | 13
drivers/staging/rtl8192su/r819xU_phy.c | 14
drivers/staging/rtl8192su/r819xU_phy.h | 4
27 files changed, 77 insertions(+), 1488 deletions(-)

Index: b/drivers/staging/rtl8192su/ieee80211/dot11d.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/dot11d.c
+++ b/drivers/staging/rtl8192su/ieee80211/dot11d.c
@@ -218,7 +218,7 @@ int ToLegalChannel(

return default_chn;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+
EXPORT_SYMBOL(Dot11d_Init);
EXPORT_SYMBOL(Dot11d_Reset);
EXPORT_SYMBOL(Dot11d_UpdateCountryIe);
@@ -226,14 +226,5 @@ EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm);
EXPORT_SYMBOL(DOT11D_ScanComplete);
EXPORT_SYMBOL(IsLegalChannel);
EXPORT_SYMBOL(ToLegalChannel);
-#else
-EXPORT_SYMBOL_NOVERS(Dot11d_Init);
-EXPORT_SYMBOL_NOVERS(Dot11d_Reset);
-EXPORT_SYMBOL_NOVERS(Dot11d_UpdateCountryIe);
-EXPORT_SYMBOL_NOVERS(DOT11D_GetMaxTxPwrInDbm);
-EXPORT_SYMBOL_NOVERS(DOT11D_ScanComplete);
-EXPORT_SYMBOL_NOVERS(IsLegalChannel);
-EXPORT_SYMBOL_NOVERS(ToLegalChannel);
-#endif

#endif
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211.h
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211.h
@@ -27,12 +27,7 @@
#include <linux/kernel.h> /* ARRAY_SIZE */
#include <linux/version.h>
#include <linux/module.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>

@@ -43,12 +38,6 @@
#include "rtl819x_BA.h"
#include "rtl819x_TS.h"

-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
-#ifndef bool
-typedef enum{false = 0, true} bool;
-#endif
-#endif
-
#ifndef IW_MODE_MONITOR
#define IW_MODE_MONITOR 6
#endif
@@ -57,25 +46,6 @@ typedef enum{false = 0, true} bool;
#define IWEVCUSTOM 0x8c02
#endif

-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#ifndef __bitwise
-#define __bitwise __attribute__((bitwise))
-#endif
-typedef __u16 __le16;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27))
-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
@@ -456,46 +426,8 @@ typedef struct ieee_param {
#define IW_QUAL_NOISE_UPDATED 0x4
#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;
- //task->next = NULL;
- INIT_LIST_HEAD(&task->list);
- task->sync = 0;
-}
-#endif
-
-// linux under 2.6.9 release may not support it, so modify it for common use
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
-//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
-#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 IEEE80211_DATA_LEN 2304
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -1787,21 +1719,6 @@ enum ieee80211_state {
#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
IEEE80211_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
-
typedef struct tx_pending_t{
int frag;
struct ieee80211_txb *txb;
@@ -1879,11 +1796,7 @@ typedef struct _RT_POWER_SAVE_CONTROL
bool bHaltAdapterClkRQ;
bool bSwRfProcessing;
RT_RF_POWER_STATE eInactivePowerState;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct work_struct InactivePsWorkItem;
-#else
- struct tq_struct InactivePsWorkItem;
-#endif
struct timer_list InactivePsTimer;

// Return point for join action
@@ -2290,41 +2203,17 @@ struct ieee80211_device {

/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct work_struct associate_complete_wq;
struct work_struct associate_procedure_wq;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
struct delayed_work softmac_scan_wq;
struct delayed_work associate_retry_wq;
struct delayed_work start_ibss_wq;
struct delayed_work hw_wakeup_wq;
struct delayed_work hw_sleep_wq;
struct delayed_work link_change_wq;
-#else
- struct work_struct softmac_scan_wq;
- struct work_struct associate_retry_wq;
- struct work_struct start_ibss_wq;
- struct work_struct hw_wakeup_wq;
- struct work_struct hw_sleep_wq;
- struct work_struct link_change_wq;
-#endif
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
-#else
- /* used for periodly scan */
- struct timer_list scan_timer;

- struct tq_struct associate_complete_wq;
- struct tq_struct associate_retry_wq;
- struct tq_struct start_ibss_wq;
- struct tq_struct associate_procedure_wq;
- struct tq_struct softmac_scan_wq;
- struct tq_struct wx_sync_scan_wq;
- struct tq_struct hw_wakeup_wq;
- struct tq_struct hw_sleep_wq;
- struct tq_struct link_change_wq;
-
-#endif
// Qos related. Added by Annie, 2005-11-01.
//STA_QOS StaQos;

@@ -2512,11 +2401,7 @@ struct ieee80211_device {

static inline void *ieee80211_priv(struct net_device *dev)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
-#else
- return ((struct ieee80211_device *)dev->priv)->priv;
-#endif
}

extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
@@ -2769,12 +2654,7 @@ extern int ieee80211_wx_get_freq(struct
union iwreq_data *wrqu, char *b);

//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
-#else
- extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
-#endif
-

extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
struct iw_request_info *info,
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c
@@ -55,11 +55,7 @@ void ieee80211_crypt_deinit_entries(stru

if (entry->ops) {
entry->ops->deinit(entry->priv);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
module_put(entry->ops->owner);
-#else
- __MOD_DEC_USE_COUNT(entry->ops->owner);
-#endif
}
kfree(entry);
}
@@ -251,7 +247,6 @@ static void __exit ieee80211_crypto_dein
kfree(hcrypt);
}

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
@@ -259,15 +254,6 @@ EXPORT_SYMBOL(ieee80211_crypt_delayed_de
EXPORT_SYMBOL(ieee80211_register_crypto_ops);
EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
EXPORT_SYMBOL(ieee80211_get_crypto_ops);
-#else
-EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL_NOVERS(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL_NOVERS(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL_NOVERS(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL_NOVERS(ieee80211_get_crypto_ops);
-#endif

module_init(ieee80211_crypto_init);
module_exit(ieee80211_crypto_deinit);
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.h
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.h
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.h
@@ -82,12 +82,5 @@ void ieee80211_crypt_deinit_entries(stru
void ieee80211_crypt_deinit_handler(unsigned long);
void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
struct ieee80211_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
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c
@@ -24,18 +24,8 @@

#include "ieee80211.h"

-#if (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 <asm/scatterlist.h>
+#include <linux/scatterlist.h>

MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -75,21 +65,7 @@ struct ieee80211_ccmp_data {
void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
- struct scatterlist src, dst;
-
- 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;
-
- crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
-#else
crypto_cipher_encrypt_one((void*)tfm, ct, pt);
-#endif
}

static void * ieee80211_ccmp_init(int key_idx)
@@ -102,32 +78,20 @@ static void * ieee80211_ccmp_init(int ke
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;

-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
- priv->tfm = crypto_alloc_tfm("aes", 0);
- if (priv->tfm == NULL) {
- printk(KERN_DEBUG "ieee80211_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 "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
priv->tfm = NULL;
goto fail;
}
- #endif
+
return priv;

fail:
if (priv) {
if (priv->tfm)
- #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
- crypto_free_tfm(priv->tfm);
- #else
crypto_free_cipher((void*)priv->tfm);
- #endif
kfree(priv);
}

@@ -138,12 +102,9 @@ fail:
static void ieee80211_ccmp_deinit(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
+
if (_priv && _priv->tfm)
-#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
- crypto_free_tfm(_priv->tfm);
-#else
crypto_free_cipher((void*)_priv->tfm);
-#endif
kfree(priv);
}

@@ -524,11 +485,7 @@ static void __exit ieee80211_crypto_ccmp
ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
}

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_ccmp_null);
-#else
-EXPORT_SYMBOL_NOVERS(ieee80211_ccmp_null);
-#endif

module_init(ieee80211_crypto_ccmp_init);
module_exit(ieee80211_crypto_ccmp_exit);
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c
@@ -22,23 +22,9 @@
#include <asm/string.h>

#include "ieee80211.h"
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
-//#include "crypto_compat.h"
-#endif
-

-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-#include "rtl_crypto.h"
-#else
#include <linux/crypto.h>
-#endif
-//#include <asm/scatterlist.h>
-#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>

MODULE_AUTHOR("Jouni Malinen");
@@ -71,17 +57,12 @@ struct ieee80211_tkip_data {
u32 dot11RSNAStatsTKIPLocalMICFailures;

int key_idx;
-#if((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];
};
@@ -95,35 +76,7 @@ static void * ieee80211_tkip_init(int ke
goto fail;
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
-#if((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 "ieee80211_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 "ieee80211_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 "ieee80211_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 "ieee80211_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)) {
@@ -159,22 +112,11 @@ static void * ieee80211_tkip_init(int ke
priv->rx_tfm_michael = NULL;
goto fail;
}
-#endif
+
return priv;

fail:
if (priv) {
-#if((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)
@@ -183,7 +125,6 @@ fail:
crypto_free_hash(priv->rx_tfm_michael);
if (priv->rx_tfm_arc4)
crypto_free_blkcipher(priv->rx_tfm_arc4);
-#endif
kfree(priv);
}

@@ -194,16 +135,7 @@ fail:
static void ieee80211_tkip_deinit(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
-#if((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);
@@ -214,7 +146,6 @@ static void ieee80211_tkip_deinit(void *
if (_priv->rx_tfm_arc4)
crypto_free_blkcipher(_priv->rx_tfm_arc4);
}
-#endif
kfree(priv);
}

@@ -384,11 +315,8 @@ static int ieee80211_tkip_encrypt(struct
u8 *pos;
struct ieee80211_hdr_4addr *hdr;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
-
- #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
- struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4};
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
int ret = 0;
- #endif
u8 rc4key[16], *icv;
u32 crc;
struct scatterlist sg;
@@ -451,33 +379,14 @@ printk("%x\n", ((u32*)tkey->key)[7]);
if (!tcb_desc->bHwSec)
{
icv = skb_put(skb, 4);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
crc = ~crc32_le(~0, pos, len);
-#else
- crc = ~ether_crc_le(len, pos);
-#endif
icv[0] = crc;
icv[1] = crc >> 8;
icv[2] = crc >> 16;
icv[3] = crc >> 24;
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
- crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
- sg.page = virt_to_page(pos);
- sg.offset = offset_in_page(pos);
- sg.length = len + 4;
- crypto_cipher_encrypt(tkey->tx_tfm_arc4, &sg, &sg, len + 4);
-#else
crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
-#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
+ sg_init_one(&sg, pos, len + 4);
ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
-#endif
-
}

tkey->tx_iv16++;
@@ -487,11 +396,7 @@ printk("%x\n", ((u32*)tkey->key)[7]);
}

if (!tcb_desc->bHwSec)
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
- return 0;
- #else
return ret;
- #endif
else
return 0;

@@ -506,9 +411,7 @@ static int ieee80211_tkip_decrypt(struct
u16 iv16;
struct ieee80211_hdr_4addr *hdr;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
- #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
- struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4};
- #endif
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
u8 rc4key[16];
u8 icv[4];
u32 crc;
@@ -567,21 +470,9 @@ static int ieee80211_tkip_decrypt(struct

plen = skb->len - hdr_len - 12;

-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
- crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
- sg.page = virt_to_page(pos);
- sg.offset = offset_in_page(pos);
- sg.length = plen + 4;
- crypto_cipher_decrypt(tkey->rx_tfm_arc4, &sg, &sg, plen + 4);
-#else
crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
-#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
+ sg_init_one(&sg, pos, plen + 4);
+
if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) {
if (net_ratelimit()) {
printk(KERN_DEBUG ": TKIP: failed to decrypt "
@@ -590,13 +481,8 @@ static int ieee80211_tkip_decrypt(struct
}
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;
@@ -643,48 +529,6 @@ if( ((u16*)skb->data)[0] & 0x4000){
return keyidx;
}

-
-#if((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 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;
- }
- 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;
-
-
-#if 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;
-
-// return 0;
- 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)
{
@@ -695,19 +539,10 @@ static int michael_mic(struct crypto_has
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
+
+ sg_init_table(sg, 2);
+ sg_set_buf(&sg[0], hdr, 16);
+ sg_set_buf(&sg[1], data, data_len);

if (crypto_hash_setkey(tfm_michael, key, 8))
return -1;
@@ -716,9 +551,6 @@ static int michael_mic(struct crypto_has
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)
{
@@ -775,13 +607,9 @@ static int ieee80211_michael_mic_add(str
}
// }
pos = skb_put(skb, 8);
-#if((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
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;

return 0;
@@ -853,13 +681,8 @@ static int ieee80211_michael_mic_verify(
}
// }

-#if((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
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr_4addr *hdr;
@@ -889,32 +712,18 @@ static int ieee80211_tkip_set_key(void *
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
-#if((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((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);
@@ -1024,11 +833,7 @@ void ieee80211_tkip_null(void)
// printk("============>%s()\n", __FUNCTION__);
return;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_tkip_null);
-#else
-EXPORT_SYMBOL_NOVERS(ieee80211_tkip_null);
-#endif

module_init(ieee80211_crypto_tkip_init);
module_exit(ieee80211_crypto_tkip_exit);
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c
@@ -20,35 +20,10 @@

#include "ieee80211.h"

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
-//#include "crypto_compat.h"
-#endif
-
-
-#if (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 <asm/scatterlist.h>
+#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>
-*/
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -62,12 +37,8 @@ struct prism2_wep_data {
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
-#if((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
+ struct crypto_blkcipher *tx_tfm;
+ struct crypto_blkcipher *rx_tfm;
};


@@ -81,14 +52,6 @@ static void * prism2_wep_init(int keyidx
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;

-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
- priv->tfm = crypto_alloc_tfm("arc4", 0);
- if (priv->tfm == NULL) {
- printk(KERN_DEBUG "ieee80211_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 "ieee80211_crypt_wep: could not allocate "
@@ -103,7 +66,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);
@@ -111,13 +73,6 @@ static void * prism2_wep_init(int keyidx
return priv;

fail:
-#if((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);
@@ -125,7 +80,7 @@ fail:
crypto_free_blkcipher(priv->rx_tfm);
kfree(priv);
}
- #endif
+
return NULL;
}

@@ -133,17 +88,13 @@ fail:
static void prism2_wep_deinit(void *priv)
{
struct prism2_wep_data *_priv = priv;
-#if((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);
}

@@ -160,9 +111,7 @@ static int prism2_wep_encrypt(struct sk_
u8 key[WEP_KEY_LEN + 3];
u8 *pos;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
- #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
- struct blkcipher_desc desc = {.tfm = wep->tx_tfm};
- #endif
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
u32 crc;
u8 *icv;
struct scatterlist sg;
@@ -201,35 +150,17 @@ static int prism2_wep_encrypt(struct sk_
{

/* 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,21)) && (!OPENSUSE_SLED))
- crypto_cipher_setkey(wep->tfm, key, klen);
- sg.page = virt_to_page(pos);
- sg.offset = offset_in_page(pos);
- sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
- return 0;
- #else
crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
- #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
+
return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
- #endif
}

return 0;
@@ -250,9 +181,7 @@ static int prism2_wep_decrypt(struct sk_
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
- #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
- struct blkcipher_desc desc = {.tfm = wep->rx_tfm};
- #endif
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
u32 crc;
u8 icv[4];
struct scatterlist sg;
@@ -277,29 +206,13 @@ static int prism2_wep_decrypt(struct sk_

if (!tcb_desc->bHwSec)
{
-#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
- crypto_cipher_setkey(wep->tfm, key, klen);
- sg.page = virt_to_page(pos);
- sg.offset = offset_in_page(pos);
- sg.length = plen + 4;
- crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
- #else
crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
- #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
+ sg_init_one(&sg, pos, plen + 4);
+
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;
@@ -387,11 +300,7 @@ void ieee80211_wep_null(void)
// printk("============>%s()\n", __FUNCTION__);
return;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_wep_null);
-#else
-EXPORT_SYMBOL_NOVERS(ieee80211_wep_null);
-#endif

module_init(ieee80211_crypto_wep_init);
module_exit(ieee80211_crypto_wep_exit);
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
@@ -113,12 +113,7 @@ struct net_device *alloc_ieee80211(int s
goto failed;
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
ieee = netdev_priv(dev);
-#else
- ieee = (struct ieee80211_device *)dev->priv;
-#endif
-
memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv);
ieee->dev = dev;

@@ -166,12 +161,7 @@ struct net_device *alloc_ieee80211(int s

ieee80211_softmac_init(ieee);

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
-#else
- ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kmalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
- memset(ieee->pHTInfo,0,sizeof(RT_HIGH_THROUGHPUT));
-#endif
if (ieee->pHTInfo == NULL)
{
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n");
@@ -181,11 +171,7 @@ struct net_device *alloc_ieee80211(int s
HTInitializeHTInfo(ieee); //may move to other place.
TSInitialize(ieee);
#if 0
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq);
-#else
- INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq, ieee);
-#endif
#endif
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -205,22 +191,15 @@ struct net_device *alloc_ieee80211(int s

failed:
if (dev)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
free_netdev(dev);
-#else
- kfree(dev);
-#endif
+
return NULL;
}


void free_ieee80211(struct net_device *dev)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
struct ieee80211_device *ieee = netdev_priv(dev);
-#else
- struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
-#endif
int i;
//struct list_head *p, *q;
// del_timer_sync(&ieee->SwBwTimer);
@@ -241,11 +220,7 @@ void free_ieee80211(struct net_device *d
if (crypt) {
if (crypt->ops) {
crypt->ops->deinit(crypt->priv);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
module_put(crypt->ops->owner);
-#else
- __MOD_DEC_USE_COUNT(crypt->ops->owner);
-#endif
}
kfree(crypt);
ieee->crypt[i] = NULL;
@@ -262,11 +237,7 @@ void free_ieee80211(struct net_device *d
}

#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
free_netdev(dev);
-#else
- kfree(dev);
-#endif
}

#ifdef CONFIG_IEEE80211_DEBUG
@@ -332,11 +303,8 @@ static int __init ieee80211_init(void)
struct proc_dir_entry *e;

ieee80211_debug_level = debug;
-#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
- ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net);
-#else
+
ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net);
-#endif
if (ieee80211_proc == NULL) {
IEEE80211_ERROR("Unable to create " DRV_NAME
" proc directory\n");
@@ -345,11 +313,7 @@ static int __init ieee80211_init(void)
e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR,
ieee80211_proc);
if (!e) {
-#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
ieee80211_proc = NULL;
return -EIO;
}
@@ -364,16 +328,11 @@ static void __exit ieee80211_exit(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
-#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
ieee80211_proc = NULL;
}
}

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#include <linux/moduleparam.h>
module_param(debug, int, 0444);
MODULE_PARM_DESC(debug, "debug output mask");
@@ -382,12 +341,6 @@ MODULE_PARM_DESC(debug, "debug output ma
module_exit(ieee80211_exit);
module_init(ieee80211_init);
#endif
-#endif

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(alloc_ieee80211);
EXPORT_SYMBOL(free_ieee80211);
-#else
-EXPORT_SYMBOL_NOVERS(alloc_ieee80211);
-EXPORT_SYMBOL_NOVERS(free_ieee80211);
-#endif
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
@@ -55,11 +55,7 @@ static inline void ieee80211_monitor_rx(
u16 fc = le16_to_cpu(hdr->frame_ctl);

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, ieee80211_get_hdrlen(fc));
skb->pkt_type = PACKET_OTHERHOST;
@@ -2823,10 +2819,5 @@ void ieee80211_rx_mgt(struct ieee80211_d
}
}

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_rx_mgt);
EXPORT_SYMBOL(ieee80211_rx);
-#else
-EXPORT_SYMBOL_NOVERS(ieee80211_rx_mgt);
-EXPORT_SYMBOL_NOVERS(ieee80211_rx);
-#endif
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
@@ -512,34 +512,10 @@ out:
}
}

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-/* called both by wq with ieee->lock held */
-void ieee80211_softmac_scan(struct ieee80211_device *ieee)
-{
-#if 0
- short watchdog = 0;
- do{
- ieee->current_network.channel =
- (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
- return; /* no good chans */
-
- }while(!ieee->channel_map[ieee->current_network.channel]);
-#endif
-
- schedule_task(&ieee->softmac_scan_wq);
-}
-#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
void ieee80211_softmac_scan_wq(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work, struct delayed_work, work);
struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
-#else
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
-#endif
u8 last_channel = ieee->current_network.channel; //recored init channel inorder not change current channel when comming out the scan unexpectedly. WB.
#ifdef ENABLE_DOT11D
u8 channel_map[MAX_CHANNEL_NUMBER+1];
@@ -575,14 +551,7 @@ void ieee80211_softmac_scan_wq(struct ie
#endif
ieee80211_send_probe_requests(ieee);

-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
-#else
- //ieee->scan_timer.expires = jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
- mod_timer(&ieee->scan_timer,(jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME)));
-#endif

up(&ieee->scan_sem);
return;
@@ -598,19 +567,6 @@ out:
up(&ieee->scan_sem);
}

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-void ieee80211_softmac_scan_cb(unsigned long _dev)
-{
- unsigned long flags;
- struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
- spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_softmac_scan(ieee);
- spin_unlock_irqrestore(&ieee->lock, flags);
-}
-#endif
-
-
void ieee80211_beacons_start(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -666,11 +622,7 @@ void ieee80211_softmac_stop_scan(struct
if (ieee->scanning == 1){
ieee->scanning = 0;

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
cancel_delayed_work(&ieee->softmac_scan_wq);
-#else
- del_timer_sync(&ieee->scan_timer);
-#endif
}

// spin_unlock_irqrestore(&ieee->lock, flags);
@@ -700,16 +652,7 @@ void ieee80211_start_scan(struct ieee802
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
-#else
-
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
-#endif
-#else
- ieee80211_softmac_scan(ieee);
-#endif
}
}else
ieee->start_scan(ieee->dev);
@@ -1390,12 +1333,8 @@ void ieee80211_associate_abort(struct ie

ieee->state = IEEE80211_ASSOCIATING_RETRY;

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \
IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-#else
- schedule_task(&ieee->associate_retry_wq);
-#endif

spin_unlock_irqrestore(&ieee->lock, flags);
}
@@ -1489,14 +1428,11 @@ void ieee80211_associate_step2(struct ie
//dev_kfree_skb_any(skb);//edit by thomas
}
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+
void ieee80211_associate_complete_wq(struct work_struct *work)
{
struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
-#else
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
-{
-#endif
+
printk(KERN_INFO "Associated successfully\n");
ieee->is_roaming = false;
if(ieee80211_is_54g(ieee->current_network) &&
@@ -1568,21 +1504,13 @@ void ieee80211_associate_complete(struct
}
#endif
//ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(ieee->wq, &ieee->associate_complete_wq);
-#else
- schedule_task(&ieee->associate_complete_wq);
-#endif
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
void ieee80211_associate_procedure_wq(struct work_struct *work)
{
struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
-#else
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
-{
-#endif
+
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);

@@ -1682,11 +1610,7 @@ inline void ieee80211_softmac_new_net(st
ieee->state = IEEE80211_ASSOCIATING;
if(ieee->LedControlHandler != NULL)
ieee->LedControlHandler(ieee->dev, LED_CTL_START_TO_LINK);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(ieee->wq, &ieee->associate_procedure_wq);
-#else
- schedule_task(&ieee->associate_procedure_wq);
-#endif
}else{
if(ieee80211_is_54g(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
@@ -2194,11 +2118,7 @@ ieee80211_rx_frame_softmac(struct ieee80
"Association response status code 0x%x\n",
errcode);
if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(ieee->wq, &ieee->associate_procedure_wq);
-#else
- schedule_task(&ieee->associate_procedure_wq);
-#endif
} else {
ieee80211_associate_abort(ieee);
}
@@ -2310,11 +2230,7 @@ ieee80211_rx_frame_softmac(struct ieee80
RemovePeerTS(ieee, header->addr2);
if(ieee->LedControlHandler != NULL)
ieee->LedControlHandler(ieee->dev, LED_CTL_START_TO_LINK); //added by amy for LED 090318
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(ieee->wq, &ieee->associate_procedure_wq);
-#else
- schedule_task(&ieee->associate_procedure_wq);
-#endif
}
break;
case IEEE80211_STYPE_MANAGE_ACT:
@@ -2551,16 +2467,12 @@ void ieee80211_start_monitor_mode(struct
netif_carrier_on(ieee->dev);
}
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+
void ieee80211_start_ibss_wq(struct work_struct *work)
{

struct delayed_work *dwork = container_of(work, struct delayed_work, work);
struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq);
-#else
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
-{
-#endif
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
@@ -2673,11 +2585,7 @@ void ieee80211_start_ibss_wq(struct ieee

inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150);
-#else
- schedule_task(&ieee->start_ibss_wq);
-#endif
}

/* this is called only in user context, with wx_sem held */
@@ -2720,15 +2628,11 @@ void ieee80211_start_bss(struct ieee8021
spin_unlock_irqrestore(&ieee->lock, flags);
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
void ieee80211_link_change_wq(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work, struct delayed_work, work);
struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, link_change_wq);
-#else
-void ieee80211_link_change_wq(struct ieee80211_device *ieee)
-{
-#endif
+
ieee->link_change(ieee->dev);
}
/* called only in userspace context */
@@ -2751,25 +2655,17 @@ void ieee80211_disassociate(struct ieee8

//LZM for usb dev crash.
//ieee->link_change(ieee->dev);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_delayed_work(ieee->wq, &ieee->link_change_wq, 0);
-#else
- schedule_task(&ieee->link_change_wq);
-#endif

//HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
notify_wx_assoc_event(ieee);

}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+
void ieee80211_associate_retry_wq(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work, struct delayed_work, work);
struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
-#else
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
-{
-#endif
unsigned long flags;

down(&ieee->wx_sem);
@@ -2868,11 +2764,9 @@ void ieee80211_stop_protocol(struct ieee

ieee80211_stop_send_beacons(ieee);
del_timer_sync(&ieee->associate_timer);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
cancel_delayed_work(&ieee->associate_retry_wq);
cancel_delayed_work(&ieee->start_ibss_wq);
cancel_delayed_work(&ieee->link_change_wq);
-#endif
ieee80211_stop_scan(ieee);

ieee80211_disassociate(ieee);
@@ -2990,11 +2884,6 @@ void ieee80211_softmac_init(struct ieee8
ieee->sta_edca_param[3] = 0x002F3262;
ieee->aggregation = true;
ieee->enable_rx_imm_BA = 1;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- init_timer(&ieee->scan_timer);
- ieee->scan_timer.data = (unsigned long)ieee;
- ieee->scan_timer.function = ieee80211_softmac_scan_cb;
-#endif
ieee->tx_pending.txb = NULL;

init_timer(&ieee->associate_timer);
@@ -3005,16 +2894,12 @@ void ieee80211_softmac_init(struct ieee8
ieee->beacon_timer.data = (unsigned long) ieee;
ieee->beacon_timer.function = ieee80211_send_beacon_cb;

-#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

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
INIT_DELAYED_WORK(&ieee->link_change_wq,ieee80211_link_change_wq);
INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq);
INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq);
@@ -3023,25 +2908,6 @@ void ieee80211_softmac_init(struct ieee8
INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq);
INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq);

-#else
- INIT_WORK(&ieee->link_change_wq,(void(*)(void*)) ieee80211_link_change_wq,ieee);
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-#endif
-
-#else
- tq_init(&ieee->link_change_wq,(void(*)(void*)) ieee80211_link_change_wq,ieee);
- tq_init(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- tq_init(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- tq_init(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- tq_init(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- tq_init(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- tq_init(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-#endif
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);

@@ -3066,10 +2932,8 @@ void ieee80211_softmac_free(struct ieee8
#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);
}
@@ -3347,11 +3211,8 @@ static int ieee80211_wpa_set_encryption(
}
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
new_crypt->ops = ops;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
-#else
- if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
-#endif
new_crypt->priv =
new_crypt->ops->init(param->u.crypt.idx);

@@ -3534,7 +3395,6 @@ void notify_wx_assoc_event(struct ieee80
wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL);
}

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_get_beacon);
EXPORT_SYMBOL(ieee80211_wake_queue);
EXPORT_SYMBOL(ieee80211_stop_queue);
@@ -3555,26 +3415,4 @@ EXPORT_SYMBOL(ieee80211_stop_scan);
EXPORT_SYMBOL(ieee80211_send_probe_requests);
EXPORT_SYMBOL(ieee80211_softmac_scan_syncro);
EXPORT_SYMBOL(ieee80211_start_scan_syncro);
-#else
-EXPORT_SYMBOL_NOVERS(ieee80211_get_beacon);
-EXPORT_SYMBOL_NOVERS(ieee80211_wake_queue);
-EXPORT_SYMBOL_NOVERS(ieee80211_stop_queue);
-EXPORT_SYMBOL_NOVERS(ieee80211_reset_queue);
-EXPORT_SYMBOL_NOVERS(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL_NOVERS(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL_NOVERS(ieee80211_is_shortslot);
-EXPORT_SYMBOL_NOVERS(ieee80211_is_54g);
-EXPORT_SYMBOL_NOVERS(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL_NOVERS(ieee80211_ps_tx_ack);
-EXPORT_SYMBOL_NOVERS(ieee80211_softmac_xmit);
-EXPORT_SYMBOL_NOVERS(ieee80211_stop_send_beacons);
-EXPORT_SYMBOL_NOVERS(notify_wx_assoc_event);
-EXPORT_SYMBOL_NOVERS(SendDisassociation);
-EXPORT_SYMBOL_NOVERS(ieee80211_disassociate);
-EXPORT_SYMBOL_NOVERS(ieee80211_start_send_beacons);
-EXPORT_SYMBOL_NOVERS(ieee80211_stop_scan);
-EXPORT_SYMBOL_NOVERS(ieee80211_send_probe_requests);
-EXPORT_SYMBOL_NOVERS(ieee80211_softmac_scan_syncro);
-EXPORT_SYMBOL_NOVERS(ieee80211_start_scan_syncro);
-#endif
//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c
@@ -313,14 +313,9 @@ out:
return 0;
}

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
void ieee80211_wx_sync_scan_wq(struct work_struct *work)
{
struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
-#else
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
-{
-#endif
short chan;
HT_EXTCHNL_OFFSET chan_offset=0;
HT_CHANNEL_WIDTH bandwidth=0;
@@ -410,11 +405,7 @@ int ieee80211_wx_set_scan(struct ieee802
}

if ( ieee->state == IEEE80211_LINKED){
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
-#else
- schedule_task(&ieee->wx_sync_scan_wq);
-#endif
/* intentionally forget to up sem */
return 0;
}
@@ -460,18 +451,6 @@ int ieee80211_wx_set_essid(struct ieee80
if (wrqu->essid.flags && wrqu->essid.length) {
//first flush current network.ssid
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
- strncpy(ieee->current_network.ssid, extra, len);
- ieee->current_network.ssid_len = len;
-#if 0
- {
- int i;
- for (i=0; i<len; i++)
- printk("%c ", extra[i]);
- printk("\n");
- }
-#endif
-#else
strncpy(ieee->current_network.ssid, extra, len+1);
ieee->current_network.ssid_len = len+1;
#if 0
@@ -482,7 +461,6 @@ int ieee80211_wx_set_essid(struct ieee80
printk("\n");
}
#endif
-#endif
ieee->ssid_set = 1;
}
else{
@@ -670,7 +648,7 @@ exit:
return ret;

}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+
EXPORT_SYMBOL(ieee80211_wx_get_essid);
EXPORT_SYMBOL(ieee80211_wx_set_essid);
EXPORT_SYMBOL(ieee80211_wx_set_rate);
@@ -689,23 +667,3 @@ EXPORT_SYMBOL(ieee80211_wx_get_power);
EXPORT_SYMBOL(ieee80211_wlan_frequencies);
EXPORT_SYMBOL(ieee80211_wx_set_rts);
EXPORT_SYMBOL(ieee80211_wx_get_rts);
-#else
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_essid);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_essid);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rate);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rate);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_wap);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_wap);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mode);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_mode);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_scan);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_freq);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_freq);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_name);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_power);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_power);
-EXPORT_SYMBOL_NOVERS(ieee80211_wlan_frequencies);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rts);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rts);
-#endif
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c
@@ -287,11 +287,8 @@ ieee80211_classify(struct sk_buff *skb,
return 0;

// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22))
ip = ip_hdr(skb);
-#else
- ip = (struct iphdr*)(skb->data + sizeof(struct ether_header));
-#endif
+
switch (ip->tos & 0xfc) {
case 0x20:
return 2;
@@ -620,11 +617,7 @@ void ieee80211_query_seqnum(struct ieee8

int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
struct ieee80211_device *ieee = netdev_priv(dev);
-#else
- struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
-#endif
struct ieee80211_txb *txb = NULL;
struct ieee80211_hdr_3addrqos *frag_hdr;
int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size;
Index: b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
@@ -53,25 +53,7 @@ struct modes_unit ieee80211_modes[] = {
{"N-5G",4},
};

-#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(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); //new
- memcpy(stream, (char *) iwe, event_len);
- stream += event_len;
- }
- return stream;
-}
-#else
#define iwe_stream_add_event_rsl iwe_stream_add_event
-#endif

#define MAX_CUSTOM_LEN 64
static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
@@ -92,11 +74,8 @@ static inline char *rtl819x_translate_sc
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN);
-#else
- start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_ADDR_LEN);
-#endif
+
/* Remaining entries will be displayed in the order we provide them */

/* Add the ESSID */
@@ -105,18 +84,10 @@ static inline char *rtl819x_translate_sc
// if (network->flags & NETWORK_EMPTY_ESSID) {
if (network->ssid_len == 0) {
iwe.u.data.length = sizeof("<hidden>");
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>");
-#else
- start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
-#endif
} else {
iwe.u.data.length = min(network->ssid_len, (u8)32);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
-#endif
}
/* Add the protocol name */
iwe.cmd = SIOCGIWNAME;
@@ -128,11 +99,7 @@ static inline char *rtl819x_translate_sc
}
*pname = '\0';
snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN);
-#else
- start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN);
-#endif
/* Add mode */
iwe.cmd = SIOCGIWMODE;
if (network->capability &
@@ -141,11 +108,7 @@ static inline char *rtl819x_translate_sc
iwe.u.mode = IW_MODE_MASTER;
else
iwe.u.mode = IW_MODE_ADHOC;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN);
-#else
- start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN);
-#endif
}

/* Add frequency/channel */
@@ -155,11 +118,7 @@ static inline char *rtl819x_translate_sc
iwe.u.freq.m = network->channel;
iwe.u.freq.e = 0;
iwe.u.freq.i = 0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN);
-#else
- start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN);
-#endif
/* Add encryption capability */
iwe.cmd = SIOCGIWENCODE;
if (network->capability & WLAN_CAPABILITY_PRIVACY)
@@ -167,11 +126,7 @@ static inline char *rtl819x_translate_sc
else
iwe.u.data.flags = IW_ENCODE_DISABLED;
iwe.u.data.length = 0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
-#endif
/* Add basic and extended rates */
max_rate = 0;
p = custom;
@@ -227,21 +182,14 @@ static inline char *rtl819x_translate_sc
iwe.cmd = SIOCGIWRATE;
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
iwe.u.bitrate.value = max_rate * 500000;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
IW_EV_PARAM_LEN);
-#else
- start = iwe_stream_add_event_rsl(start, stop, &iwe,
- IW_EV_PARAM_LEN);
-#endif
+
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, custom);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, custom);
-#endif
+
/* Add quality statistics */
/* TODO: Fix these values... */
iwe.cmd = IWEVQUAL;
@@ -256,21 +204,13 @@ static inline char *rtl819x_translate_sc
if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL))
iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
iwe.u.qual.updated = 7;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN);
-#else
- start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN);
-#endif
iwe.cmd = IWEVCUSTOM;
p = custom;

iwe.u.data.length = p - custom;
if (iwe.u.data.length)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, custom);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, custom);
-#endif
#if (WIRELESS_EXT < 18)
if (ieee->wpa_enabled && network->wpa_ie_len){
char buf[MAX_WPA_IE_LEN * 2 + 30];
@@ -284,11 +224,7 @@ static inline char *rtl819x_translate_sc
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = strlen(buf);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, buf);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, buf);
-#endif
}

if (ieee->wpa_enabled && network->rsn_ie_len){
@@ -303,11 +239,7 @@ static inline char *rtl819x_translate_sc
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = strlen(buf);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, buf);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, buf);
-#endif
}
#else
memset(&iwe, 0, sizeof(iwe));
@@ -317,11 +249,7 @@ static inline char *rtl819x_translate_sc
memcpy(buf, network->wpa_ie, network->wpa_ie_len);
iwe.cmd = IWEVGENIE;
iwe.u.data.length = network->wpa_ie_len;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, buf);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, buf);
-#endif
}
memset(&iwe, 0, sizeof(iwe));
if (network->rsn_ie_len)
@@ -330,11 +258,7 @@ static inline char *rtl819x_translate_sc
memcpy(buf, network->rsn_ie, network->rsn_ie_len);
iwe.cmd = IWEVGENIE;
iwe.u.data.length = network->rsn_ie_len;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, buf);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, buf);
-#endif
}
#endif

@@ -347,11 +271,7 @@ static inline char *rtl819x_translate_sc
" Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100));
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
start = iwe_stream_add_point(info, start, stop, &iwe, custom);
-#else
- start = iwe_stream_add_point(start, stop, &iwe, custom);
-#endif

return start;
}
@@ -486,11 +406,7 @@ int ieee80211_wx_set_encode(struct ieee8
request_module("ieee80211_crypt_wep");
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
-#else
- if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
-#endif
new_crypt->priv = new_crypt->ops->init(key);

if (!new_crypt->ops || !new_crypt->priv) {
@@ -638,7 +554,6 @@ int ieee80211_wx_set_encode_ext(struct i
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct net_device *dev = ieee->dev;
struct iw_point *encoding = &wrqu->encoding;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
@@ -747,12 +662,7 @@ int ieee80211_wx_set_encode_ext(struct i

ieee80211_crypt_delayed_deinit(ieee, crypt);

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
-#else
- new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
- memset(new_crypt,0,sizeof(*new_crypt));
-#endif
if (new_crypt == NULL) {
ret = -ENOMEM;
goto done;
@@ -818,7 +728,7 @@ done:
IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name);
return -EINVAL;
}
-#endif
+
return ret;
}

@@ -881,8 +791,8 @@ int ieee80211_wx_set_mlme(struct ieee802
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct iw_mlme *mlme = (struct iw_mlme *) extra;
+
switch (mlme->cmd) {
case IW_MLME_DEAUTH:
case IW_MLME_DISASSOC:
@@ -891,7 +801,7 @@ int ieee80211_wx_set_mlme(struct ieee802
default:
return -EOPNOTSUPP;
}
-#endif
+
return 0;
}

@@ -899,7 +809,6 @@ int ieee80211_wx_set_auth(struct ieee802
struct iw_request_info *info,
struct iw_param *data, char *extra)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
switch (data->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
/*need to support wpa2 here*/
@@ -957,14 +866,13 @@ int ieee80211_wx_set_auth(struct ieee802
default:
return -EOPNOTSUPP;
}
-#endif
+
return 0;
}
#endif
#if 1
int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#if 0
printk("====>%s()\n", __FUNCTION__);
{
@@ -1004,13 +912,12 @@ int ieee80211_wx_set_gen_ie(struct ieee8
ieee->wpa_ie = NULL;
ieee->wpa_ie_len = 0;
}
-#endif
+
return 0;

}
#endif

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_wx_set_gen_ie);
#if (WIRELESS_EXT >= 18)
EXPORT_SYMBOL(ieee80211_wx_set_mlme);
@@ -1021,12 +928,3 @@ EXPORT_SYMBOL(ieee80211_wx_get_encode_ex
EXPORT_SYMBOL(ieee80211_wx_get_scan);
EXPORT_SYMBOL(ieee80211_wx_set_encode);
EXPORT_SYMBOL(ieee80211_wx_get_encode);
-#else
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_gen_ie);
-//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mlme);
-//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_auth);
-//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode_ext);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_scan);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode);
-EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_encode);
-#endif
Index: b/drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c
@@ -1241,14 +1241,9 @@ u8 HTFilterMCSRate( struct ieee80211_dev
void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
#if 0
//I need move this function to other places, such as rx?
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
void HTOnAssocRsp_wq(struct work_struct *work)
{
struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ht_onAssRsp);
-#else
-void HTOnAssocRsp_wq(struct ieee80211_device *ieee)
-{
-#endif
#endif
void HTOnAssocRsp(struct ieee80211_device *ieee)
{
@@ -2030,8 +2025,4 @@ void HTSetConnectBwModeCallback(struct i
pHTInfo->bSwBwInProgress = false;
}

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-EXPORT_SYMBOL_NOVERS(HTUpdateSelfAndPeerSetting);
-#else
EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting);
-#endif
Index: b/drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c
===================================================================
--- a/drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c
@@ -2,13 +2,6 @@
#include <linux/etherdevice.h>
#include "rtl819x_TS.h"

-#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)
{
// Not implement yet
@@ -660,8 +653,5 @@ void TsStartAddBaProcess(struct ieee8021
else
IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s()==>BA timer is already added\n", __FUNCTION__);
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-EXPORT_SYMBOL_NOVERS(RemovePeerTS);
-#else
+
EXPORT_SYMBOL(RemovePeerTS);
-#endif
Index: b/drivers/staging/rtl8192su/r8192S_firmware.c
===================================================================
--- a/drivers/staging/rtl8192su/r8192S_firmware.c
+++ b/drivers/staging/rtl8192su/r8192S_firmware.c
@@ -25,9 +25,7 @@
#include "r8192xU_firmware_img.h"
#endif

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#include <linux/firmware.h>
-#endif

#define byte(x,n) ( (x >> (8 * n)) & 0xff )

@@ -405,16 +403,11 @@ bool FirmwareDownload92S(struct net_devi
//3 //<1> Open Image file, and map file to contineous memory if open file success.
//3 // or read image file from array. Default load from BIN file
//3//
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- priv->firmware_source = FW_SOURCE_HEADER_FILE;
-#else
priv->firmware_source = FW_SOURCE_IMG_FILE;// We should decided by Reg.
-#endif

switch( priv->firmware_source )
{
case FW_SOURCE_IMG_FILE:
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
if(pFirmware->szFwTmpBufferLen == 0)
{

@@ -473,7 +466,6 @@ bool FirmwareDownload92S(struct net_devi


}
-#endif
break;

case FW_SOURCE_HEADER_FILE:
@@ -870,11 +862,8 @@ bool init_firmware(struct net_device *de
* Download boot, main, and data image for System reset.
* Download data image for firmware reseta
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- priv->firmware_source = FW_SOURCE_HEADER_FILE;
-#else
priv->firmware_source = FW_SOURCE_IMG_FILE;
-#endif
+
for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
/*
* Open Image file, and map file to contineous memory if open file success.
@@ -883,7 +872,6 @@ bool init_firmware(struct net_device *de
if(rst_opt == OPT_SYSTEM_RESET) {
switch(priv->firmware_source) {
case FW_SOURCE_IMG_FILE:
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev);
if(rc < 0 ) {
RT_TRACE(COMP_ERR, "request firmware fail!\n");
@@ -912,7 +900,6 @@ bool init_firmware(struct net_device *de
#endif
}
pfirmware->firmware_buf_size = file_length;
- #endif
break;

case FW_SOURCE_HEADER_FILE:
@@ -943,11 +930,10 @@ bool init_firmware(struct net_device *de
* and Tx descriptor info
* */
rt_status = fw_download_code(dev,mapped_file,file_length);
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+
if(rst_opt == OPT_SYSTEM_RESET) {
release_firmware(fw_entry);
}
- #endif

if(rt_status != TRUE) {
goto download_firmware_fail;
Index: b/drivers/staging/rtl8192su/r8192S_phy.c
===================================================================
--- a/drivers/staging/rtl8192su/r8192S_phy.c
+++ b/drivers/staging/rtl8192su/r8192S_phy.c
@@ -4678,29 +4678,15 @@ void InitialGain819xUsb(struct net_devic

if(priv->up)
{
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0);
- #else
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->initialgain_operate_wq);
- #else
- queue_work(priv->priv_wq,&priv->initialgain_operate_wq);
- #endif
- #endif
}
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void InitialGainOperateWorkItemCallBack(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq);
struct net_device *dev = priv->ieee80211->dev;
-#else
-extern void InitialGainOperateWorkItemCallBack(struct net_device *dev)
-{
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif
#define SCAN_RX_INITIAL_GAIN 0x17
#define POWER_DETECTION_TH 0x08
u32 BitMask;
Index: b/drivers/staging/rtl8192su/r8192S_phy.h
===================================================================
--- a/drivers/staging/rtl8192su/r8192S_phy.h
+++ b/drivers/staging/rtl8192su/r8192S_phy.h
@@ -121,11 +121,8 @@ extern void PHY_IQCalibrateBcut(struct
extern void PHY_IQCalibrate(struct net_device* dev);
extern void PHY_GetHWRegOriginalValue(struct net_device* dev);

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void InitialGainOperateWorkItemCallBack(struct work_struct *work);
-#else
-extern void InitialGainOperateWorkItemCallBack(struct net_device *dev);
-#endif
+
void PHY_SetTxPowerLevel8192S(struct net_device* dev, u8 channel);
void PHY_InitialGain8192S(struct net_device* dev,u8 Operation );

Index: b/drivers/staging/rtl8192su/r8192U.h
===================================================================
--- a/drivers/staging/rtl8192su/r8192U.h
+++ b/drivers/staging/rtl8192su/r8192U.h
@@ -39,9 +39,7 @@
#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 "ieee80211/ieee80211.h"

#ifdef RTL8192SU
@@ -1555,11 +1553,7 @@ typedef struct r8192_priv
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
spinlock_t ps_lock;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- struct semaphore mutex;
-#else
struct mutex mutex;
-#endif
spinlock_t rf_lock; //used to lock rf write operation added by wb

u16 irq_mask;
@@ -1619,11 +1613,9 @@ typedef struct r8192_priv
/* modified by davad for Rx process */
struct sk_buff_head rx_queue;
struct sk_buff_head skb_queue;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- struct tq_struct qos_activate;
-#else
+
struct work_struct qos_activate;
-#endif
+
short tx_urb_index;
atomic_t tx_pending[0x10];//UART_PRIORITY+1

@@ -1653,11 +1645,8 @@ typedef struct r8192_priv
u16 rts;

struct ChnlAccessSetting ChannelAccessSetting;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+
struct work_struct reset_wq;
-#else
- struct tq_struct reset_wq;
-#endif

/**********************************************************/
//for rtl819xUsb
@@ -1874,33 +1863,14 @@ typedef struct r8192_priv
u16 SifsTime;

//define work item by amy 080526
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
struct delayed_work update_beacon_wq;
struct delayed_work watch_dog_wq;
struct delayed_work txpower_tracking_wq;
struct delayed_work rfpath_check_wq;
struct delayed_work gpio_change_rf_wq;
struct delayed_work initialgain_operate_wq;
-#else
- struct work_struct update_beacon_wq;
- struct work_struct watch_dog_wq;
- struct work_struct txpower_tracking_wq;
- struct work_struct rfpath_check_wq;
- struct work_struct gpio_change_rf_wq;
- struct work_struct initialgain_operate_wq;
-#endif
+
struct workqueue_struct *priv_wq;
-#else
- /* used for periodly scan */
- struct tq_struct update_beacon_wq;
- struct tq_struct txpower_tracking_wq;
- struct tq_struct rfpath_check_wq;
- struct tq_struct watch_dog_wq;
- struct tq_struct gpio_change_rf_wq;
- struct tq_struct initialgain_operate_wq;
-#endif
//#ifdef RTL8192SU
//lzm add for 8192S
u32 IntrMask;
Index: b/drivers/staging/rtl8192su/r8192U_core.c
===================================================================
--- a/drivers/staging/rtl8192su/r8192U_core.c
+++ b/drivers/staging/rtl8192su/r8192U_core.c
@@ -75,10 +75,6 @@ double __extendsfdf2(float a) {return a;
#include "r8192U_dm.h"
//#include "r8192xU_phyreg.h"
#include <linux/usb.h>
-// FIXME: check if 2.6.7 is ok
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
-#define usb_kill_urb usb_unlink_urb
-#endif

#ifdef CONFIG_RTL8192_PM
#include "r8192U_pm.h"
@@ -102,10 +98,6 @@ double __extendsfdf2(float a) {return a;
#include "r8192U_dm.h"
//#include "r8192xU_phyreg.h"
#include <linux/usb.h>
-// FIXME: check if 2.6.7 is ok
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
-#define usb_kill_urb usb_unlink_urb
-#endif

#ifdef CONFIG_RTL8192_PM
#include "r8192U_pm.h"
@@ -201,9 +193,7 @@ static struct usb_device_id rtl8192_usb_
};

MODULE_LICENSE("GPL");
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
MODULE_VERSION("V 1.1");
-#endif
MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl);
MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards");

@@ -217,57 +207,34 @@ static int channels = 0x3fff;



-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
module_param(ifname, charp, S_IRUGO|S_IWUSR );
//module_param(hwseqnum,int, 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(hwseqnum,"i");
-MODULE_PARM(hwwep,"i");
-MODULE_PARM(channels,"i");
-#endif

MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default");
//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
MODULE_PARM_DESC(hwwep," Try to use hardware security support. ");
MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf);
-#else
-static void *__devinit rtl8192_usb_probe(struct usb_device *udev,unsigned int ifnum,
- const struct usb_device_id *id);
-static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr);
-#endif
-

static struct usb_driver rtl8192_usb_driver = {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
- .owner = THIS_MODULE,
-#endif
.name = RTL819xU_MODULE_NAME, /* Driver name */
.id_table = rtl8192_usb_id_tbl, /* PCI_ID table */
.probe = rtl8192_usb_probe, /* probe fn */
.disconnect = rtl8192_usb_disconnect, /* remove fn */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
#ifdef CONFIG_RTL8192_PM
.suspend = rtl8192U_suspend, /* PM suspend fn */
.resume = rtl8192U_resume, /* PM resume fn */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)
.reset_resume = rtl8192U_resume, /* PM reset resume fn */
-#endif
#else
.suspend = NULL, /* PM suspend fn */
.resume = NULL, /* PM resume fn */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)
.reset_resume = NULL, /* PM reset resume fn */
#endif
-#endif
-#endif
};


@@ -686,13 +653,8 @@ inline void force_pci_posting(struct net
static struct net_device_stats *rtl8192_stats(struct net_device *dev);
void rtl8192_commit(struct net_device *dev);
//void rtl8192_restart(struct net_device *dev);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
void rtl8192_restart(struct work_struct *work);
//void rtl8192_rq_tx_ack(struct work_struct *work);
-#else
- void rtl8192_restart(struct net_device *dev);
-// //void rtl8192_rq_tx_ack(struct net_device *dev);
- #endif

void watch_dog_timer_callback(unsigned long data);

@@ -1297,21 +1259,13 @@ static struct iw_statistics *r8192_get_w
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(RTL819xU_MODULE_NAME, S_IFDIR, proc_net);
-#else
rtl8192_proc=create_proc_entry(RTL819xU_MODULE_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(RTL819xU_MODULE_NAME, proc_net);
-#else
remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net);
-#endif
}


@@ -1533,11 +1487,7 @@ void tx_timeout(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
//rtl8192_commit(dev);

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
schedule_work(&priv->reset_wq);
-#else
- schedule_task(&priv->reset_wq);
-#endif
//DMESG("TXTIMEOUT");
}

@@ -1672,12 +1622,7 @@ void rtl8192_set_chan(struct net_device
#endif
}

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs);
-#else
static void rtl8192_rx_isr(struct urb *urb);
-#endif
-//static void rtl8192_rx_isr(struct urb *rx_urb);

u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats)
{
@@ -1704,11 +1649,7 @@ static int rtl8192_rx_initiate(struct ne
skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL);
if (!skb)
break;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
entry = usb_alloc_urb(0, GFP_KERNEL);
-#else
- entry = usb_alloc_urb(0);
-#endif
if (!entry) {
kfree_skb(skb);
break;
@@ -1722,11 +1663,7 @@ static int rtl8192_rx_initiate(struct ne
info->dev = dev;
info->out_pipe = 3; //denote rx normal packet queue
skb_queue_tail(&priv->rx_queue, skb);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
usb_submit_urb(entry, GFP_KERNEL);
-#else
- usb_submit_urb(entry);
-#endif
}

/* command packet rx procedure */
@@ -1735,11 +1672,7 @@ static int rtl8192_rx_initiate(struct ne
skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL);
if (!skb)
break;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
entry = usb_alloc_urb(0, GFP_KERNEL);
-#else
- entry = usb_alloc_urb(0);
-#endif
if (!entry) {
kfree_skb(skb);
break;
@@ -1752,11 +1685,7 @@ static int rtl8192_rx_initiate(struct ne
info->dev = dev;
info->out_pipe = 9; //denote rx cmd packet queue
skb_queue_tail(&priv->rx_queue, skb);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
usb_submit_urb(entry, GFP_KERNEL);
-#else
- usb_submit_urb(entry);
-#endif
}

return 0;
@@ -2083,13 +2012,7 @@ inline u16 rtl8192_rate2rate(short rate)
return rtl_rate[rate];
}

-
-/* The protype of rx_isr has changed since one verion of Linux Kernel */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs)
-#else
static void rtl8192_rx_isr(struct urb *urb)
-#endif
{
struct sk_buff *skb = (struct sk_buff *) urb->context;
struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb;
@@ -2107,20 +2030,8 @@ static void rtl8192_rx_isr(struct urb *u
// printk("%s():rx status err\n",__FUNCTION__);
return;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
+
skb_unlink(skb, &priv->rx_queue);
-#else
- /*
- * __skb_unlink before linux2.6.14 does not use spinlock to protect list head.
- * add spinlock function manually. john,2008/12/03
- */
- {
- unsigned long flags;
- spin_lock_irqsave(&(priv->rx_queue.lock), flags);
- __skb_unlink(skb,&priv->rx_queue);
- spin_unlock_irqrestore(&(priv->rx_queue.lock), flags);
- }
-#endif
skb_put(skb, urb->actual_length);

skb_queue_tail(&priv->skb_queue, skb);
@@ -2146,11 +2057,7 @@ static void rtl8192_rx_isr(struct urb *u
urb->transfer_buffer = skb->tail;
urb->context = skb;
skb_queue_tail(&priv->rx_queue, skb);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
err = usb_submit_urb(urb, GFP_ATOMIC);
-#else
- err = usb_submit_urb(urb);
-#endif
if(err && err != EPERM)
printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status);
}
@@ -2300,11 +2207,7 @@ u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_d
u8 MapHwQueueToFirmwareQueue(u8 QueueID);
struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
struct ieee80211_device *ieee = netdev_priv(dev);
-#else
- struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
-#endif
struct r8192_priv *priv = ieee80211_priv(dev);
cb_desc *tcb_desc = NULL;
u8 i;
@@ -2517,11 +2420,7 @@ struct sk_buff *DrvAggr_Aggregation(stru
u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb,
struct ieee80211_drv_agg_txb *pSendList)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
struct ieee80211_device *ieee = netdev_priv(dev);
-#else
- struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
-#endif
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
@@ -2540,11 +2439,7 @@ u8 DrvAggr_GetAggregatibleList(struct ne
}
#endif

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-static void rtl8192_tx_isr(struct urb *tx_urb, struct pt_regs *reg)
-#else
static void rtl8192_tx_isr(struct urb *tx_urb)
-#endif
{
struct sk_buff *skb = (struct sk_buff*)tx_urb->context;
struct net_device *dev = NULL;
@@ -3036,11 +2931,7 @@ short rtl8192SU_tx_cmd(struct net_device
//printk("\n %s::::::::::::::::::::::queue_index = %d\n",__FUNCTION__, queue_index);
atomic_inc(&priv->tx_pending[queue_index]);

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-#else
- tx_urb = usb_alloc_urb(0);
-#endif
if(!tx_urb){
dev_kfree_skb(skb);
return -ENOMEM;
@@ -3076,12 +2967,7 @@ short rtl8192SU_tx_cmd(struct net_device
rtl8192_tx_isr,
skb);

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
status = usb_submit_urb(tx_urb, GFP_ATOMIC);
-#else
- status = usb_submit_urb(tx_urb);
-#endif
-
if (!status){
return 0;
}else{
@@ -3105,11 +2991,8 @@ short rtl819xU_tx_cmd(struct net_device

//printk("\n %s::queue_index = %d\n",__FUNCTION__, queue_index);
atomic_inc(&priv->tx_pending[queue_index]);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-#else
- tx_urb = usb_alloc_urb(0);
-#endif
if(!tx_urb){
dev_kfree_skb(skb);
return -ENOMEM;
@@ -3143,12 +3026,7 @@ short rtl819xU_tx_cmd(struct net_device
usb_fill_bulk_urb(tx_urb,priv->udev, usb_sndbulkpipe(priv->udev,idx_pipe), \
skb->data, skb->len, rtl8192_tx_isr, skb);

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
status = usb_submit_urb(tx_urb, GFP_ATOMIC);
-#else
- status = usb_submit_urb(tx_urb);
-#endif
-
if (!status){
return 0;
}else{
@@ -3333,11 +3211,7 @@ u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_d
return tmp_Short;
}

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-static void tx_zero_isr(struct urb *tx_urb, struct pt_regs *reg)
-#else
static void tx_zero_isr(struct urb *tx_urb)
-#endif
{
return;
}
@@ -3401,11 +3275,7 @@ short rtl8192SU_tx(struct net_device *de
return -1;
}

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-#else
- tx_urb = usb_alloc_urb(0);
-#endif
if(!tx_urb){
dev_kfree_skb_any(skb);
return -ENOMEM;
@@ -3674,11 +3544,7 @@ short rtl8192SU_tx(struct net_device *de
skb->data,
skb->len, rtl8192_tx_isr, skb);

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
status = usb_submit_urb(tx_urb, GFP_ATOMIC);
-#else
- status = usb_submit_urb(tx_urb);
-#endif
if (!status){
//we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted. Otherwise, it will be halt to wait for another packet. WB. 2008.08.27
bool bSend0Byte = false;
@@ -3696,11 +3562,7 @@ short rtl8192SU_tx(struct net_device *de
if (bSend0Byte)
{
#if 1
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC);
-#else
- tx_urb_zero = usb_alloc_urb(0);
-#endif
if(!tx_urb_zero){
RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n");
return -ENOMEM;
@@ -3708,11 +3570,7 @@ short rtl8192SU_tx(struct net_device *de
usb_fill_bulk_urb(tx_urb_zero,udev,
usb_sndbulkpipe(udev,idx_pipe), &zero,
0, tx_zero_isr, dev);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC);
-#else
- status = usb_submit_urb(tx_urb_zero);
-#endif
if (status){
RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
return -1;
@@ -3780,11 +3638,7 @@ short rtl8192_tx(struct net_device *dev,
return -1;
}

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-#else
- tx_urb = usb_alloc_urb(0);
-#endif
if(!tx_urb){
dev_kfree_skb_any(skb);
return -ENOMEM;
@@ -3972,11 +3826,7 @@ short rtl8192_tx(struct net_device *dev,
usb_sndbulkpipe(udev,idx_pipe), skb->data,
skb->len, rtl8192_tx_isr, skb);

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
status = usb_submit_urb(tx_urb, GFP_ATOMIC);
-#else
- status = usb_submit_urb(tx_urb);
-#endif
if (!status){
//we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted. Otherwise, it will be halt to wait for another packet. WB. 2008.08.27
bool bSend0Byte = false;
@@ -3994,11 +3844,7 @@ short rtl8192_tx(struct net_device *dev,
if (bSend0Byte)
{
#if 1
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC);
-#else
- tx_urb_zero = usb_alloc_urb(0);
-#endif
if(!tx_urb_zero){
RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n");
return -ENOMEM;
@@ -4006,11 +3852,7 @@ short rtl8192_tx(struct net_device *dev,
usb_fill_bulk_urb(tx_urb_zero,udev,
usb_sndbulkpipe(udev,idx_pipe), &zero,
0, tx_zero_isr, dev);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC);
-#else
- status = usb_submit_urb(tx_urb_zero);
-#endif
if (status){
RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
return -1;
@@ -4333,16 +4175,10 @@ static struct ieee80211_qos_parameters d
};


-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
void rtl8192_update_beacon(struct work_struct * work)
{
struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work);
struct net_device *dev = priv->ieee80211->dev;
-#else
-void rtl8192_update_beacon(struct net_device *dev)
-{
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif
struct ieee80211_device* ieee = priv->ieee80211;
struct ieee80211_network* net = &ieee->current_network;

@@ -4357,16 +4193,11 @@ void rtl8192_update_beacon(struct net_de
* background support to run QoS activate functionality
*/
int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO};
-#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
+
void rtl8192_qos_activate(struct work_struct * work)
{
struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate);
struct net_device *dev = priv->ieee80211->dev;
-#else
-void rtl8192_qos_activate(struct net_device *dev)
-{
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif
struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
u8 mode = priv->ieee80211->current_network.mode;
//u32 size = sizeof(struct ieee80211_qos_parameters);
@@ -4377,11 +4208,8 @@ void rtl8192_qos_activate(struct net_dev
if (priv == NULL)
return;

-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- down(&priv->mutex);
-#else
mutex_lock(&priv->mutex);
-#endif
+
if(priv->ieee80211->state != IEEE80211_LINKED)
goto success;
RT_TRACE(COMP_QOS,"qos active process with associate response received\n");
@@ -4401,11 +4229,7 @@ void rtl8192_qos_activate(struct net_dev
}

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,
@@ -4432,11 +4256,7 @@ static int rtl8192_qos_handle_probe_resp
network->qos_data.param_count)) {
network->qos_data.old_param_count =
network->qos_data.param_count;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(priv->priv_wq, &priv->qos_activate);
-#else
- schedule_task(&priv->qos_activate);
-#endif
RT_TRACE (COMP_QOS, "QoS parameters change call "
"qos_activate\n");
}
@@ -4445,11 +4265,7 @@ static int rtl8192_qos_handle_probe_resp
&def_qos_parameters, size);

if ((network->qos_data.active == 1) && (active_network == 1)) {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(priv->priv_wq, &priv->qos_activate);
-#else
- schedule_task(&priv->qos_activate);
-#endif
RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n");
}
network->qos_data.active = 0;
@@ -4467,16 +4283,8 @@ static int rtl8192_handle_beacon(struct
struct r8192_priv *priv = ieee80211_priv(dev);

rtl8192_qos_handle_probe_response(priv,1,network);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0);
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->update_beacon_wq);
-#else
- queue_work(priv->priv_wq, &priv->update_beacon_wq);
-#endif

-#endif
return 0;

}
@@ -4533,12 +4341,7 @@ static int rtl8192_qos_association_resp(

RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active);
if (set_qos_param == 1)
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(priv->priv_wq, &priv->qos_activate);
-#else
- schedule_task(&priv->qos_activate);
-#endif
-

return ret;
}
@@ -4793,7 +4596,7 @@ void rtl8192_hw_sleep_down(struct net_de
// MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS);
#endif
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+
void rtl8192_hw_sleep_wq (struct work_struct *work)
{
// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
@@ -4802,10 +4605,7 @@ void rtl8192_hw_sleep_wq (struct work_st
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_sleep_wq);
struct net_device *dev = ieee->dev;
-#else
-void rtl8192_hw_sleep_wq(struct net_device* dev)
-{
-#endif
+
//printk("=========>%s()\n", __FUNCTION__);
rtl8192_hw_sleep_down(dev);
}
@@ -4823,7 +4623,7 @@ void rtl8192_hw_wakeup(struct net_device
//FIXME: will we send package stored while nic is sleep?
// spin_unlock_irqrestore(&priv->ps_lock,flags);
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+
void rtl8192_hw_wakeup_wq (struct work_struct *work)
{
// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
@@ -4832,12 +4632,8 @@ void rtl8192_hw_wakeup_wq (struct work_s
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_wakeup_wq);
struct net_device *dev = ieee->dev;
-#else
-void rtl8192_hw_wakeup_wq(struct net_device* dev)
-{
-#endif
- rtl8192_hw_wakeup(dev);

+ rtl8192_hw_wakeup(dev);
}

#define MIN_SLEEP_TIME 50
@@ -4881,11 +4677,7 @@ void rtl8192_hw_to_sleep(struct net_devi
u32 tmp = (tl>rb)?(tl-rb):(rb-tl);
// if (tl<rb)

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->ieee80211->hw_wakeup_wq);
-#else
queue_delayed_work(priv->ieee80211->wq, &priv->ieee80211->hw_wakeup_wq, tmp); //as tl may be less than rb
-#endif
}
/* if we suspect the TimerInt is gone beyond tl
* while setting it, then give up
@@ -4902,11 +4694,8 @@ void rtl8192_hw_to_sleep(struct net_devi
// priv->rf_sleep(dev);

//printk("<=========%s()\n", __FUNCTION__);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->ieee80211->hw_sleep_wq);
-#else
queue_delayed_work(priv->ieee80211->wq, (void *)&priv->ieee80211->hw_sleep_wq,0);
-#endif
+
spin_unlock_irqrestore(&priv->ps_lock,flags);
}
//init priv variables here. only non_zero value should be initialized here.
@@ -5113,18 +4902,10 @@ static void rtl8192_init_priv_lock(struc
sema_init(&priv->wx_sem,1);
sema_init(&priv->rf_sem,1);
spin_lock_init(&priv->ps_lock);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
- sema_init(&priv->mutex, 1);
-#else
mutex_init(&priv->mutex);
-#endif
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void rtl819x_watchdog_wqcallback(struct work_struct *work);
-#else
-extern void rtl819x_watchdog_wqcallback(struct net_device *dev);
-#endif

void rtl8192_irq_rx_tasklet(struct r8192_priv *priv);
//init tasklet and wait_queue here. only 2.6 above kernel is considered
@@ -5133,15 +4914,12 @@ static void rtl8192_init_priv_task(struc
{
struct r8192_priv *priv = ieee80211_priv(dev);

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#ifdef PF_SYNCTHREAD
priv->priv_wq = create_workqueue(DRV_NAME,0);
#else
priv->priv_wq = create_workqueue(DRV_NAME);
#endif
-#endif

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
INIT_WORK(&priv->reset_wq, rtl8192_restart);

//INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog);
@@ -5157,36 +4935,6 @@ static void rtl8192_init_priv_task(struc
INIT_DELAYED_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq);
INIT_DELAYED_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq);

-#else
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- tq_init(&priv->reset_wq, (void*)rtl8192_restart, dev);
- tq_init(&priv->watch_dog_wq, (void*)rtl819x_watchdog_wqcallback, dev);
- tq_init(&priv->txpower_tracking_wq, (void*)dm_txpower_trackingcallback, dev);
- tq_init(&priv->rfpath_check_wq, (void*)dm_rf_pathcheck_workitemcallback, dev);
- tq_init(&priv->update_beacon_wq, (void*)rtl8192_update_beacon, dev);
- //tq_init(&priv->SwChnlWorkItem, (void*) rtl8192_SwChnl_WorkItem, dev);
- //tq_init(&priv->SetBWModeWorkItem, (void*)rtl8192_SetBWModeWorkItem, dev);
- tq_init(&priv->qos_activate, (void *)rtl8192_qos_activate, dev);
- tq_init(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq, dev);
- tq_init(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq, dev);
-
-#else
- INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8192_restart,dev);
- //INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) hal_dm_watchdog,dev);
- INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) rtl819x_watchdog_wqcallback,dev);
- INIT_WORK(&priv->txpower_tracking_wq, (void(*)(void*)) dm_txpower_trackingcallback,dev);
-// INIT_WORK(&priv->gpio_change_rf_wq, (void(*)(void*)) dm_gpio_change_rf_callback,dev);
- INIT_WORK(&priv->rfpath_check_wq, (void(*)(void*)) dm_rf_pathcheck_workitemcallback,dev);
- INIT_WORK(&priv->update_beacon_wq, (void(*)(void*))rtl8192_update_beacon,dev);
- INIT_WORK(&priv->initialgain_operate_wq, (void(*)(void*))InitialGainOperateWorkItemCallBack,dev);
- //INIT_WORK(&priv->SwChnlWorkItem, (void(*)(void*)) rtl8192_SwChnl_WorkItem, dev);
- //INIT_WORK(&priv->SetBWModeWorkItem, (void(*)(void*)) rtl8192_SetBWModeWorkItem, dev);
- INIT_WORK(&priv->qos_activate, (void(*)(void *))rtl8192_qos_activate, dev);
- INIT_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq, dev);
- INIT_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq, dev);
-#endif
-#endif
-
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8192_irq_rx_tasklet,
(unsigned long)priv);
@@ -9092,9 +8840,7 @@ RESET_START:
printk("ieee->state is IEEE80211_LINKED\n");
ieee80211_stop_send_beacons(priv->ieee80211);
del_timer_sync(&ieee->associate_timer);
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
cancel_delayed_work(&ieee->associate_retry_wq);
- #endif
ieee80211_stop_scan(ieee);
netif_carrier_off(dev);
up(&ieee->wx_sem);
@@ -9131,11 +8877,7 @@ RESET_START:
ieee->set_chan(ieee->dev, ieee->current_network.channel);

#if 1
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(ieee->wq, &ieee->associate_complete_wq);
-#else
- schedule_task(&ieee->associate_complete_wq);
-#endif
#endif

}
@@ -9231,18 +8973,11 @@ void rtl819x_update_rxcounts(
}
}

-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void rtl819x_watchdog_wqcallback(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq);
struct net_device *dev = priv->ieee80211->dev;
-#else
-extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
-{
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif
struct ieee80211_device* ieee = priv->ieee80211;
RESET_TYPE ResetType = RESET_TYPE_NORESET;
static u8 check_reset_cnt=0;
@@ -9288,12 +9023,7 @@ extern void rtl819x_watchdog_wqcallback(
RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid);
ieee->is_roaming = true;
priv->ieee80211->link_change(dev);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq);
-#else
- schedule_task(&priv->ieee80211->associate_procedure_wq);
-#endif
-
}
}
priv->ieee80211->LinkDetectInfo.NumRecvBcnInPeriod=0;
@@ -9328,15 +9058,7 @@ void watch_dog_timer_callback(unsigned l
{
struct r8192_priv *priv = ieee80211_priv((struct net_device *) data);
//printk("===============>watch_dog timer\n");
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq, 0);
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->watch_dog_wq);
-#else
- queue_work(priv->priv_wq,&priv->watch_dog_wq);
-#endif
-#endif
mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME));
#if 0
priv->watch_dog_timer.expires = jiffies + MSECS(IEEE80211_WATCH_DOG_TIME);
@@ -9488,17 +9210,10 @@ void rtl8192_restart(struct net_device *
{
struct r8192_priv *priv = ieee80211_priv(dev);
*/
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
void rtl8192_restart(struct work_struct *work)
{
struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq);
struct net_device *dev = priv->ieee80211->dev;
-#else
-void rtl8192_restart(struct net_device *dev)
-{
-
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif

down(&priv->wx_sem);

@@ -9537,11 +9252,8 @@ int r8192_set_mac_adr(struct net_device

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;
@@ -12038,7 +11750,6 @@ void rtl8192_irq_rx_tasklet(struct r8192
/****************************************************************************
---------------------------- USB_STUFF---------------------------
*****************************************************************************/
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
//LZM Merge from windows HalUsbSetQueuePipeMapping8192SUsb 090319
static void HalUsbSetQueuePipeMapping8192SUsb(struct usb_interface *intf, struct net_device *dev)
{
@@ -12058,7 +11769,6 @@ static void HalUsbSetQueuePipeMapping819

for (i = 0; i < priv->ep_num; ++i) {
endpoint = &iface_desc->endpoint[i].desc;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
if (usb_endpoint_is_bulk_in(endpoint)) {
priv->RtInPipes[priv->ep_in_num] = usb_endpoint_num(endpoint);
priv->ep_in_num ++;
@@ -12068,19 +11778,6 @@ static void HalUsbSetQueuePipeMapping819
priv->ep_out_num ++;
//printk("out_endpoint_idx = %d\n", usb_endpoint_num(endpoint));
}
-#else
- if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) &&
- ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) {
- /* we found a bulk in endpoint */
- priv->RtInPipes[priv->ep_in_num] = (endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
- priv->ep_in_num ++;
- } else if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) &&
- ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) {
- /* We found bulk out endpoint */
- priv->RtOutPipes[priv->ep_out_num] = endpoint->bEndpointAddress;
- priv->ep_out_num ++;
- }
-#endif
}
{
memset(priv->txqueue_to_outpipemap,0,9);
@@ -12130,7 +11827,6 @@ static void HalUsbSetQueuePipeMapping819

return;
}
-#endif

static const struct net_device_ops rtl8192_netdev_ops = {
.ndo_open = rtl8192_open,
@@ -12145,50 +11841,26 @@ static const struct net_device_ops rtl81
.ndo_start_xmit = ieee80211_xmit,
};

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
-#else
-static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
- unsigned int ifnum,
- const struct usb_device_id *id)
-#endif
{
// unsigned long ioaddr = 0;
struct net_device *dev = NULL;
struct r8192_priv *priv= NULL;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct usb_device *udev = interface_to_usbdev(intf);
-#endif
+
RT_TRACE(COMP_INIT, "Oops: i'm coming\n");

dev = alloc_ieee80211(sizeof(struct r8192_priv));

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
- SET_MODULE_OWNER(dev);
-#endif
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
usb_set_intfdata(intf, dev);
SET_NETDEV_DEV(dev, &intf->dev);
-#endif
priv = ieee80211_priv(dev);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
priv->ieee80211 = netdev_priv(dev);
-#else
- priv->ieee80211 = (struct net_device *)dev->priv;
-#endif
priv->udev=udev;

#ifdef RTL8192SU
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
HalUsbSetQueuePipeMapping8192SUsb(intf, dev);
-#else//use one pipe
- {
- memset(priv->txqueue_to_outpipemap,0,9);
- memset(priv->RtOutPipes,4,16);//all use endpoint 4 for out
- }
-#endif
#endif

#ifdef RTL8192SU
@@ -12234,29 +11906,17 @@ static void * __devinit rtl8192_usb_prob


RT_TRACE(COMP_INIT, "Driver probe completed\n");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- return dev;
-#else
return 0;
-#endif
-
-
fail:
free_ieee80211(dev);

RT_TRACE(COMP_ERR, "wlan driver load failed\n");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- return NULL;
-#else
return -ENODEV;
-#endif
-
}

//detach all the work and timer structure declared or inititialize in r8192U_init function.
void rtl8192_cancel_deferred_work(struct r8192_priv* priv)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
cancel_work_sync(&priv->reset_wq);
cancel_work_sync(&priv->qos_activate);
cancel_delayed_work(&priv->watch_dog_wq);
@@ -12265,35 +11925,11 @@ void rtl8192_cancel_deferred_work(struct
cancel_delayed_work(&priv->ieee80211->hw_sleep_wq);
//cancel_work_sync(&priv->SetBWModeWorkItem);
//cancel_work_sync(&priv->SwChnlWorkItem);
-#else
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
- cancel_delayed_work(&priv->reset_wq);
- cancel_delayed_work(&priv->qos_activate);
- cancel_delayed_work(&priv->watch_dog_wq);
- cancel_delayed_work(&priv->update_beacon_wq);
- cancel_delayed_work(&priv->ieee80211->hw_wakeup_wq);
- cancel_delayed_work(&priv->ieee80211->hw_sleep_wq);
-
- //cancel_delayed_work(&priv->SetBWModeWorkItem);
- //cancel_delayed_work(&priv->SwChnlWorkItem);
-#endif
-#endif
-
}

-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf)
-#else
-static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
-#endif
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct net_device *dev = usb_get_intfdata(intf);
-#else
- struct net_device *dev = (struct net_device *)ptr;
-#endif
-
struct r8192_priv *priv = ieee80211_priv(dev);
if(dev){

@@ -12310,9 +11946,7 @@ static void __devexit rtl8192_usb_discon
}
// priv->rf_close(dev);
// rtl8192_SetRFPowerState(dev, eRfOff);
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
destroy_workqueue(priv->priv_wq);
-#endif
//rtl8192_irq_disable(dev);
//rtl8192_reset(dev);
mdelay(10);
Index: b/drivers/staging/rtl8192su/r8192U_dm.c
===================================================================
--- a/drivers/staging/rtl8192su/r8192U_dm.c
+++ b/drivers/staging/rtl8192su/r8192U_dm.c
@@ -98,12 +98,7 @@ extern void hal_dm_watchdog(struct net_d


extern void init_rate_adaptive(struct net_device *dev);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void dm_txpower_trackingcallback(struct work_struct *work);
-#else
-extern void dm_txpower_trackingcallback(struct net_device *dev);
-#endif
-
extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
extern void dm_backup_dynamic_mechanism_state(struct net_device *dev);
@@ -118,11 +113,7 @@ extern void dm_force_tx_fw_info(struct n
u32 force_value);
extern void dm_init_edca_turbo(struct net_device *dev);
extern void dm_rf_operation_test_callback(unsigned long data);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
-#else
-extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev);
-#endif
extern void dm_fsync_timer_callback(unsigned long data);
#if 0
extern bool dm_check_lbus_status(struct net_device *dev);
@@ -1180,17 +1171,11 @@ static void dm_TXPowerTrackingCallback_T
priv->txpower_count = 0;
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void dm_txpower_trackingcallback(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq);
struct net_device *dev = priv->ieee80211->dev;
-#else
-extern void dm_txpower_trackingcallback(struct net_device *dev)
-{
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif

#ifdef RTL8190P
dm_TXPowerTrackingCallback_TSSI(dev);
@@ -1754,15 +1739,7 @@ static void dm_CheckTXPowerTracking_TSSI
{
if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0))
{
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
- #else
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->txpower_tracking_wq);
- #else
- queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
- #endif
- #endif
}
tx_power_track_counter++;
}
@@ -1821,15 +1798,7 @@ static void dm_CheckTXPowerTracking_Ther
else
{
//DbgPrint("Schedule TxPowerTrackingWorkItem\n");
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
- #else
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->txpower_tracking_wq);
- #else
- queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
- #endif
- #endif
TM_Trigger = 0;
}
#endif
@@ -3345,15 +3314,7 @@ static void dm_check_rfctrl_gpio(struct
return;
#endif
#ifdef RTL8192E
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0);
- #else
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->gpio_change_rf_wq);
- #else
- queue_work(priv->priv_wq,&priv->gpio_change_rf_wq);
- #endif
- #endif
#endif

} /* dm_CheckRfCtrlGPIO */
@@ -3442,17 +3403,11 @@ static void dm_check_pbc_gpio(struct net
* 02/21/2008 MHC Create Version 0.
*
*---------------------------------------------------------------------------*/
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void dm_gpio_change_rf_callback(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq);
struct net_device *dev = priv->ieee80211->dev;
-#else
-extern void dm_gpio_change_rf_callback(struct net_device *dev)
-{
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif
u8 tmp1byte;
RT_RF_POWER_STATE eRfPowerStateToSet;
bool bActuallySet = false;
@@ -3520,17 +3475,11 @@ extern void dm_gpio_change_rf_callback(s
* 01/30/2008 MHC Create Version 0.
*
*---------------------------------------------------------------------------*/
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq);
struct net_device *dev =priv->ieee80211->dev;
-#else
-extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev)
-{
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif
//bool bactually_set = false;
u8 rfpath = 0, i;

@@ -3855,15 +3804,8 @@ static void dm_rxpath_sel_byrssi(struct
static void dm_check_rx_path_selection(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+
queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0);
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->rfpath_check_wq);
-#else
- queue_work(priv->priv_wq,&priv->rfpath_check_wq);
-#endif
-#endif
} /* dm_CheckRxRFPath */


Index: b/drivers/staging/rtl8192su/r8192U_dm.h
===================================================================
--- a/drivers/staging/rtl8192su/r8192U_dm.h
+++ b/drivers/staging/rtl8192su/r8192U_dm.h
@@ -275,11 +275,7 @@ extern void deinit_hal_dm(struct net_de
extern void hal_dm_watchdog(struct net_device *dev);

extern void init_rate_adaptive(struct net_device *dev);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void dm_txpower_trackingcallback(struct work_struct *work);
-#else
-extern void dm_txpower_trackingcallback(struct net_device *dev);
-#endif
extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
extern void dm_backup_dynamic_mechanism_state(struct net_device *dev);
extern void dm_change_dynamic_initgain_thresh(struct net_device *dev,
@@ -287,11 +283,7 @@ extern void dm_change_dynamic_initga
extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value);
extern void dm_init_edca_turbo(struct net_device *dev);
extern void dm_rf_operation_test_callback(unsigned long data);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
-#else
-extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev);
-#endif
extern void dm_fsync_timer_callback(unsigned long data);
extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
#if 0
Index: b/drivers/staging/rtl8192su/r8192U_pm.c
===================================================================
--- a/drivers/staging/rtl8192su/r8192U_pm.c
+++ b/drivers/staging/rtl8192su/r8192U_pm.c
@@ -22,11 +22,8 @@ int rtl8192U_save_state (struct pci_dev

int rtl8192U_suspend(struct usb_interface *intf, pm_message_t state)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct net_device *dev = usb_get_intfdata(intf);
-#else
- //struct net_device *dev = (struct net_device *)ptr;
-#endif
+
RT_TRACE(COMP_POWER, "============> r8192U suspend call.\n");

if(dev) {
@@ -48,11 +45,7 @@ int rtl8192U_suspend(struct usb_interfac

int rtl8192U_resume (struct usb_interface *intf)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct net_device *dev = usb_get_intfdata(intf);
-#else
- //struct net_device *dev = (struct net_device *)ptr;
-#endif

RT_TRACE(COMP_POWER, "================>r8192U resume call.");

Index: b/drivers/staging/rtl8192su/r8192U_wx.c
===================================================================
--- a/drivers/staging/rtl8192su/r8192U_wx.c
+++ b/drivers/staging/rtl8192su/r8192U_wx.c
@@ -981,7 +981,6 @@ static int r8192_wx_set_enc_ext(struct n
union iwreq_data *wrqu, char *extra)
{
int ret=0;
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct r8192_priv *priv = ieee80211_priv(dev);
struct ieee80211_device* ieee = priv->ieee80211;
//printk("===>%s()\n", __FUNCTION__);
@@ -1065,22 +1064,19 @@ static int r8192_wx_set_enc_ext(struct n
end_hw_sec:

up(&priv->wx_sem);
-#endif
return ret;
-
}
static int r8192_wx_set_auth(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *data, char *extra)
{
int ret=0;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+
//printk("====>%s()\n", __FUNCTION__);
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra);
up(&priv->wx_sem);
-#endif
return ret;
}

@@ -1091,13 +1087,10 @@ static int r8192_wx_set_mlme(struct net_
//printk("====>%s()\n", __FUNCTION__);

int ret=0;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra);
-
up(&priv->wx_sem);
-#endif
return ret;
}
#endif
@@ -1107,7 +1100,6 @@ static int r8192_wx_set_gen_ie(struct ne
{
//printk("====>%s(), len:%d\n", __FUNCTION__, data->length);
int ret=0;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
struct r8192_priv *priv = ieee80211_priv(dev);
down(&priv->wx_sem);
#if 1
@@ -1115,7 +1107,6 @@ static int r8192_wx_set_gen_ie(struct ne
#endif
up(&priv->wx_sem);
//printk("<======%s(), ret:%d\n", __FUNCTION__, ret);
-#endif
return ret;


@@ -1311,11 +1302,7 @@ struct iw_statistics *r8192_get_wireless
wstats->qual.qual = 0;
wstats->qual.level = 0;
wstats->qual.noise = 0;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
-#else
- wstats->qual.updated = 0x0f;
-#endif
return wstats;
}

@@ -1327,11 +1314,7 @@ struct iw_statistics *r8192_get_wireless
wstats->qual.level = tmp_level;
wstats->qual.qual = tmp_qual;
wstats->qual.noise = tmp_noise;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM;
-#else
- wstats->qual.updated = 0x0f;
-#endif
return wstats;
}
//#endif
Index: b/drivers/staging/rtl8192su/r819xU_firmware.c
===================================================================
--- a/drivers/staging/rtl8192su/r819xU_firmware.c
+++ b/drivers/staging/rtl8192su/r819xU_firmware.c
@@ -15,9 +15,8 @@
#include "r8192U_hw.h"
#include "r819xU_firmware_img.h"
#include "r819xU_firmware.h"
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#include <linux/firmware.h>
-#endif
+
void firmware_init_param(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
@@ -338,11 +337,8 @@ bool init_firmware(struct net_device *de
* Download boot, main, and data image for System reset.
* Download data image for firmware reseta
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- priv->firmware_source = FW_SOURCE_HEADER_FILE;
-#else
priv->firmware_source = FW_SOURCE_IMG_FILE;
-#endif
+
for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
/*
* Open Image file, and map file to contineous memory if open file success.
@@ -351,7 +347,6 @@ bool init_firmware(struct net_device *de
if(rst_opt == OPT_SYSTEM_RESET) {
switch(priv->firmware_source) {
case FW_SOURCE_IMG_FILE:
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
if(pfirmware->firmware_buf_size[init_step] == 0) {
rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev);
if(rc < 0 ) {
@@ -382,16 +377,12 @@ bool init_firmware(struct net_device *de
}
//pfirmware->firmware_buf_size = file_length;

-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
if(rst_opt == OPT_SYSTEM_RESET) {
release_firmware(fw_entry);
}
-#endif
}
mapped_file = pfirmware->firmware_buf[init_step];
file_length = pfirmware->firmware_buf_size[init_step];
-#endif
-
break;

case FW_SOURCE_HEADER_FILE:
Index: b/drivers/staging/rtl8192su/r819xU_phy.c
===================================================================
--- a/drivers/staging/rtl8192su/r819xU_phy.c
+++ b/drivers/staging/rtl8192su/r819xU_phy.c
@@ -1726,29 +1726,15 @@ void InitialGain819xUsb(struct net_devic

if(priv->up)
{
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0);
- #else
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- schedule_task(&priv->initialgain_operate_wq);
- #else
- queue_work(priv->priv_wq,&priv->initialgain_operate_wq);
- #endif
- #endif
}
}

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void InitialGainOperateWorkItemCallBack(struct work_struct *work)
{
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq);
struct net_device *dev = priv->ieee80211->dev;
-#else
-extern void InitialGainOperateWorkItemCallBack(struct net_device *dev)
-{
- struct r8192_priv *priv = ieee80211_priv(dev);
-#endif
#define SCAN_RX_INITIAL_GAIN 0x17
#define POWER_DETECTION_TH 0x08
u32 BitMask;
Index: b/drivers/staging/rtl8192su/r819xU_phy.h
===================================================================
--- a/drivers/staging/rtl8192su/r819xU_phy.h
+++ b/drivers/staging/rtl8192su/r819xU_phy.h
@@ -85,10 +85,6 @@ extern bool rtl8192_SetRFPowerState(stru
//added by amy
extern void InitialGain819xUsb(struct net_device *dev, u8 Operation);

-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
extern void InitialGainOperateWorkItemCallBack(struct work_struct *work);
-#else
-extern void InitialGainOperateWorkItemCallBack(struct net_device *dev);
-#endif

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