aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-13 12:35:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 15:01:28 -0400
commit1ec9e48dbfe29e4919a9ca3d0c692c982f484c73 (patch)
treef93c5bdf127fd2b4b5e875a1046e4e24ac56d1b7
parent7fdb78d097e4282e8b54312351a135c6f54ae03c (diff)
Staging: rtl8192su: remove kernel version compatibility wrappers
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/rtl8192su/ieee80211/dot11d.c11
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211.h120
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c14
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.h7
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c51
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c229
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c113
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_module.c51
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c9
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c176
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c44
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c9
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c118
-rw-r--r--drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c9
-rw-r--r--drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c12
-rw-r--r--drivers/staging/rtl8192su/r8192S_firmware.c18
-rw-r--r--drivers/staging/rtl8192su/r8192S_phy.c14
-rw-r--r--drivers/staging/rtl8192su/r8192S_phy.h5
-rw-r--r--drivers/staging/rtl8192su/r8192U.h40
-rw-r--r--drivers/staging/rtl8192su/r8192U_core.c388
-rw-r--r--drivers/staging/rtl8192su/r8192U_dm.c60
-rw-r--r--drivers/staging/rtl8192su/r8192U_dm.h8
-rw-r--r--drivers/staging/rtl8192su/r8192U_pm.c9
-rw-r--r--drivers/staging/rtl8192su/r8192U_wx.c19
-rw-r--r--drivers/staging/rtl8192su/r819xU_firmware.c13
-rw-r--r--drivers/staging/rtl8192su/r819xU_phy.c14
-rw-r--r--drivers/staging/rtl8192su/r819xU_phy.h4
27 files changed, 77 insertions, 1488 deletions
diff --git a/drivers/staging/rtl8192su/ieee80211/dot11d.c b/drivers/staging/rtl8192su/ieee80211/dot11d.c
index e5f2dedc437..eebcb7f01c9 100644
--- a/drivers/staging/rtl8192su/ieee80211/dot11d.c
+++ b/drivers/staging/rtl8192su/ieee80211/dot11d.c
@@ -218,7 +218,7 @@ int ToLegalChannel(
218 218
219 return default_chn; 219 return default_chn;
220} 220}
221#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) 221
222EXPORT_SYMBOL(Dot11d_Init); 222EXPORT_SYMBOL(Dot11d_Init);
223EXPORT_SYMBOL(Dot11d_Reset); 223EXPORT_SYMBOL(Dot11d_Reset);
224EXPORT_SYMBOL(Dot11d_UpdateCountryIe); 224EXPORT_SYMBOL(Dot11d_UpdateCountryIe);
@@ -226,14 +226,5 @@ EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm);
226EXPORT_SYMBOL(DOT11D_ScanComplete); 226EXPORT_SYMBOL(DOT11D_ScanComplete);
227EXPORT_SYMBOL(IsLegalChannel); 227EXPORT_SYMBOL(IsLegalChannel);
228EXPORT_SYMBOL(ToLegalChannel); 228EXPORT_SYMBOL(ToLegalChannel);
229#else
230EXPORT_SYMBOL_NOVERS(Dot11d_Init);
231EXPORT_SYMBOL_NOVERS(Dot11d_Reset);
232EXPORT_SYMBOL_NOVERS(Dot11d_UpdateCountryIe);
233EXPORT_SYMBOL_NOVERS(DOT11D_GetMaxTxPwrInDbm);
234EXPORT_SYMBOL_NOVERS(DOT11D_ScanComplete);
235EXPORT_SYMBOL_NOVERS(IsLegalChannel);
236EXPORT_SYMBOL_NOVERS(ToLegalChannel);
237#endif
238 229
239#endif 230#endif
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211.h b/drivers/staging/rtl8192su/ieee80211/ieee80211.h
index 5e3a2cbed2b..7d97300924a 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211.h
@@ -27,12 +27,7 @@
27#include <linux/kernel.h> /* ARRAY_SIZE */ 27#include <linux/kernel.h> /* ARRAY_SIZE */
28#include <linux/version.h> 28#include <linux/version.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
31#include <linux/jiffies.h> 30#include <linux/jiffies.h>
32#else
33#include <linux/jffs.h>
34#include <linux/tqueue.h>
35#endif
36#include <linux/timer.h> 31#include <linux/timer.h>
37#include <linux/sched.h> 32#include <linux/sched.h>
38 33
@@ -43,12 +38,6 @@
43#include "rtl819x_BA.h" 38#include "rtl819x_BA.h"
44#include "rtl819x_TS.h" 39#include "rtl819x_TS.h"
45 40
46#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
47#ifndef bool
48typedef enum{false = 0, true} bool;
49#endif
50#endif
51
52#ifndef IW_MODE_MONITOR 41#ifndef IW_MODE_MONITOR
53#define IW_MODE_MONITOR 6 42#define IW_MODE_MONITOR 6
54#endif 43#endif
@@ -57,25 +46,6 @@ typedef enum{false = 0, true} bool;
57#define IWEVCUSTOM 0x8c02 46#define IWEVCUSTOM 0x8c02
58#endif 47#endif
59 48
60#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
61#ifndef __bitwise
62#define __bitwise __attribute__((bitwise))
63#endif
64typedef __u16 __le16;
65#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27))
66struct iw_spy_data{
67 /* --- Standard spy support --- */
68 int spy_number;
69 u_char spy_address[IW_MAX_SPY][ETH_ALEN];
70 struct iw_quality spy_stat[IW_MAX_SPY];
71 /* --- Enhanced spy support (event) */
72 struct iw_quality spy_thr_low; /* Low threshold */
73 struct iw_quality spy_thr_high; /* High threshold */
74 u_char spy_thr_under[IW_MAX_SPY];
75};
76#endif
77#endif
78
79#ifndef container_of 49#ifndef container_of
80/** 50/**
81 * container_of - cast a member of a structure out to the containing structure 51 * container_of - cast a member of a structure out to the containing structure
@@ -456,46 +426,8 @@ typedef struct ieee_param {
456#define IW_QUAL_NOISE_UPDATED 0x4 426#define IW_QUAL_NOISE_UPDATED 0x4
457#endif 427#endif
458 428
459#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
460static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data)
461{
462 task->routine = func;
463 task->data = data;
464 //task->next = NULL;
465 INIT_LIST_HEAD(&task->list);
466 task->sync = 0;
467}
468#endif
469
470// linux under 2.6.9 release may not support it, so modify it for common use
471#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
472//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
473#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
474static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
475{
476 unsigned long timeout = MSECS(msecs) + 1;
477
478 while (timeout) {
479 set_current_state(TASK_INTERRUPTIBLE);
480 timeout = schedule_timeout(timeout);
481 }
482 return timeout;
483}
484#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
485static inline void msleep(unsigned int msecs)
486{
487 unsigned long timeout = MSECS(msecs) + 1;
488
489 while (timeout) {
490 set_current_state(TASK_UNINTERRUPTIBLE);
491 timeout = schedule_timeout(timeout);
492 }
493}
494#endif
495#else
496#define MSECS(t) msecs_to_jiffies(t) 429#define MSECS(t) msecs_to_jiffies(t)
497#define msleep_interruptible_rsl msleep_interruptible 430#define msleep_interruptible_rsl msleep_interruptible
498#endif
499 431
500#define IEEE80211_DATA_LEN 2304 432#define IEEE80211_DATA_LEN 2304
501/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 433/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -1787,21 +1719,6 @@ enum ieee80211_state {
1787#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ 1719#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
1788 IEEE80211_52GHZ_MIN_CHANNEL + 1) 1720 IEEE80211_52GHZ_MIN_CHANNEL + 1)
1789 1721
1790#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
1791extern inline int is_multicast_ether_addr(const u8 *addr)
1792{
1793 return ((addr[0] != 0xff) && (0x01 & addr[0]));
1794}
1795#endif
1796
1797#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
1798extern inline int is_broadcast_ether_addr(const u8 *addr)
1799{
1800 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
1801 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
1802}
1803#endif
1804
1805typedef struct tx_pending_t{ 1722typedef struct tx_pending_t{
1806 int frag; 1723 int frag;
1807 struct ieee80211_txb *txb; 1724 struct ieee80211_txb *txb;
@@ -1879,11 +1796,7 @@ typedef struct _RT_POWER_SAVE_CONTROL
1879 bool bHaltAdapterClkRQ; 1796 bool bHaltAdapterClkRQ;
1880 bool bSwRfProcessing; 1797 bool bSwRfProcessing;
1881 RT_RF_POWER_STATE eInactivePowerState; 1798 RT_RF_POWER_STATE eInactivePowerState;
1882#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1883 struct work_struct InactivePsWorkItem; 1799 struct work_struct InactivePsWorkItem;
1884#else
1885 struct tq_struct InactivePsWorkItem;
1886#endif
1887 struct timer_list InactivePsTimer; 1800 struct timer_list InactivePsTimer;
1888 1801
1889 // Return point for join action 1802 // Return point for join action
@@ -2290,41 +2203,17 @@ struct ieee80211_device {
2290 2203
2291 /* used if IEEE_SOFTMAC_BEACONS is set */ 2204 /* used if IEEE_SOFTMAC_BEACONS is set */
2292 struct timer_list beacon_timer; 2205 struct timer_list beacon_timer;
2293#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2294 struct work_struct associate_complete_wq; 2206 struct work_struct associate_complete_wq;
2295 struct work_struct associate_procedure_wq; 2207 struct work_struct associate_procedure_wq;
2296#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2297 struct delayed_work softmac_scan_wq; 2208 struct delayed_work softmac_scan_wq;
2298 struct delayed_work associate_retry_wq; 2209 struct delayed_work associate_retry_wq;
2299 struct delayed_work start_ibss_wq; 2210 struct delayed_work start_ibss_wq;
2300 struct delayed_work hw_wakeup_wq; 2211 struct delayed_work hw_wakeup_wq;
2301 struct delayed_work hw_sleep_wq; 2212 struct delayed_work hw_sleep_wq;
2302 struct delayed_work link_change_wq; 2213 struct delayed_work link_change_wq;
2303#else
2304 struct work_struct softmac_scan_wq;
2305 struct work_struct associate_retry_wq;
2306 struct work_struct start_ibss_wq;
2307 struct work_struct hw_wakeup_wq;
2308 struct work_struct hw_sleep_wq;
2309 struct work_struct link_change_wq;
2310#endif
2311 struct work_struct wx_sync_scan_wq; 2214 struct work_struct wx_sync_scan_wq;
2312 struct workqueue_struct *wq; 2215 struct workqueue_struct *wq;
2313#else
2314 /* used for periodly scan */
2315 struct timer_list scan_timer;
2316
2317 struct tq_struct associate_complete_wq;
2318 struct tq_struct associate_retry_wq;
2319 struct tq_struct start_ibss_wq;
2320 struct tq_struct associate_procedure_wq;
2321 struct tq_struct softmac_scan_wq;
2322 struct tq_struct wx_sync_scan_wq;
2323 struct tq_struct hw_wakeup_wq;
2324 struct tq_struct hw_sleep_wq;
2325 struct tq_struct link_change_wq;
2326 2216
2327#endif
2328 // Qos related. Added by Annie, 2005-11-01. 2217 // Qos related. Added by Annie, 2005-11-01.
2329 //STA_QOS StaQos; 2218 //STA_QOS StaQos;
2330 2219
@@ -2512,11 +2401,7 @@ struct ieee80211_device {
2512 2401
2513static inline void *ieee80211_priv(struct net_device *dev) 2402static inline void *ieee80211_priv(struct net_device *dev)
2514{ 2403{
2515#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2516 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 2404 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
2517#else
2518 return ((struct ieee80211_device *)dev->priv)->priv;
2519#endif
2520} 2405}
2521 2406
2522extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) 2407extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
@@ -2769,12 +2654,7 @@ extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_reques
2769 union iwreq_data *wrqu, char *b); 2654 union iwreq_data *wrqu, char *b);
2770 2655
2771//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); 2656//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2772#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2773extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); 2657extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
2774#else
2775 extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2776#endif
2777
2778 2658
2779extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 2659extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
2780 struct iw_request_info *info, 2660 struct iw_request_info *info,
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c
index 199ee1695ad..14ffd76e0d7 100644
--- 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(struct ieee80211_device *ieee,
55 55
56 if (entry->ops) { 56 if (entry->ops) {
57 entry->ops->deinit(entry->priv); 57 entry->ops->deinit(entry->priv);
58#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
59 module_put(entry->ops->owner); 58 module_put(entry->ops->owner);
60#else
61 __MOD_DEC_USE_COUNT(entry->ops->owner);
62#endif
63 } 59 }
64 kfree(entry); 60 kfree(entry);
65 } 61 }
@@ -251,7 +247,6 @@ static void __exit ieee80211_crypto_deinit(void)
251 kfree(hcrypt); 247 kfree(hcrypt);
252} 248}
253 249
254#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
255EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); 250EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
256EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); 251EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
257EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); 252EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
@@ -259,15 +254,6 @@ EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
259EXPORT_SYMBOL(ieee80211_register_crypto_ops); 254EXPORT_SYMBOL(ieee80211_register_crypto_ops);
260EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); 255EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
261EXPORT_SYMBOL(ieee80211_get_crypto_ops); 256EXPORT_SYMBOL(ieee80211_get_crypto_ops);
262#else
263EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_entries);
264EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_handler);
265EXPORT_SYMBOL_NOVERS(ieee80211_crypt_delayed_deinit);
266
267EXPORT_SYMBOL_NOVERS(ieee80211_register_crypto_ops);
268EXPORT_SYMBOL_NOVERS(ieee80211_unregister_crypto_ops);
269EXPORT_SYMBOL_NOVERS(ieee80211_get_crypto_ops);
270#endif
271 257
272module_init(ieee80211_crypto_init); 258module_init(ieee80211_crypto_init);
273module_exit(ieee80211_crypto_deinit); 259module_exit(ieee80211_crypto_deinit);
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.h
index a84df4b7648..b58a3bcc0dc 100644
--- 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(struct ieee80211_device *, int);
82void ieee80211_crypt_deinit_handler(unsigned long); 82void ieee80211_crypt_deinit_handler(unsigned long);
83void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, 83void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
84 struct ieee80211_crypt_data **crypt); 84 struct ieee80211_crypt_data **crypt);
85#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
86#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
87#endif
88#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
89#define crypto_alloc_tfm crypto_alloc_tfm_rsl
90#define crypto_free_tfm crypto_free_tfm_rsl
91#endif
92 85
93#endif 86#endif
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c
index a86c26eceb3..e9225fef427 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_ccmp.c
@@ -24,18 +24,8 @@
24 24
25#include "ieee80211.h" 25#include "ieee80211.h"
26 26
27#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
28#include "rtl_crypto.h"
29#else
30#include <linux/crypto.h> 27#include <linux/crypto.h>
31#endif 28#include <linux/scatterlist.h>
32
33#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
34 #include <asm/scatterlist.h>
35#else
36 #include <linux/scatterlist.h>
37#endif
38//#include <asm/scatterlist.h>
39 29
40MODULE_AUTHOR("Jouni Malinen"); 30MODULE_AUTHOR("Jouni Malinen");
41MODULE_DESCRIPTION("Host AP crypt: CCMP"); 31MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -75,21 +65,7 @@ struct ieee80211_ccmp_data {
75void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, 65void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
76 const u8 pt[16], u8 ct[16]) 66 const u8 pt[16], u8 ct[16])
77{ 67{
78#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
79 struct scatterlist src, dst;
80
81 src.page = virt_to_page(pt);
82 src.offset = offset_in_page(pt);
83 src.length = AES_BLOCK_LEN;
84
85 dst.page = virt_to_page(ct);
86 dst.offset = offset_in_page(ct);
87 dst.length = AES_BLOCK_LEN;
88
89 crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
90#else
91 crypto_cipher_encrypt_one((void*)tfm, ct, pt); 68 crypto_cipher_encrypt_one((void*)tfm, ct, pt);
92#endif
93} 69}
94 70
95static void * ieee80211_ccmp_init(int key_idx) 71static void * ieee80211_ccmp_init(int key_idx)
@@ -102,32 +78,20 @@ static void * ieee80211_ccmp_init(int key_idx)
102 memset(priv, 0, sizeof(*priv)); 78 memset(priv, 0, sizeof(*priv));
103 priv->key_idx = key_idx; 79 priv->key_idx = key_idx;
104 80
105#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) 81 priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
106 priv->tfm = crypto_alloc_tfm("aes", 0);
107 if (priv->tfm == NULL) {
108 printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
109 "crypto API aes\n");
110 goto fail;
111 }
112 #else
113 priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
114 if (IS_ERR(priv->tfm)) { 82 if (IS_ERR(priv->tfm)) {
115 printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " 83 printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
116 "crypto API aes\n"); 84 "crypto API aes\n");
117 priv->tfm = NULL; 85 priv->tfm = NULL;
118 goto fail; 86 goto fail;
119 } 87 }
120 #endif 88
121 return priv; 89 return priv;
122 90
123fail: 91fail:
124 if (priv) { 92 if (priv) {
125 if (priv->tfm) 93 if (priv->tfm)
126 #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
127 crypto_free_tfm(priv->tfm);
128 #else
129 crypto_free_cipher((void*)priv->tfm); 94 crypto_free_cipher((void*)priv->tfm);
130 #endif
131 kfree(priv); 95 kfree(priv);
132 } 96 }
133 97
@@ -138,12 +102,9 @@ fail:
138static void ieee80211_ccmp_deinit(void *priv) 102static void ieee80211_ccmp_deinit(void *priv)
139{ 103{
140 struct ieee80211_ccmp_data *_priv = priv; 104 struct ieee80211_ccmp_data *_priv = priv;
105
141 if (_priv && _priv->tfm) 106 if (_priv && _priv->tfm)
142#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
143 crypto_free_tfm(_priv->tfm);
144#else
145 crypto_free_cipher((void*)_priv->tfm); 107 crypto_free_cipher((void*)_priv->tfm);
146#endif
147 kfree(priv); 108 kfree(priv);
148} 109}
149 110
@@ -524,11 +485,7 @@ static void __exit ieee80211_crypto_ccmp_exit(void)
524 ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); 485 ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
525} 486}
526 487
527#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
528EXPORT_SYMBOL(ieee80211_ccmp_null); 488EXPORT_SYMBOL(ieee80211_ccmp_null);
529#else
530EXPORT_SYMBOL_NOVERS(ieee80211_ccmp_null);
531#endif
532 489
533module_init(ieee80211_crypto_ccmp_init); 490module_init(ieee80211_crypto_ccmp_init);
534module_exit(ieee80211_crypto_ccmp_exit); 491module_exit(ieee80211_crypto_ccmp_exit);
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c
index b031b649524..6662d55d221 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_tkip.c
@@ -22,23 +22,9 @@
22#include <asm/string.h> 22#include <asm/string.h>
23 23
24#include "ieee80211.h" 24#include "ieee80211.h"
25#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
26//#include "crypto_compat.h"
27#endif
28
29 25
30#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
31#include "rtl_crypto.h"
32#else
33#include <linux/crypto.h> 26#include <linux/crypto.h>
34#endif 27#include <linux/scatterlist.h>
35//#include <asm/scatterlist.h>
36#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
37 #include <asm/scatterlist.h>
38#else
39 #include <linux/scatterlist.h>
40#endif
41
42#include <linux/crc32.h> 28#include <linux/crc32.h>
43 29
44MODULE_AUTHOR("Jouni Malinen"); 30MODULE_AUTHOR("Jouni Malinen");
@@ -71,17 +57,12 @@ struct ieee80211_tkip_data {
71 u32 dot11RSNAStatsTKIPLocalMICFailures; 57 u32 dot11RSNAStatsTKIPLocalMICFailures;
72 58
73 int key_idx; 59 int key_idx;
74#if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) 60
75 struct crypto_blkcipher *rx_tfm_arc4; 61 struct crypto_blkcipher *rx_tfm_arc4;
76 struct crypto_hash *rx_tfm_michael; 62 struct crypto_hash *rx_tfm_michael;
77 struct crypto_blkcipher *tx_tfm_arc4; 63 struct crypto_blkcipher *tx_tfm_arc4;
78 struct crypto_hash *tx_tfm_michael; 64 struct crypto_hash *tx_tfm_michael;
79#else 65
80 struct crypto_tfm *tx_tfm_arc4;
81 struct crypto_tfm *tx_tfm_michael;
82 struct crypto_tfm *rx_tfm_arc4;
83 struct crypto_tfm *rx_tfm_michael;
84#endif
85 /* scratch buffers for virt_to_page() (crypto API) */ 66 /* scratch buffers for virt_to_page() (crypto API) */
86 u8 rx_hdr[16], tx_hdr[16]; 67 u8 rx_hdr[16], tx_hdr[16];
87}; 68};
@@ -95,35 +76,7 @@ static void * ieee80211_tkip_init(int key_idx)
95 goto fail; 76 goto fail;
96 memset(priv, 0, sizeof(*priv)); 77 memset(priv, 0, sizeof(*priv));
97 priv->key_idx = key_idx; 78 priv->key_idx = key_idx;
98#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
99 priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0);
100 if (priv->tx_tfm_arc4 == NULL) {
101 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
102 "crypto API arc4\n");
103 goto fail;
104 }
105 79
106 priv->tx_tfm_michael = crypto_alloc_tfm("michael_mic", 0);
107 if (priv->tx_tfm_michael == NULL) {
108 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
109 "crypto API michael_mic\n");
110 goto fail;
111 }
112
113 priv->rx_tfm_arc4 = crypto_alloc_tfm("arc4", 0);
114 if (priv->rx_tfm_arc4 == NULL) {
115 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
116 "crypto API arc4\n");
117 goto fail;
118 }
119
120 priv->rx_tfm_michael = crypto_alloc_tfm("michael_mic", 0);
121 if (priv->rx_tfm_michael == NULL) {
122 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
123 "crypto API michael_mic\n");
124 goto fail;
125 }
126#else
127 priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, 80 priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
128 CRYPTO_ALG_ASYNC); 81 CRYPTO_ALG_ASYNC);
129 if (IS_ERR(priv->tx_tfm_arc4)) { 82 if (IS_ERR(priv->tx_tfm_arc4)) {
@@ -159,22 +112,11 @@ static void * ieee80211_tkip_init(int key_idx)
159 priv->rx_tfm_michael = NULL; 112 priv->rx_tfm_michael = NULL;
160 goto fail; 113 goto fail;
161 } 114 }
162#endif 115
163 return priv; 116 return priv;
164 117
165fail: 118fail:
166 if (priv) { 119 if (priv) {
167#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
168 if (priv->tx_tfm_michael)
169 crypto_free_tfm(priv->tx_tfm_michael);
170 if (priv->tx_tfm_arc4)
171 crypto_free_tfm(priv->tx_tfm_arc4);
172 if (priv->rx_tfm_michael)
173 crypto_free_tfm(priv->rx_tfm_michael);
174 if (priv->rx_tfm_arc4)
175 crypto_free_tfm(priv->rx_tfm_arc4);
176
177#else
178 if (priv->tx_tfm_michael) 120 if (priv->tx_tfm_michael)
179 crypto_free_hash(priv->tx_tfm_michael); 121 crypto_free_hash(priv->tx_tfm_michael);
180 if (priv->tx_tfm_arc4) 122 if (priv->tx_tfm_arc4)
@@ -183,7 +125,6 @@ fail:
183 crypto_free_hash(priv->rx_tfm_michael); 125 crypto_free_hash(priv->rx_tfm_michael);
184 if (priv->rx_tfm_arc4) 126 if (priv->rx_tfm_arc4)
185 crypto_free_blkcipher(priv->rx_tfm_arc4); 127 crypto_free_blkcipher(priv->rx_tfm_arc4);
186#endif
187 kfree(priv); 128 kfree(priv);
188 } 129 }
189 130
@@ -194,16 +135,7 @@ fail:
194static void ieee80211_tkip_deinit(void *priv) 135static void ieee80211_tkip_deinit(void *priv)
195{ 136{
196 struct ieee80211_tkip_data *_priv = priv; 137 struct ieee80211_tkip_data *_priv = priv;
197#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) 138
198 if (_priv->tx_tfm_michael)
199 crypto_free_tfm(_priv->tx_tfm_michael);
200 if (_priv->tx_tfm_arc4)
201 crypto_free_tfm(_priv->tx_tfm_arc4);
202 if (_priv->rx_tfm_michael)
203 crypto_free_tfm(_priv->rx_tfm_michael);
204 if (_priv->rx_tfm_arc4)
205 crypto_free_tfm(_priv->rx_tfm_arc4);
206#else
207 if (_priv) { 139 if (_priv) {
208 if (_priv->tx_tfm_michael) 140 if (_priv->tx_tfm_michael)
209 crypto_free_hash(_priv->tx_tfm_michael); 141 crypto_free_hash(_priv->tx_tfm_michael);
@@ -214,7 +146,6 @@ static void ieee80211_tkip_deinit(void *priv)
214 if (_priv->rx_tfm_arc4) 146 if (_priv->rx_tfm_arc4)
215 crypto_free_blkcipher(_priv->rx_tfm_arc4); 147 crypto_free_blkcipher(_priv->rx_tfm_arc4);
216 } 148 }
217#endif
218 kfree(priv); 149 kfree(priv);
219} 150}
220 151
@@ -384,11 +315,8 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
384 u8 *pos; 315 u8 *pos;
385 struct ieee80211_hdr_4addr *hdr; 316 struct ieee80211_hdr_4addr *hdr;
386 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); 317 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
387 318 struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
388 #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
389 struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4};
390 int ret = 0; 319 int ret = 0;
391 #endif
392 u8 rc4key[16], *icv; 320 u8 rc4key[16], *icv;
393 u32 crc; 321 u32 crc;
394 struct scatterlist sg; 322 struct scatterlist sg;
@@ -451,33 +379,14 @@ printk("%x\n", ((u32*)tkey->key)[7]);
451 if (!tcb_desc->bHwSec) 379 if (!tcb_desc->bHwSec)
452 { 380 {
453 icv = skb_put(skb, 4); 381 icv = skb_put(skb, 4);
454#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
455 crc = ~crc32_le(~0, pos, len); 382 crc = ~crc32_le(~0, pos, len);
456#else
457 crc = ~ether_crc_le(len, pos);
458#endif
459 icv[0] = crc; 383 icv[0] = crc;
460 icv[1] = crc >> 8; 384 icv[1] = crc >> 8;
461 icv[2] = crc >> 16; 385 icv[2] = crc >> 16;
462 icv[3] = crc >> 24; 386 icv[3] = crc >> 24;
463#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
464 crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
465 sg.page = virt_to_page(pos);
466 sg.offset = offset_in_page(pos);
467 sg.length = len + 4;
468 crypto_cipher_encrypt(tkey->tx_tfm_arc4, &sg, &sg, len + 4);
469#else
470 crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); 387 crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
471#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 388 sg_init_one(&sg, pos, len + 4);
472 sg.page = virt_to_page(pos);
473 sg.offset = offset_in_page(pos);
474 sg.length = len + 4;
475#else
476 sg_init_one(&sg, pos, len+4);
477#endif
478 ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); 389 ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
479#endif
480
481 } 390 }
482 391
483 tkey->tx_iv16++; 392 tkey->tx_iv16++;
@@ -487,11 +396,7 @@ printk("%x\n", ((u32*)tkey->key)[7]);
487 } 396 }
488 397
489 if (!tcb_desc->bHwSec) 398 if (!tcb_desc->bHwSec)
490#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
491 return 0;
492 #else
493 return ret; 399 return ret;
494 #endif
495 else 400 else
496 return 0; 401 return 0;
497 402
@@ -506,9 +411,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
506 u16 iv16; 411 u16 iv16;
507 struct ieee80211_hdr_4addr *hdr; 412 struct ieee80211_hdr_4addr *hdr;
508 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); 413 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
509 #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) 414 struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
510 struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4};
511 #endif
512 u8 rc4key[16]; 415 u8 rc4key[16];
513 u8 icv[4]; 416 u8 icv[4];
514 u32 crc; 417 u32 crc;
@@ -567,21 +470,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
567 470
568 plen = skb->len - hdr_len - 12; 471 plen = skb->len - hdr_len - 12;
569 472
570#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
571 crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
572 sg.page = virt_to_page(pos);
573 sg.offset = offset_in_page(pos);
574 sg.length = plen + 4;
575 crypto_cipher_decrypt(tkey->rx_tfm_arc4, &sg, &sg, plen + 4);
576#else
577 crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); 473 crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
578#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 474 sg_init_one(&sg, pos, plen + 4);
579 sg.page = virt_to_page(pos); 475
580 sg.offset = offset_in_page(pos);
581 sg.length = plen + 4;
582#else
583 sg_init_one(&sg, pos, plen+4);
584#endif
585 if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { 476 if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) {
586 if (net_ratelimit()) { 477 if (net_ratelimit()) {
587 printk(KERN_DEBUG ": TKIP: failed to decrypt " 478 printk(KERN_DEBUG ": TKIP: failed to decrypt "
@@ -590,13 +481,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
590 } 481 }
591 return -7; 482 return -7;
592 } 483 }
593#endif
594 484
595 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
596 crc = ~crc32_le(~0, pos, plen); 485 crc = ~crc32_le(~0, pos, plen);
597 #else
598 crc = ~ether_crc_le(plen, pos);
599 #endif
600 icv[0] = crc; 486 icv[0] = crc;
601 icv[1] = crc >> 8; 487 icv[1] = crc >> 8;
602 icv[2] = crc >> 16; 488 icv[2] = crc >> 16;
@@ -643,48 +529,6 @@ if( ((u16*)skb->data)[0] & 0x4000){
643 return keyidx; 529 return keyidx;
644} 530}
645 531
646
647#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
648static int michael_mic(struct crypto_tfm * tfm_michael, u8 *key, u8 *hdr,
649 u8 *data, size_t data_len, u8 *mic)
650{
651 struct scatterlist sg[2];
652#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
653 struct hash_desc desc;
654 int ret = 0;
655#endif
656
657 if (tfm_michael == NULL){
658 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
659 return -1;
660 }
661 sg[0].page = virt_to_page(hdr);
662 sg[0].offset = offset_in_page(hdr);
663 sg[0].length = 16;
664
665 sg[1].page = virt_to_page(data);
666 sg[1].offset = offset_in_page(data);
667 sg[1].length = data_len;
668
669
670#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
671 crypto_digest_init(tfm_michael);
672 crypto_digest_setkey(tfm_michael, key, 8);
673 crypto_digest_update(tfm_michael, sg, 2);
674 crypto_digest_final(tfm_michael, mic);
675 return 0;
676#else
677if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
678 return -1;
679
680// return 0;
681 desc.tfm = tkey->tfm_michael;
682 desc.flags = 0;
683 ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
684 return ret;
685#endif
686}
687#else
688static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, 532static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
689 u8 * data, size_t data_len, u8 * mic) 533 u8 * data, size_t data_len, u8 * mic)
690{ 534{
@@ -695,19 +539,10 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
695 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); 539 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
696 return -1; 540 return -1;
697 } 541 }
698#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) 542
699 sg[0].page = virt_to_page(hdr); 543 sg_init_table(sg, 2);
700 sg[0].offset = offset_in_page(hdr); 544 sg_set_buf(&sg[0], hdr, 16);
701 sg[0].length = 16; 545 sg_set_buf(&sg[1], data, data_len);
702
703 sg[1].page = virt_to_page(data);
704 sg[1].offset = offset_in_page(data);
705 sg[1].length = data_len;
706#else
707 sg_init_table(sg, 2);
708 sg_set_buf(&sg[0], hdr, 16);
709 sg_set_buf(&sg[1], data, data_len);
710#endif
711 546
712 if (crypto_hash_setkey(tfm_michael, key, 8)) 547 if (crypto_hash_setkey(tfm_michael, key, 8))
713 return -1; 548 return -1;
@@ -716,9 +551,6 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
716 desc.flags = 0; 551 desc.flags = 0;
717 return crypto_hash_digest(&desc, sg, data_len + 16, mic); 552 return crypto_hash_digest(&desc, sg, data_len + 16, mic);
718} 553}
719#endif
720
721
722 554
723static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) 555static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
724{ 556{
@@ -775,13 +607,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri
775 } 607 }
776 // } 608 // }
777 pos = skb_put(skb, 8); 609 pos = skb_put(skb, 8);
778#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) 610
779 if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
780 skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
781#else
782 if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, 611 if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
783 skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) 612 skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
784#endif
785 return -1; 613 return -1;
786 614
787 return 0; 615 return 0;
@@ -853,13 +681,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
853 } 681 }
854 // } 682 // }
855 683
856#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
857 if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, 684 if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
858 skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) 685 skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
859#else
860 if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
861 skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
862#endif
863 return -1; 686 return -1;
864 if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { 687 if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
865 struct ieee80211_hdr_4addr *hdr; 688 struct ieee80211_hdr_4addr *hdr;
@@ -889,32 +712,18 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
889{ 712{
890 struct ieee80211_tkip_data *tkey = priv; 713 struct ieee80211_tkip_data *tkey = priv;
891 int keyidx; 714 int keyidx;
892#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
893 struct crypto_tfm *tfm = tkey->tx_tfm_michael;
894 struct crypto_tfm *tfm2 = tkey->tx_tfm_arc4;
895 struct crypto_tfm *tfm3 = tkey->rx_tfm_michael;
896 struct crypto_tfm *tfm4 = tkey->rx_tfm_arc4;
897#else
898 struct crypto_hash *tfm = tkey->tx_tfm_michael; 715 struct crypto_hash *tfm = tkey->tx_tfm_michael;
899 struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; 716 struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
900 struct crypto_hash *tfm3 = tkey->rx_tfm_michael; 717 struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
901 struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; 718 struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
902#endif
903 719
904 keyidx = tkey->key_idx; 720 keyidx = tkey->key_idx;
905 memset(tkey, 0, sizeof(*tkey)); 721 memset(tkey, 0, sizeof(*tkey));
906 tkey->key_idx = keyidx; 722 tkey->key_idx = keyidx;
907#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
908 tkey->tx_tfm_michael = tfm; 723 tkey->tx_tfm_michael = tfm;
909 tkey->tx_tfm_arc4 = tfm2; 724 tkey->tx_tfm_arc4 = tfm2;
910 tkey->rx_tfm_michael = tfm3; 725 tkey->rx_tfm_michael = tfm3;
911 tkey->rx_tfm_arc4 = tfm4; 726 tkey->rx_tfm_arc4 = tfm4;
912#else
913 tkey->tx_tfm_michael = tfm;
914 tkey->tx_tfm_arc4 = tfm2;
915 tkey->rx_tfm_michael = tfm3;
916 tkey->rx_tfm_arc4 = tfm4;
917#endif
918 727
919 if (len == TKIP_KEY_LEN) { 728 if (len == TKIP_KEY_LEN) {
920 memcpy(tkey->key, key, TKIP_KEY_LEN); 729 memcpy(tkey->key, key, TKIP_KEY_LEN);
@@ -1024,11 +833,7 @@ void ieee80211_tkip_null(void)
1024// printk("============>%s()\n", __FUNCTION__); 833// printk("============>%s()\n", __FUNCTION__);
1025 return; 834 return;
1026} 835}
1027#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
1028EXPORT_SYMBOL(ieee80211_tkip_null); 836EXPORT_SYMBOL(ieee80211_tkip_null);
1029#else
1030EXPORT_SYMBOL_NOVERS(ieee80211_tkip_null);
1031#endif
1032 837
1033module_init(ieee80211_crypto_tkip_init); 838module_init(ieee80211_crypto_tkip_init);
1034module_exit(ieee80211_crypto_tkip_exit); 839module_exit(ieee80211_crypto_tkip_exit);
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c
index 7e394328ec9..df07212bd17 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_crypt_wep.c
@@ -20,35 +20,10 @@
20 20
21#include "ieee80211.h" 21#include "ieee80211.h"
22 22
23#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
24//#include "crypto_compat.h"
25#endif
26
27
28#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
29#include "rtl_crypto.h"
30#else
31#include <linux/crypto.h> 23#include <linux/crypto.h>
32#endif 24#include <linux/scatterlist.h>
33
34#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
35 #include <asm/scatterlist.h>
36#else
37 #include <linux/scatterlist.h>
38#endif
39//#include <asm/scatterlist.h>
40#include <linux/crc32.h> 25#include <linux/crc32.h>
41//
42/*
43#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
44#include "rtl_crypto.h"
45#else
46#include <linux/crypto.h>
47#endif
48 26
49#include <asm/scatterlist.h>
50#include <linux/crc32.h>
51*/
52MODULE_AUTHOR("Jouni Malinen"); 27MODULE_AUTHOR("Jouni Malinen");
53MODULE_DESCRIPTION("Host AP crypt: WEP"); 28MODULE_DESCRIPTION("Host AP crypt: WEP");
54MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -62,12 +37,8 @@ struct prism2_wep_data {
62 u8 key[WEP_KEY_LEN + 1]; 37 u8 key[WEP_KEY_LEN + 1];
63 u8 key_len; 38 u8 key_len;
64 u8 key_idx; 39 u8 key_idx;
65#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) 40 struct crypto_blkcipher *tx_tfm;
66 struct crypto_tfm *tfm; 41 struct crypto_blkcipher *rx_tfm;
67 #else
68 struct crypto_blkcipher *tx_tfm;
69 struct crypto_blkcipher *rx_tfm;
70 #endif
71}; 42};
72 43
73 44
@@ -81,14 +52,6 @@ static void * prism2_wep_init(int keyidx)
81 memset(priv, 0, sizeof(*priv)); 52 memset(priv, 0, sizeof(*priv));
82 priv->key_idx = keyidx; 53 priv->key_idx = keyidx;
83 54
84#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
85 priv->tfm = crypto_alloc_tfm("arc4", 0);
86 if (priv->tfm == NULL) {
87 printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
88 "crypto API arc4\n");
89 goto fail;
90 }
91 #else
92 priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); 55 priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
93 if (IS_ERR(priv->tx_tfm)) { 56 if (IS_ERR(priv->tx_tfm)) {
94 printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " 57 printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
@@ -103,7 +66,6 @@ static void * prism2_wep_init(int keyidx)
103 priv->rx_tfm = NULL; 66 priv->rx_tfm = NULL;
104 goto fail; 67 goto fail;
105 } 68 }
106 #endif
107 69
108 /* start WEP IV from a random value */ 70 /* start WEP IV from a random value */
109 get_random_bytes(&priv->iv, 4); 71 get_random_bytes(&priv->iv, 4);
@@ -111,13 +73,6 @@ static void * prism2_wep_init(int keyidx)
111 return priv; 73 return priv;
112 74
113fail: 75fail:
114#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
115 if (priv) {
116 if (priv->tfm)
117 crypto_free_tfm(priv->tfm);
118 kfree(priv);
119 }
120 #else
121 if (priv) { 76 if (priv) {
122 if (priv->tx_tfm) 77 if (priv->tx_tfm)
123 crypto_free_blkcipher(priv->tx_tfm); 78 crypto_free_blkcipher(priv->tx_tfm);
@@ -125,7 +80,7 @@ fail:
125 crypto_free_blkcipher(priv->rx_tfm); 80 crypto_free_blkcipher(priv->rx_tfm);
126 kfree(priv); 81 kfree(priv);
127 } 82 }
128 #endif 83
129 return NULL; 84 return NULL;
130} 85}
131 86
@@ -133,17 +88,13 @@ fail:
133static void prism2_wep_deinit(void *priv) 88static void prism2_wep_deinit(void *priv)
134{ 89{
135 struct prism2_wep_data *_priv = priv; 90 struct prism2_wep_data *_priv = priv;
136#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) 91
137 if (_priv && _priv->tfm)
138 crypto_free_tfm(_priv->tfm);
139 #else
140 if (_priv) { 92 if (_priv) {
141 if (_priv->tx_tfm) 93 if (_priv->tx_tfm)
142 crypto_free_blkcipher(_priv->tx_tfm); 94 crypto_free_blkcipher(_priv->tx_tfm);
143 if (_priv->rx_tfm) 95 if (_priv->rx_tfm)
144 crypto_free_blkcipher(_priv->rx_tfm); 96 crypto_free_blkcipher(_priv->rx_tfm);
145 } 97 }
146 #endif
147 kfree(priv); 98 kfree(priv);
148} 99}
149 100
@@ -160,9 +111,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
160 u8 key[WEP_KEY_LEN + 3]; 111 u8 key[WEP_KEY_LEN + 3];
161 u8 *pos; 112 u8 *pos;
162 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); 113 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
163 #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) 114 struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
164 struct blkcipher_desc desc = {.tfm = wep->tx_tfm};
165 #endif
166 u32 crc; 115 u32 crc;
167 u8 *icv; 116 u8 *icv;
168 struct scatterlist sg; 117 struct scatterlist sg;
@@ -201,35 +150,17 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
201 { 150 {
202 151
203 /* Append little-endian CRC32 and encrypt it to produce ICV */ 152 /* Append little-endian CRC32 and encrypt it to produce ICV */
204 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
205 crc = ~crc32_le(~0, pos, len); 153 crc = ~crc32_le(~0, pos, len);
206 #else
207 crc = ~ether_crc_le(len, pos);
208 #endif
209 icv = skb_put(skb, 4); 154 icv = skb_put(skb, 4);
210 icv[0] = crc; 155 icv[0] = crc;
211 icv[1] = crc >> 8; 156 icv[1] = crc >> 8;
212 icv[2] = crc >> 16; 157 icv[2] = crc >> 16;
213 icv[3] = crc >> 24; 158 icv[3] = crc >> 24;
214 159
215#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
216 crypto_cipher_setkey(wep->tfm, key, klen);
217 sg.page = virt_to_page(pos);
218 sg.offset = offset_in_page(pos);
219 sg.length = len + 4;
220 crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
221 return 0;
222 #else
223 crypto_blkcipher_setkey(wep->tx_tfm, key, klen); 160 crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
224 #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
225 sg.page = virt_to_page(pos);
226 sg.offset = offset_in_page(pos);
227 sg.length = len + 4;
228 #else
229 sg_init_one(&sg, pos, len+4); 161 sg_init_one(&sg, pos, len+4);
230 #endif 162
231 return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); 163 return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
232 #endif
233 } 164 }
234 165
235 return 0; 166 return 0;
@@ -250,9 +181,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
250 u8 key[WEP_KEY_LEN + 3]; 181 u8 key[WEP_KEY_LEN + 3];
251 u8 keyidx, *pos; 182 u8 keyidx, *pos;
252 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); 183 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
253 #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) 184 struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
254 struct blkcipher_desc desc = {.tfm = wep->rx_tfm};
255 #endif
256 u32 crc; 185 u32 crc;
257 u8 icv[4]; 186 u8 icv[4];
258 struct scatterlist sg; 187 struct scatterlist sg;
@@ -277,29 +206,13 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
277 206
278 if (!tcb_desc->bHwSec) 207 if (!tcb_desc->bHwSec)
279 { 208 {
280#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
281 crypto_cipher_setkey(wep->tfm, key, klen);
282 sg.page = virt_to_page(pos);
283 sg.offset = offset_in_page(pos);
284 sg.length = plen + 4;
285 crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
286 #else
287 crypto_blkcipher_setkey(wep->rx_tfm, key, klen); 209 crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
288 #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 210 sg_init_one(&sg, pos, plen + 4);
289 sg.page = virt_to_page(pos); 211
290 sg.offset = offset_in_page(pos);
291 sg.length = plen + 4;
292 #else
293 sg_init_one(&sg, pos, plen+4);
294 #endif
295 if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) 212 if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
296 return -7; 213 return -7;
297 #endif 214
298 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
299 crc = ~crc32_le(~0, pos, plen); 215 crc = ~crc32_le(~0, pos, plen);
300 #else
301 crc = ~ether_crc_le(plen, pos);
302 #endif
303 icv[0] = crc; 216 icv[0] = crc;
304 icv[1] = crc >> 8; 217 icv[1] = crc >> 8;
305 icv[2] = crc >> 16; 218 icv[2] = crc >> 16;
@@ -387,11 +300,7 @@ void ieee80211_wep_null(void)
387// printk("============>%s()\n", __FUNCTION__); 300// printk("============>%s()\n", __FUNCTION__);
388 return; 301 return;
389} 302}
390#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
391EXPORT_SYMBOL(ieee80211_wep_null); 303EXPORT_SYMBOL(ieee80211_wep_null);
392#else
393EXPORT_SYMBOL_NOVERS(ieee80211_wep_null);
394#endif
395 304
396module_init(ieee80211_crypto_wep_init); 305module_init(ieee80211_crypto_wep_init);
397module_exit(ieee80211_crypto_wep_exit); 306module_exit(ieee80211_crypto_wep_exit);
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
index 759032db4a3..b85ffa0e83c 100644
--- 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 sizeof_priv)
113 goto failed; 113 goto failed;
114 } 114 }
115 115
116#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
117 ieee = netdev_priv(dev); 116 ieee = netdev_priv(dev);
118#else
119 ieee = (struct ieee80211_device *)dev->priv;
120#endif
121
122 memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); 117 memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv);
123 ieee->dev = dev; 118 ieee->dev = dev;
124 119
@@ -166,12 +161,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
166 161
167 ieee80211_softmac_init(ieee); 162 ieee80211_softmac_init(ieee);
168 163
169#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
170 ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); 164 ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
171#else
172 ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kmalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
173 memset(ieee->pHTInfo,0,sizeof(RT_HIGH_THROUGHPUT));
174#endif
175 if (ieee->pHTInfo == NULL) 165 if (ieee->pHTInfo == NULL)
176 { 166 {
177 IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n"); 167 IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n");
@@ -181,11 +171,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
181 HTInitializeHTInfo(ieee); //may move to other place. 171 HTInitializeHTInfo(ieee); //may move to other place.
182 TSInitialize(ieee); 172 TSInitialize(ieee);
183#if 0 173#if 0
184#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
185 INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq); 174 INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq);
186#else
187 INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq, ieee);
188#endif
189#endif 175#endif
190 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) 176 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
191 INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); 177 INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -205,22 +191,15 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
205 191
206 failed: 192 failed:
207 if (dev) 193 if (dev)
208#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
209 free_netdev(dev); 194 free_netdev(dev);
210#else 195
211 kfree(dev);
212#endif
213 return NULL; 196 return NULL;
214} 197}
215 198
216 199
217void free_ieee80211(struct net_device *dev) 200void free_ieee80211(struct net_device *dev)
218{ 201{
219#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
220 struct ieee80211_device *ieee = netdev_priv(dev); 202 struct ieee80211_device *ieee = netdev_priv(dev);
221#else
222 struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
223#endif
224 int i; 203 int i;
225 //struct list_head *p, *q; 204 //struct list_head *p, *q;
226// del_timer_sync(&ieee->SwBwTimer); 205// del_timer_sync(&ieee->SwBwTimer);
@@ -241,11 +220,7 @@ void free_ieee80211(struct net_device *dev)
241 if (crypt) { 220 if (crypt) {
242 if (crypt->ops) { 221 if (crypt->ops) {
243 crypt->ops->deinit(crypt->priv); 222 crypt->ops->deinit(crypt->priv);
244#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
245 module_put(crypt->ops->owner); 223 module_put(crypt->ops->owner);
246#else
247 __MOD_DEC_USE_COUNT(crypt->ops->owner);
248#endif
249 } 224 }
250 kfree(crypt); 225 kfree(crypt);
251 ieee->crypt[i] = NULL; 226 ieee->crypt[i] = NULL;
@@ -262,11 +237,7 @@ void free_ieee80211(struct net_device *dev)
262 } 237 }
263 238
264#endif 239#endif
265#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
266 free_netdev(dev); 240 free_netdev(dev);
267#else
268 kfree(dev);
269#endif
270} 241}
271 242
272#ifdef CONFIG_IEEE80211_DEBUG 243#ifdef CONFIG_IEEE80211_DEBUG
@@ -332,11 +303,8 @@ static int __init ieee80211_init(void)
332 struct proc_dir_entry *e; 303 struct proc_dir_entry *e;
333 304
334 ieee80211_debug_level = debug; 305 ieee80211_debug_level = debug;
335#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 306
336 ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net);
337#else
338 ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); 307 ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net);
339#endif
340 if (ieee80211_proc == NULL) { 308 if (ieee80211_proc == NULL) {
341 IEEE80211_ERROR("Unable to create " DRV_NAME 309 IEEE80211_ERROR("Unable to create " DRV_NAME
342 " proc directory\n"); 310 " proc directory\n");
@@ -345,11 +313,7 @@ static int __init ieee80211_init(void)
345 e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, 313 e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR,
346 ieee80211_proc); 314 ieee80211_proc);
347 if (!e) { 315 if (!e) {
348#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
349 remove_proc_entry(DRV_NAME, proc_net);
350#else
351 remove_proc_entry(DRV_NAME, init_net.proc_net); 316 remove_proc_entry(DRV_NAME, init_net.proc_net);
352#endif
353 ieee80211_proc = NULL; 317 ieee80211_proc = NULL;
354 return -EIO; 318 return -EIO;
355 } 319 }
@@ -364,16 +328,11 @@ static void __exit ieee80211_exit(void)
364{ 328{
365 if (ieee80211_proc) { 329 if (ieee80211_proc) {
366 remove_proc_entry("debug_level", ieee80211_proc); 330 remove_proc_entry("debug_level", ieee80211_proc);
367#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
368 remove_proc_entry(DRV_NAME, proc_net);
369#else
370 remove_proc_entry(DRV_NAME, init_net.proc_net); 331 remove_proc_entry(DRV_NAME, init_net.proc_net);
371#endif
372 ieee80211_proc = NULL; 332 ieee80211_proc = NULL;
373 } 333 }
374} 334}
375 335
376#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
377#include <linux/moduleparam.h> 336#include <linux/moduleparam.h>
378module_param(debug, int, 0444); 337module_param(debug, int, 0444);
379MODULE_PARM_DESC(debug, "debug output mask"); 338MODULE_PARM_DESC(debug, "debug output mask");
@@ -382,12 +341,6 @@ MODULE_PARM_DESC(debug, "debug output mask");
382module_exit(ieee80211_exit); 341module_exit(ieee80211_exit);
383module_init(ieee80211_init); 342module_init(ieee80211_init);
384#endif 343#endif
385#endif
386 344
387#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
388EXPORT_SYMBOL(alloc_ieee80211); 345EXPORT_SYMBOL(alloc_ieee80211);
389EXPORT_SYMBOL(free_ieee80211); 346EXPORT_SYMBOL(free_ieee80211);
390#else
391EXPORT_SYMBOL_NOVERS(alloc_ieee80211);
392EXPORT_SYMBOL_NOVERS(free_ieee80211);
393#endif
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
index 2b2ffd34bc9..bbc9759e2c3 100644
--- 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(struct ieee80211_device *ieee,
55 u16 fc = le16_to_cpu(hdr->frame_ctl); 55 u16 fc = le16_to_cpu(hdr->frame_ctl);
56 56
57 skb->dev = ieee->dev; 57 skb->dev = ieee->dev;
58#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
59 skb_reset_mac_header(skb); 58 skb_reset_mac_header(skb);
60#else
61 skb->mac.raw = skb->data;
62#endif
63 59
64 skb_pull(skb, ieee80211_get_hdrlen(fc)); 60 skb_pull(skb, ieee80211_get_hdrlen(fc));
65 skb->pkt_type = PACKET_OTHERHOST; 61 skb->pkt_type = PACKET_OTHERHOST;
@@ -2823,10 +2819,5 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,
2823 } 2819 }
2824} 2820}
2825 2821
2826#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
2827EXPORT_SYMBOL(ieee80211_rx_mgt); 2822EXPORT_SYMBOL(ieee80211_rx_mgt);
2828EXPORT_SYMBOL(ieee80211_rx); 2823EXPORT_SYMBOL(ieee80211_rx);
2829#else
2830EXPORT_SYMBOL_NOVERS(ieee80211_rx_mgt);
2831EXPORT_SYMBOL_NOVERS(ieee80211_rx);
2832#endif
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
index 6773e84c778..e25247e8ea5 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
@@ -512,34 +512,10 @@ out:
512} 512}
513} 513}
514 514
515#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
516/* called both by wq with ieee->lock held */
517void ieee80211_softmac_scan(struct ieee80211_device *ieee)
518{
519#if 0
520 short watchdog = 0;
521 do{
522 ieee->current_network.channel =
523 (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
524 if (watchdog++ > MAX_CHANNEL_NUMBER)
525 return; /* no good chans */
526
527 }while(!ieee->channel_map[ieee->current_network.channel]);
528#endif
529
530 schedule_task(&ieee->softmac_scan_wq);
531}
532#endif
533
534#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
535void ieee80211_softmac_scan_wq(struct work_struct *work) 515void ieee80211_softmac_scan_wq(struct work_struct *work)
536{ 516{
537 struct delayed_work *dwork = container_of(work, struct delayed_work, work); 517 struct delayed_work *dwork = container_of(work, struct delayed_work, work);
538 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); 518 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
539#else
540void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
541{
542#endif
543 u8 last_channel = ieee->current_network.channel; //recored init channel inorder not change current channel when comming out the scan unexpectedly. WB. 519 u8 last_channel = ieee->current_network.channel; //recored init channel inorder not change current channel when comming out the scan unexpectedly. WB.
544#ifdef ENABLE_DOT11D 520#ifdef ENABLE_DOT11D
545 u8 channel_map[MAX_CHANNEL_NUMBER+1]; 521 u8 channel_map[MAX_CHANNEL_NUMBER+1];
@@ -575,14 +551,7 @@ void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
575#endif 551#endif
576 ieee80211_send_probe_requests(ieee); 552 ieee80211_send_probe_requests(ieee);
577 553
578
579#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
580 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); 554 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
581#else
582 //ieee->scan_timer.expires = jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME);
583 if (ieee->scanning == 1)
584 mod_timer(&ieee->scan_timer,(jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME)));
585#endif
586 555
587 up(&ieee->scan_sem); 556 up(&ieee->scan_sem);
588 return; 557 return;
@@ -598,19 +567,6 @@ out:
598 up(&ieee->scan_sem); 567 up(&ieee->scan_sem);
599} 568}
600 569
601#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
602void ieee80211_softmac_scan_cb(unsigned long _dev)
603{
604 unsigned long flags;
605 struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
606
607 spin_lock_irqsave(&ieee->lock, flags);
608 ieee80211_softmac_scan(ieee);
609 spin_unlock_irqrestore(&ieee->lock, flags);
610}
611#endif
612
613
614void ieee80211_beacons_start(struct ieee80211_device *ieee) 570void ieee80211_beacons_start(struct ieee80211_device *ieee)
615{ 571{
616 unsigned long flags; 572 unsigned long flags;
@@ -666,11 +622,7 @@ void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
666 if (ieee->scanning == 1){ 622 if (ieee->scanning == 1){
667 ieee->scanning = 0; 623 ieee->scanning = 0;
668 624
669#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
670 cancel_delayed_work(&ieee->softmac_scan_wq); 625 cancel_delayed_work(&ieee->softmac_scan_wq);
671#else
672 del_timer_sync(&ieee->scan_timer);
673#endif
674 } 626 }
675 627
676// spin_unlock_irqrestore(&ieee->lock, flags); 628// spin_unlock_irqrestore(&ieee->lock, flags);
@@ -700,16 +652,7 @@ void ieee80211_start_scan(struct ieee80211_device *ieee)
700 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ 652 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
701 if (ieee->scanning == 0){ 653 if (ieee->scanning == 0){
702 ieee->scanning = 1; 654 ieee->scanning = 1;
703#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
704#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
705 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); 655 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
706#else
707
708 queue_work(ieee->wq, &ieee->softmac_scan_wq);
709#endif
710#else
711 ieee80211_softmac_scan(ieee);
712#endif
713 } 656 }
714 }else 657 }else
715 ieee->start_scan(ieee->dev); 658 ieee->start_scan(ieee->dev);
@@ -1390,12 +1333,8 @@ void ieee80211_associate_abort(struct ieee80211_device *ieee)
1390 1333
1391 ieee->state = IEEE80211_ASSOCIATING_RETRY; 1334 ieee->state = IEEE80211_ASSOCIATING_RETRY;
1392 1335
1393#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1394 queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \ 1336 queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \
1395 IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); 1337 IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
1396#else
1397 schedule_task(&ieee->associate_retry_wq);
1398#endif
1399 1338
1400 spin_unlock_irqrestore(&ieee->lock, flags); 1339 spin_unlock_irqrestore(&ieee->lock, flags);
1401} 1340}
@@ -1489,14 +1428,11 @@ void ieee80211_associate_step2(struct ieee80211_device *ieee)
1489 //dev_kfree_skb_any(skb);//edit by thomas 1428 //dev_kfree_skb_any(skb);//edit by thomas
1490 } 1429 }
1491} 1430}
1492#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 1431
1493void ieee80211_associate_complete_wq(struct work_struct *work) 1432void ieee80211_associate_complete_wq(struct work_struct *work)
1494{ 1433{
1495 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); 1434 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
1496#else 1435
1497void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
1498{
1499#endif
1500 printk(KERN_INFO "Associated successfully\n"); 1436 printk(KERN_INFO "Associated successfully\n");
1501 ieee->is_roaming = false; 1437 ieee->is_roaming = false;
1502 if(ieee80211_is_54g(ieee->current_network) && 1438 if(ieee80211_is_54g(ieee->current_network) &&
@@ -1568,21 +1504,13 @@ void ieee80211_associate_complete(struct ieee80211_device *ieee)
1568 } 1504 }
1569#endif 1505#endif
1570 //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet); 1506 //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet);
1571#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1572 queue_work(ieee->wq, &ieee->associate_complete_wq); 1507 queue_work(ieee->wq, &ieee->associate_complete_wq);
1573#else
1574 schedule_task(&ieee->associate_complete_wq);
1575#endif
1576} 1508}
1577 1509
1578#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1579void ieee80211_associate_procedure_wq(struct work_struct *work) 1510void ieee80211_associate_procedure_wq(struct work_struct *work)
1580{ 1511{
1581 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); 1512 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
1582#else 1513
1583void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
1584{
1585#endif
1586 ieee->sync_scan_hurryup = 1; 1514 ieee->sync_scan_hurryup = 1;
1587 down(&ieee->wx_sem); 1515 down(&ieee->wx_sem);
1588 1516
@@ -1682,11 +1610,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
1682 ieee->state = IEEE80211_ASSOCIATING; 1610 ieee->state = IEEE80211_ASSOCIATING;
1683 if(ieee->LedControlHandler != NULL) 1611 if(ieee->LedControlHandler != NULL)
1684 ieee->LedControlHandler(ieee->dev, LED_CTL_START_TO_LINK); 1612 ieee->LedControlHandler(ieee->dev, LED_CTL_START_TO_LINK);
1685#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1686 queue_work(ieee->wq, &ieee->associate_procedure_wq); 1613 queue_work(ieee->wq, &ieee->associate_procedure_wq);
1687#else
1688 schedule_task(&ieee->associate_procedure_wq);
1689#endif
1690 }else{ 1614 }else{
1691 if(ieee80211_is_54g(ieee->current_network) && 1615 if(ieee80211_is_54g(ieee->current_network) &&
1692 (ieee->modulation & IEEE80211_OFDM_MODULATION)){ 1616 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
@@ -2194,11 +2118,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
2194 "Association response status code 0x%x\n", 2118 "Association response status code 0x%x\n",
2195 errcode); 2119 errcode);
2196 if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) { 2120 if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) {
2197#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2198 queue_work(ieee->wq, &ieee->associate_procedure_wq); 2121 queue_work(ieee->wq, &ieee->associate_procedure_wq);
2199#else
2200 schedule_task(&ieee->associate_procedure_wq);
2201#endif
2202 } else { 2122 } else {
2203 ieee80211_associate_abort(ieee); 2123 ieee80211_associate_abort(ieee);
2204 } 2124 }
@@ -2310,11 +2230,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
2310 RemovePeerTS(ieee, header->addr2); 2230 RemovePeerTS(ieee, header->addr2);
2311 if(ieee->LedControlHandler != NULL) 2231 if(ieee->LedControlHandler != NULL)
2312 ieee->LedControlHandler(ieee->dev, LED_CTL_START_TO_LINK); //added by amy for LED 090318 2232 ieee->LedControlHandler(ieee->dev, LED_CTL_START_TO_LINK); //added by amy for LED 090318
2313#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2314 queue_work(ieee->wq, &ieee->associate_procedure_wq); 2233 queue_work(ieee->wq, &ieee->associate_procedure_wq);
2315#else
2316 schedule_task(&ieee->associate_procedure_wq);
2317#endif
2318 } 2234 }
2319 break; 2235 break;
2320 case IEEE80211_STYPE_MANAGE_ACT: 2236 case IEEE80211_STYPE_MANAGE_ACT:
@@ -2551,16 +2467,12 @@ void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
2551 netif_carrier_on(ieee->dev); 2467 netif_carrier_on(ieee->dev);
2552 } 2468 }
2553} 2469}
2554#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 2470
2555void ieee80211_start_ibss_wq(struct work_struct *work) 2471void ieee80211_start_ibss_wq(struct work_struct *work)
2556{ 2472{
2557 2473
2558 struct delayed_work *dwork = container_of(work, struct delayed_work, work); 2474 struct delayed_work *dwork = container_of(work, struct delayed_work, work);
2559 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); 2475 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq);
2560#else
2561void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
2562{
2563#endif
2564 /* iwconfig mode ad-hoc will schedule this and return 2476 /* iwconfig mode ad-hoc will schedule this and return
2565 * on the other hand this will block further iwconfig SET 2477 * on the other hand this will block further iwconfig SET
2566 * operations because of the wx_sem hold. 2478 * operations because of the wx_sem hold.
@@ -2673,11 +2585,7 @@ void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
2673 2585
2674inline void ieee80211_start_ibss(struct ieee80211_device *ieee) 2586inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
2675{ 2587{
2676#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2677 queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150); 2588 queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150);
2678#else
2679 schedule_task(&ieee->start_ibss_wq);
2680#endif
2681} 2589}
2682 2590
2683/* this is called only in user context, with wx_sem held */ 2591/* this is called only in user context, with wx_sem held */
@@ -2720,15 +2628,11 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
2720 spin_unlock_irqrestore(&ieee->lock, flags); 2628 spin_unlock_irqrestore(&ieee->lock, flags);
2721} 2629}
2722 2630
2723#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2724void ieee80211_link_change_wq(struct work_struct *work) 2631void ieee80211_link_change_wq(struct work_struct *work)
2725{ 2632{
2726 struct delayed_work *dwork = container_of(work, struct delayed_work, work); 2633 struct delayed_work *dwork = container_of(work, struct delayed_work, work);
2727 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, link_change_wq); 2634 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, link_change_wq);
2728#else 2635
2729void ieee80211_link_change_wq(struct ieee80211_device *ieee)
2730{
2731#endif
2732 ieee->link_change(ieee->dev); 2636 ieee->link_change(ieee->dev);
2733} 2637}
2734/* called only in userspace context */ 2638/* called only in userspace context */
@@ -2751,25 +2655,17 @@ void ieee80211_disassociate(struct ieee80211_device *ieee)
2751 2655
2752 //LZM for usb dev crash. 2656 //LZM for usb dev crash.
2753 //ieee->link_change(ieee->dev); 2657 //ieee->link_change(ieee->dev);
2754#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2755 queue_delayed_work(ieee->wq, &ieee->link_change_wq, 0); 2658 queue_delayed_work(ieee->wq, &ieee->link_change_wq, 0);
2756#else
2757 schedule_task(&ieee->link_change_wq);
2758#endif
2759 2659
2760 //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); 2660 //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
2761 notify_wx_assoc_event(ieee); 2661 notify_wx_assoc_event(ieee);
2762 2662
2763} 2663}
2764#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 2664
2765void ieee80211_associate_retry_wq(struct work_struct *work) 2665void ieee80211_associate_retry_wq(struct work_struct *work)
2766{ 2666{
2767 struct delayed_work *dwork = container_of(work, struct delayed_work, work); 2667 struct delayed_work *dwork = container_of(work, struct delayed_work, work);
2768 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); 2668 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
2769#else
2770void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
2771{
2772#endif
2773 unsigned long flags; 2669 unsigned long flags;
2774 2670
2775 down(&ieee->wx_sem); 2671 down(&ieee->wx_sem);
@@ -2868,11 +2764,9 @@ void ieee80211_stop_protocol(struct ieee80211_device *ieee)
2868 2764
2869 ieee80211_stop_send_beacons(ieee); 2765 ieee80211_stop_send_beacons(ieee);
2870 del_timer_sync(&ieee->associate_timer); 2766 del_timer_sync(&ieee->associate_timer);
2871#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2872 cancel_delayed_work(&ieee->associate_retry_wq); 2767 cancel_delayed_work(&ieee->associate_retry_wq);
2873 cancel_delayed_work(&ieee->start_ibss_wq); 2768 cancel_delayed_work(&ieee->start_ibss_wq);
2874 cancel_delayed_work(&ieee->link_change_wq); 2769 cancel_delayed_work(&ieee->link_change_wq);
2875#endif
2876 ieee80211_stop_scan(ieee); 2770 ieee80211_stop_scan(ieee);
2877 2771
2878 ieee80211_disassociate(ieee); 2772 ieee80211_disassociate(ieee);
@@ -2990,11 +2884,6 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
2990 ieee->sta_edca_param[3] = 0x002F3262; 2884 ieee->sta_edca_param[3] = 0x002F3262;
2991 ieee->aggregation = true; 2885 ieee->aggregation = true;
2992 ieee->enable_rx_imm_BA = 1; 2886 ieee->enable_rx_imm_BA = 1;
2993#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
2994 init_timer(&ieee->scan_timer);
2995 ieee->scan_timer.data = (unsigned long)ieee;
2996 ieee->scan_timer.function = ieee80211_softmac_scan_cb;
2997#endif
2998 ieee->tx_pending.txb = NULL; 2887 ieee->tx_pending.txb = NULL;
2999 2888
3000 init_timer(&ieee->associate_timer); 2889 init_timer(&ieee->associate_timer);
@@ -3005,16 +2894,12 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
3005 ieee->beacon_timer.data = (unsigned long) ieee; 2894 ieee->beacon_timer.data = (unsigned long) ieee;
3006 ieee->beacon_timer.function = ieee80211_send_beacon_cb; 2895 ieee->beacon_timer.function = ieee80211_send_beacon_cb;
3007 2896
3008#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3009#ifdef PF_SYNCTHREAD 2897#ifdef PF_SYNCTHREAD
3010 ieee->wq = create_workqueue(DRV_NAME,0); 2898 ieee->wq = create_workqueue(DRV_NAME,0);
3011#else 2899#else
3012 ieee->wq = create_workqueue(DRV_NAME); 2900 ieee->wq = create_workqueue(DRV_NAME);
3013#endif 2901#endif
3014#endif
3015 2902
3016#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3017#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
3018 INIT_DELAYED_WORK(&ieee->link_change_wq,ieee80211_link_change_wq); 2903 INIT_DELAYED_WORK(&ieee->link_change_wq,ieee80211_link_change_wq);
3019 INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq); 2904 INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq);
3020 INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); 2905 INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq);
@@ -3023,25 +2908,6 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
3023 INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq); 2908 INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq);
3024 INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq); 2909 INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq);
3025 2910
3026#else
3027 INIT_WORK(&ieee->link_change_wq,(void(*)(void*)) ieee80211_link_change_wq,ieee);
3028 INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
3029 INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
3030 INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
3031 INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
3032 INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
3033 INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
3034#endif
3035
3036#else
3037 tq_init(&ieee->link_change_wq,(void(*)(void*)) ieee80211_link_change_wq,ieee);
3038 tq_init(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
3039 tq_init(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
3040 tq_init(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
3041 tq_init(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
3042 tq_init(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
3043 tq_init(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
3044#endif
3045 sema_init(&ieee->wx_sem, 1); 2911 sema_init(&ieee->wx_sem, 1);
3046 sema_init(&ieee->scan_sem, 1); 2912 sema_init(&ieee->scan_sem, 1);
3047 2913
@@ -3066,10 +2932,8 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee)
3066#endif 2932#endif
3067 del_timer_sync(&ieee->associate_timer); 2933 del_timer_sync(&ieee->associate_timer);
3068 2934
3069#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3070 cancel_delayed_work(&ieee->associate_retry_wq); 2935 cancel_delayed_work(&ieee->associate_retry_wq);
3071 destroy_workqueue(ieee->wq); 2936 destroy_workqueue(ieee->wq);
3072#endif
3073 2937
3074 up(&ieee->wx_sem); 2938 up(&ieee->wx_sem);
3075} 2939}
@@ -3347,11 +3211,8 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
3347 } 3211 }
3348 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 3212 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
3349 new_crypt->ops = ops; 3213 new_crypt->ops = ops;
3350#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) 3214
3351 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 3215 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
3352#else
3353 if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
3354#endif
3355 new_crypt->priv = 3216 new_crypt->priv =
3356 new_crypt->ops->init(param->u.crypt.idx); 3217 new_crypt->ops->init(param->u.crypt.idx);
3357 3218
@@ -3534,7 +3395,6 @@ void notify_wx_assoc_event(struct ieee80211_device *ieee)
3534 wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); 3395 wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL);
3535} 3396}
3536 3397
3537#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
3538EXPORT_SYMBOL(ieee80211_get_beacon); 3398EXPORT_SYMBOL(ieee80211_get_beacon);
3539EXPORT_SYMBOL(ieee80211_wake_queue); 3399EXPORT_SYMBOL(ieee80211_wake_queue);
3540EXPORT_SYMBOL(ieee80211_stop_queue); 3400EXPORT_SYMBOL(ieee80211_stop_queue);
@@ -3555,26 +3415,4 @@ EXPORT_SYMBOL(ieee80211_stop_scan);
3555EXPORT_SYMBOL(ieee80211_send_probe_requests); 3415EXPORT_SYMBOL(ieee80211_send_probe_requests);
3556EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); 3416EXPORT_SYMBOL(ieee80211_softmac_scan_syncro);
3557EXPORT_SYMBOL(ieee80211_start_scan_syncro); 3417EXPORT_SYMBOL(ieee80211_start_scan_syncro);
3558#else
3559EXPORT_SYMBOL_NOVERS(ieee80211_get_beacon);
3560EXPORT_SYMBOL_NOVERS(ieee80211_wake_queue);
3561EXPORT_SYMBOL_NOVERS(ieee80211_stop_queue);
3562EXPORT_SYMBOL_NOVERS(ieee80211_reset_queue);
3563EXPORT_SYMBOL_NOVERS(ieee80211_softmac_stop_protocol);
3564EXPORT_SYMBOL_NOVERS(ieee80211_softmac_start_protocol);
3565EXPORT_SYMBOL_NOVERS(ieee80211_is_shortslot);
3566EXPORT_SYMBOL_NOVERS(ieee80211_is_54g);
3567EXPORT_SYMBOL_NOVERS(ieee80211_wpa_supplicant_ioctl);
3568EXPORT_SYMBOL_NOVERS(ieee80211_ps_tx_ack);
3569EXPORT_SYMBOL_NOVERS(ieee80211_softmac_xmit);
3570EXPORT_SYMBOL_NOVERS(ieee80211_stop_send_beacons);
3571EXPORT_SYMBOL_NOVERS(notify_wx_assoc_event);
3572EXPORT_SYMBOL_NOVERS(SendDisassociation);
3573EXPORT_SYMBOL_NOVERS(ieee80211_disassociate);
3574EXPORT_SYMBOL_NOVERS(ieee80211_start_send_beacons);
3575EXPORT_SYMBOL_NOVERS(ieee80211_stop_scan);
3576EXPORT_SYMBOL_NOVERS(ieee80211_send_probe_requests);
3577EXPORT_SYMBOL_NOVERS(ieee80211_softmac_scan_syncro);
3578EXPORT_SYMBOL_NOVERS(ieee80211_start_scan_syncro);
3579#endif
3580//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); 3418//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c
index 191dc3fbbe3..0f668d1c1bb 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c
@@ -313,14 +313,9 @@ out:
313 return 0; 313 return 0;
314} 314}
315 315
316#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
317void ieee80211_wx_sync_scan_wq(struct work_struct *work) 316void ieee80211_wx_sync_scan_wq(struct work_struct *work)
318{ 317{
319 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); 318 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
320#else
321void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
322{
323#endif
324 short chan; 319 short chan;
325 HT_EXTCHNL_OFFSET chan_offset=0; 320 HT_EXTCHNL_OFFSET chan_offset=0;
326 HT_CHANNEL_WIDTH bandwidth=0; 321 HT_CHANNEL_WIDTH bandwidth=0;
@@ -410,11 +405,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info
410 } 405 }
411 406
412 if ( ieee->state == IEEE80211_LINKED){ 407 if ( ieee->state == IEEE80211_LINKED){
413#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
414 queue_work(ieee->wq, &ieee->wx_sync_scan_wq); 408 queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
415#else
416 schedule_task(&ieee->wx_sync_scan_wq);
417#endif
418 /* intentionally forget to up sem */ 409 /* intentionally forget to up sem */
419 return 0; 410 return 0;
420 } 411 }
@@ -460,18 +451,6 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
460 if (wrqu->essid.flags && wrqu->essid.length) { 451 if (wrqu->essid.flags && wrqu->essid.length) {
461 //first flush current network.ssid 452 //first flush current network.ssid
462 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE; 453 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
463#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
464 strncpy(ieee->current_network.ssid, extra, len);
465 ieee->current_network.ssid_len = len;
466#if 0
467 {
468 int i;
469 for (i=0; i<len; i++)
470 printk("%c ", extra[i]);
471 printk("\n");
472 }
473#endif
474#else
475 strncpy(ieee->current_network.ssid, extra, len+1); 454 strncpy(ieee->current_network.ssid, extra, len+1);
476 ieee->current_network.ssid_len = len+1; 455 ieee->current_network.ssid_len = len+1;
477#if 0 456#if 0
@@ -482,7 +461,6 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
482 printk("\n"); 461 printk("\n");
483 } 462 }
484#endif 463#endif
485#endif
486 ieee->ssid_set = 1; 464 ieee->ssid_set = 1;
487 } 465 }
488 else{ 466 else{
@@ -670,7 +648,7 @@ exit:
670 return ret; 648 return ret;
671 649
672} 650}
673#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) 651
674EXPORT_SYMBOL(ieee80211_wx_get_essid); 652EXPORT_SYMBOL(ieee80211_wx_get_essid);
675EXPORT_SYMBOL(ieee80211_wx_set_essid); 653EXPORT_SYMBOL(ieee80211_wx_set_essid);
676EXPORT_SYMBOL(ieee80211_wx_set_rate); 654EXPORT_SYMBOL(ieee80211_wx_set_rate);
@@ -689,23 +667,3 @@ EXPORT_SYMBOL(ieee80211_wx_get_power);
689EXPORT_SYMBOL(ieee80211_wlan_frequencies); 667EXPORT_SYMBOL(ieee80211_wlan_frequencies);
690EXPORT_SYMBOL(ieee80211_wx_set_rts); 668EXPORT_SYMBOL(ieee80211_wx_set_rts);
691EXPORT_SYMBOL(ieee80211_wx_get_rts); 669EXPORT_SYMBOL(ieee80211_wx_get_rts);
692#else
693EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_essid);
694EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_essid);
695EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rate);
696EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rate);
697EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_wap);
698EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_wap);
699EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mode);
700EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_mode);
701EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_scan);
702EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_freq);
703EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_freq);
704EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rawtx);
705EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_name);
706EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_power);
707EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_power);
708EXPORT_SYMBOL_NOVERS(ieee80211_wlan_frequencies);
709EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rts);
710EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rts);
711#endif
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c
index cba12b84be5..d4047c6ca2d 100644
--- 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, struct ieee80211_network *network)
287 return 0; 287 return 0;
288 288
289// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); 289// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
290#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22))
291 ip = ip_hdr(skb); 290 ip = ip_hdr(skb);
292#else 291
293 ip = (struct iphdr*)(skb->data + sizeof(struct ether_header));
294#endif
295 switch (ip->tos & 0xfc) { 292 switch (ip->tos & 0xfc) {
296 case 0x20: 293 case 0x20:
297 return 2; 294 return 2;
@@ -620,11 +617,7 @@ void ieee80211_query_seqnum(struct ieee80211_device*ieee, struct sk_buff* skb, u
620 617
621int rtl8192_ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) 618int rtl8192_ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
622{ 619{
623#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
624 struct ieee80211_device *ieee = netdev_priv(dev); 620 struct ieee80211_device *ieee = netdev_priv(dev);
625#else
626 struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
627#endif
628 struct ieee80211_txb *txb = NULL; 621 struct ieee80211_txb *txb = NULL;
629 struct ieee80211_hdr_3addrqos *frag_hdr; 622 struct ieee80211_hdr_3addrqos *frag_hdr;
630 int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; 623 int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size;
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
index ae11e2576be..79bb4800226 100644
--- 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[] = {
53 {"N-5G",4}, 53 {"N-5G",4},
54}; 54};
55 55
56#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
57static inline char *
58iwe_stream_add_event_rsl(char * stream, /* Stream of events */
59 char * ends, /* End of stream */
60 struct iw_event *iwe, /* Payload */
61 int event_len) /* Real size of payload */
62{
63 /* Check if it's possible */
64 if((stream + event_len) < ends) {
65 iwe->len = event_len;
66 ndelay(1); //new
67 memcpy(stream, (char *) iwe, event_len);
68 stream += event_len;
69 }
70 return stream;
71}
72#else
73#define iwe_stream_add_event_rsl iwe_stream_add_event 56#define iwe_stream_add_event_rsl iwe_stream_add_event
74#endif
75 57
76#define MAX_CUSTOM_LEN 64 58#define MAX_CUSTOM_LEN 64
77static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, 59static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
@@ -92,11 +74,8 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
92 iwe.cmd = SIOCGIWAP; 74 iwe.cmd = SIOCGIWAP;
93 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 75 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
94 memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); 76 memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN);
95#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
96 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN); 77 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN);
97#else 78
98 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_ADDR_LEN);
99#endif
100 /* Remaining entries will be displayed in the order we provide them */ 79 /* Remaining entries will be displayed in the order we provide them */
101 80
102 /* Add the ESSID */ 81 /* Add the ESSID */
@@ -105,18 +84,10 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
105// if (network->flags & NETWORK_EMPTY_ESSID) { 84// if (network->flags & NETWORK_EMPTY_ESSID) {
106 if (network->ssid_len == 0) { 85 if (network->ssid_len == 0) {
107 iwe.u.data.length = sizeof("<hidden>"); 86 iwe.u.data.length = sizeof("<hidden>");
108#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
109 start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>"); 87 start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>");
110#else
111 start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
112#endif
113 } else { 88 } else {
114 iwe.u.data.length = min(network->ssid_len, (u8)32); 89 iwe.u.data.length = min(network->ssid_len, (u8)32);
115#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
116 start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); 90 start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
117#else
118 start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
119#endif
120 } 91 }
121 /* Add the protocol name */ 92 /* Add the protocol name */
122 iwe.cmd = SIOCGIWNAME; 93 iwe.cmd = SIOCGIWNAME;
@@ -128,11 +99,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
128 } 99 }
129 *pname = '\0'; 100 *pname = '\0';
130 snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name); 101 snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name);
131#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
132 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN); 102 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN);
133#else
134 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN);
135#endif
136 /* Add mode */ 103 /* Add mode */
137 iwe.cmd = SIOCGIWMODE; 104 iwe.cmd = SIOCGIWMODE;
138 if (network->capability & 105 if (network->capability &
@@ -141,11 +108,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
141 iwe.u.mode = IW_MODE_MASTER; 108 iwe.u.mode = IW_MODE_MASTER;
142 else 109 else
143 iwe.u.mode = IW_MODE_ADHOC; 110 iwe.u.mode = IW_MODE_ADHOC;
144#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
145 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN); 111 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN);
146#else
147 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN);
148#endif
149 } 112 }
150 113
151 /* Add frequency/channel */ 114 /* Add frequency/channel */
@@ -155,11 +118,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
155 iwe.u.freq.m = network->channel; 118 iwe.u.freq.m = network->channel;
156 iwe.u.freq.e = 0; 119 iwe.u.freq.e = 0;
157 iwe.u.freq.i = 0; 120 iwe.u.freq.i = 0;
158#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
159 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN); 121 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN);
160#else
161 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN);
162#endif
163 /* Add encryption capability */ 122 /* Add encryption capability */
164 iwe.cmd = SIOCGIWENCODE; 123 iwe.cmd = SIOCGIWENCODE;
165 if (network->capability & WLAN_CAPABILITY_PRIVACY) 124 if (network->capability & WLAN_CAPABILITY_PRIVACY)
@@ -167,11 +126,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
167 else 126 else
168 iwe.u.data.flags = IW_ENCODE_DISABLED; 127 iwe.u.data.flags = IW_ENCODE_DISABLED;
169 iwe.u.data.length = 0; 128 iwe.u.data.length = 0;
170#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
171 start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); 129 start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
172#else
173 start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
174#endif
175 /* Add basic and extended rates */ 130 /* Add basic and extended rates */
176 max_rate = 0; 131 max_rate = 0;
177 p = custom; 132 p = custom;
@@ -227,21 +182,14 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
227 iwe.cmd = SIOCGIWRATE; 182 iwe.cmd = SIOCGIWRATE;
228 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; 183 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
229 iwe.u.bitrate.value = max_rate * 500000; 184 iwe.u.bitrate.value = max_rate * 500000;
230#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
231 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, 185 start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
232 IW_EV_PARAM_LEN); 186 IW_EV_PARAM_LEN);
233#else 187
234 start = iwe_stream_add_event_rsl(start, stop, &iwe,
235 IW_EV_PARAM_LEN);
236#endif
237 iwe.cmd = IWEVCUSTOM; 188 iwe.cmd = IWEVCUSTOM;
238 iwe.u.data.length = p - custom; 189 iwe.u.data.length = p - custom;
239 if (iwe.u.data.length) 190 if (iwe.u.data.length)
240#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
241 start = iwe_stream_add_point(info, start, stop, &iwe, custom); 191 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
242#else 192
243 start = iwe_stream_add_point(start, stop, &iwe, custom);
244#endif
245 /* Add quality statistics */ 193 /* Add quality statistics */
246 /* TODO: Fix these values... */ 194 /* TODO: Fix these values... */
247 iwe.cmd = IWEVQUAL; 195 iwe.cmd = IWEVQUAL;
@@ -256,21 +204,13 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
256 if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) 204 if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL))
257 iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; 205 iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
258 iwe.u.qual.updated = 7; 206 iwe.u.qual.updated = 7;
259#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
260 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN); 207 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN);
261#else
262 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN);
263#endif
264 iwe.cmd = IWEVCUSTOM; 208 iwe.cmd = IWEVCUSTOM;
265 p = custom; 209 p = custom;
266 210
267 iwe.u.data.length = p - custom; 211 iwe.u.data.length = p - custom;
268 if (iwe.u.data.length) 212 if (iwe.u.data.length)
269#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
270 start = iwe_stream_add_point(info, start, stop, &iwe, custom); 213 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
271#else
272 start = iwe_stream_add_point(start, stop, &iwe, custom);
273#endif
274#if (WIRELESS_EXT < 18) 214#if (WIRELESS_EXT < 18)
275 if (ieee->wpa_enabled && network->wpa_ie_len){ 215 if (ieee->wpa_enabled && network->wpa_ie_len){
276 char buf[MAX_WPA_IE_LEN * 2 + 30]; 216 char buf[MAX_WPA_IE_LEN * 2 + 30];
@@ -284,11 +224,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
284 memset(&iwe, 0, sizeof(iwe)); 224 memset(&iwe, 0, sizeof(iwe));
285 iwe.cmd = IWEVCUSTOM; 225 iwe.cmd = IWEVCUSTOM;
286 iwe.u.data.length = strlen(buf); 226 iwe.u.data.length = strlen(buf);
287#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
288 start = iwe_stream_add_point(info, start, stop, &iwe, buf); 227 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
289#else
290 start = iwe_stream_add_point(start, stop, &iwe, buf);
291#endif
292 } 228 }
293 229
294 if (ieee->wpa_enabled && network->rsn_ie_len){ 230 if (ieee->wpa_enabled && network->rsn_ie_len){
@@ -303,11 +239,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
303 memset(&iwe, 0, sizeof(iwe)); 239 memset(&iwe, 0, sizeof(iwe));
304 iwe.cmd = IWEVCUSTOM; 240 iwe.cmd = IWEVCUSTOM;
305 iwe.u.data.length = strlen(buf); 241 iwe.u.data.length = strlen(buf);
306#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
307 start = iwe_stream_add_point(info, start, stop, &iwe, buf); 242 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
308#else
309 start = iwe_stream_add_point(start, stop, &iwe, buf);
310#endif
311 } 243 }
312#else 244#else
313 memset(&iwe, 0, sizeof(iwe)); 245 memset(&iwe, 0, sizeof(iwe));
@@ -317,11 +249,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
317 memcpy(buf, network->wpa_ie, network->wpa_ie_len); 249 memcpy(buf, network->wpa_ie, network->wpa_ie_len);
318 iwe.cmd = IWEVGENIE; 250 iwe.cmd = IWEVGENIE;
319 iwe.u.data.length = network->wpa_ie_len; 251 iwe.u.data.length = network->wpa_ie_len;
320#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
321 start = iwe_stream_add_point(info, start, stop, &iwe, buf); 252 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
322#else
323 start = iwe_stream_add_point(start, stop, &iwe, buf);
324#endif
325 } 253 }
326 memset(&iwe, 0, sizeof(iwe)); 254 memset(&iwe, 0, sizeof(iwe));
327 if (network->rsn_ie_len) 255 if (network->rsn_ie_len)
@@ -330,11 +258,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
330 memcpy(buf, network->rsn_ie, network->rsn_ie_len); 258 memcpy(buf, network->rsn_ie, network->rsn_ie_len);
331 iwe.cmd = IWEVGENIE; 259 iwe.cmd = IWEVGENIE;
332 iwe.u.data.length = network->rsn_ie_len; 260 iwe.u.data.length = network->rsn_ie_len;
333#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
334 start = iwe_stream_add_point(info, start, stop, &iwe, buf); 261 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
335#else
336 start = iwe_stream_add_point(start, stop, &iwe, buf);
337#endif
338 } 262 }
339#endif 263#endif
340 264
@@ -347,11 +271,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
347 " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); 271 " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100));
348 iwe.u.data.length = p - custom; 272 iwe.u.data.length = p - custom;
349 if (iwe.u.data.length) 273 if (iwe.u.data.length)
350#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
351 start = iwe_stream_add_point(info, start, stop, &iwe, custom); 274 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
352#else
353 start = iwe_stream_add_point(start, stop, &iwe, custom);
354#endif
355 275
356 return start; 276 return start;
357} 277}
@@ -486,11 +406,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
486 request_module("ieee80211_crypt_wep"); 406 request_module("ieee80211_crypt_wep");
487 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 407 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
488 } 408 }
489#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
490 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 409 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
491#else
492 if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
493#endif
494 new_crypt->priv = new_crypt->ops->init(key); 410 new_crypt->priv = new_crypt->ops->init(key);
495 411
496 if (!new_crypt->ops || !new_crypt->priv) { 412 if (!new_crypt->ops || !new_crypt->priv) {
@@ -638,7 +554,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
638 union iwreq_data *wrqu, char *extra) 554 union iwreq_data *wrqu, char *extra)
639{ 555{
640 int ret = 0; 556 int ret = 0;
641#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
642 struct net_device *dev = ieee->dev; 557 struct net_device *dev = ieee->dev;
643 struct iw_point *encoding = &wrqu->encoding; 558 struct iw_point *encoding = &wrqu->encoding;
644 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 559 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
@@ -747,12 +662,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
747 662
748 ieee80211_crypt_delayed_deinit(ieee, crypt); 663 ieee80211_crypt_delayed_deinit(ieee, crypt);
749 664
750#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
751 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); 665 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
752#else
753 new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
754 memset(new_crypt,0,sizeof(*new_crypt));
755#endif
756 if (new_crypt == NULL) { 666 if (new_crypt == NULL) {
757 ret = -ENOMEM; 667 ret = -ENOMEM;
758 goto done; 668 goto done;
@@ -818,7 +728,7 @@ done:
818 IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); 728 IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name);
819 return -EINVAL; 729 return -EINVAL;
820 } 730 }
821#endif 731
822 return ret; 732 return ret;
823} 733}
824 734
@@ -881,8 +791,8 @@ int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
881 struct iw_request_info *info, 791 struct iw_request_info *info,
882 union iwreq_data *wrqu, char *extra) 792 union iwreq_data *wrqu, char *extra)
883{ 793{
884#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
885 struct iw_mlme *mlme = (struct iw_mlme *) extra; 794 struct iw_mlme *mlme = (struct iw_mlme *) extra;
795
886 switch (mlme->cmd) { 796 switch (mlme->cmd) {
887 case IW_MLME_DEAUTH: 797 case IW_MLME_DEAUTH:
888 case IW_MLME_DISASSOC: 798 case IW_MLME_DISASSOC:
@@ -891,7 +801,7 @@ int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
891 default: 801 default:
892 return -EOPNOTSUPP; 802 return -EOPNOTSUPP;
893 } 803 }
894#endif 804
895 return 0; 805 return 0;
896} 806}
897 807
@@ -899,7 +809,6 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
899 struct iw_request_info *info, 809 struct iw_request_info *info,
900 struct iw_param *data, char *extra) 810 struct iw_param *data, char *extra)
901{ 811{
902#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
903 switch (data->flags & IW_AUTH_INDEX) { 812 switch (data->flags & IW_AUTH_INDEX) {
904 case IW_AUTH_WPA_VERSION: 813 case IW_AUTH_WPA_VERSION:
905 /*need to support wpa2 here*/ 814 /*need to support wpa2 here*/
@@ -957,14 +866,13 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
957 default: 866 default:
958 return -EOPNOTSUPP; 867 return -EOPNOTSUPP;
959 } 868 }
960#endif 869
961 return 0; 870 return 0;
962} 871}
963#endif 872#endif
964#if 1 873#if 1
965int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) 874int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
966{ 875{
967#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
968#if 0 876#if 0
969 printk("====>%s()\n", __FUNCTION__); 877 printk("====>%s()\n", __FUNCTION__);
970 { 878 {
@@ -1004,13 +912,12 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
1004 ieee->wpa_ie = NULL; 912 ieee->wpa_ie = NULL;
1005 ieee->wpa_ie_len = 0; 913 ieee->wpa_ie_len = 0;
1006 } 914 }
1007#endif 915
1008 return 0; 916 return 0;
1009 917
1010} 918}
1011#endif 919#endif
1012 920
1013#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
1014EXPORT_SYMBOL(ieee80211_wx_set_gen_ie); 921EXPORT_SYMBOL(ieee80211_wx_set_gen_ie);
1015#if (WIRELESS_EXT >= 18) 922#if (WIRELESS_EXT >= 18)
1016EXPORT_SYMBOL(ieee80211_wx_set_mlme); 923EXPORT_SYMBOL(ieee80211_wx_set_mlme);
@@ -1021,12 +928,3 @@ EXPORT_SYMBOL(ieee80211_wx_get_encode_ext);
1021EXPORT_SYMBOL(ieee80211_wx_get_scan); 928EXPORT_SYMBOL(ieee80211_wx_get_scan);
1022EXPORT_SYMBOL(ieee80211_wx_set_encode); 929EXPORT_SYMBOL(ieee80211_wx_set_encode);
1023EXPORT_SYMBOL(ieee80211_wx_get_encode); 930EXPORT_SYMBOL(ieee80211_wx_get_encode);
1024#else
1025EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_gen_ie);
1026//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mlme);
1027//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_auth);
1028//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode_ext);
1029EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_scan);
1030EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode);
1031EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_encode);
1032#endif
diff --git a/drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c
index f357085f664..d263cdfca6d 100644
--- a/drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192su/ieee80211/rtl819x_HTProc.c
@@ -1241,14 +1241,9 @@ u8 HTFilterMCSRate( struct ieee80211_device* ieee, u8* pSupportMCS, u8* pOperate
1241void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); 1241void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
1242#if 0 1242#if 0
1243//I need move this function to other places, such as rx? 1243//I need move this function to other places, such as rx?
1244#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1245void HTOnAssocRsp_wq(struct work_struct *work) 1244void HTOnAssocRsp_wq(struct work_struct *work)
1246{ 1245{
1247 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ht_onAssRsp); 1246 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ht_onAssRsp);
1248#else
1249void HTOnAssocRsp_wq(struct ieee80211_device *ieee)
1250{
1251#endif
1252#endif 1247#endif
1253void HTOnAssocRsp(struct ieee80211_device *ieee) 1248void HTOnAssocRsp(struct ieee80211_device *ieee)
1254{ 1249{
@@ -2030,8 +2025,4 @@ void HTSetConnectBwModeCallback(struct ieee80211_device* ieee)
2030 pHTInfo->bSwBwInProgress = false; 2025 pHTInfo->bSwBwInProgress = false;
2031} 2026}
2032 2027
2033#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
2034EXPORT_SYMBOL_NOVERS(HTUpdateSelfAndPeerSetting);
2035#else
2036EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting); 2028EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting);
2037#endif
diff --git a/drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c
index 6fb7033ed36..ec4a8a3493e 100644
--- a/drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192su/ieee80211/rtl819x_TSProc.c
@@ -2,13 +2,6 @@
2#include <linux/etherdevice.h> 2#include <linux/etherdevice.h>
3#include "rtl819x_TS.h" 3#include "rtl819x_TS.h"
4 4
5#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6#define list_for_each_entry_safe(pos, n, head, member) \
7 for (pos = list_entry((head)->next, typeof(*pos), member), \
8 n = list_entry(pos->member.next, typeof(*pos), member); \
9 &pos->member != (head); \
10 pos = n, n = list_entry(n->member.next, typeof(*n), member))
11#endif
12void TsSetupTimeOut(unsigned long data) 5void TsSetupTimeOut(unsigned long data)
13{ 6{
14 // Not implement yet 7 // Not implement yet
@@ -660,8 +653,5 @@ void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS)
660 else 653 else
661 IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s()==>BA timer is already added\n", __FUNCTION__); 654 IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s()==>BA timer is already added\n", __FUNCTION__);
662} 655}
663#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 656
664EXPORT_SYMBOL_NOVERS(RemovePeerTS);
665#else
666EXPORT_SYMBOL(RemovePeerTS); 657EXPORT_SYMBOL(RemovePeerTS);
667#endif
diff --git a/drivers/staging/rtl8192su/r8192S_firmware.c b/drivers/staging/rtl8192su/r8192S_firmware.c
index ab8bf3ea480..08d38b240c2 100644
--- a/drivers/staging/rtl8192su/r8192S_firmware.c
+++ b/drivers/staging/rtl8192su/r8192S_firmware.c
@@ -25,9 +25,7 @@
25#include "r8192xU_firmware_img.h" 25#include "r8192xU_firmware_img.h"
26#endif 26#endif
27 27
28#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
29#include <linux/firmware.h> 28#include <linux/firmware.h>
30#endif
31 29
32#define byte(x,n) ( (x >> (8 * n)) & 0xff ) 30#define byte(x,n) ( (x >> (8 * n)) & 0xff )
33 31
@@ -405,16 +403,11 @@ bool FirmwareDownload92S(struct net_device *dev)
405 //3 //<1> Open Image file, and map file to contineous memory if open file success. 403 //3 //<1> Open Image file, and map file to contineous memory if open file success.
406 //3 // or read image file from array. Default load from BIN file 404 //3 // or read image file from array. Default load from BIN file
407 //3// 405 //3//
408#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
409 priv->firmware_source = FW_SOURCE_HEADER_FILE;
410#else
411 priv->firmware_source = FW_SOURCE_IMG_FILE;// We should decided by Reg. 406 priv->firmware_source = FW_SOURCE_IMG_FILE;// We should decided by Reg.
412#endif
413 407
414 switch( priv->firmware_source ) 408 switch( priv->firmware_source )
415 { 409 {
416 case FW_SOURCE_IMG_FILE: 410 case FW_SOURCE_IMG_FILE:
417#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
418 if(pFirmware->szFwTmpBufferLen == 0) 411 if(pFirmware->szFwTmpBufferLen == 0)
419 { 412 {
420 413
@@ -473,7 +466,6 @@ bool FirmwareDownload92S(struct net_device *dev)
473 466
474 467
475 } 468 }
476#endif
477 break; 469 break;
478 470
479 case FW_SOURCE_HEADER_FILE: 471 case FW_SOURCE_HEADER_FILE:
@@ -870,11 +862,8 @@ bool init_firmware(struct net_device *dev)
870 * Download boot, main, and data image for System reset. 862 * Download boot, main, and data image for System reset.
871 * Download data image for firmware reseta 863 * Download data image for firmware reseta
872 */ 864 */
873#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
874 priv->firmware_source = FW_SOURCE_HEADER_FILE;
875#else
876 priv->firmware_source = FW_SOURCE_IMG_FILE; 865 priv->firmware_source = FW_SOURCE_IMG_FILE;
877#endif 866
878 for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) { 867 for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
879 /* 868 /*
880 * Open Image file, and map file to contineous memory if open file success. 869 * Open Image file, and map file to contineous memory if open file success.
@@ -883,7 +872,6 @@ bool init_firmware(struct net_device *dev)
883 if(rst_opt == OPT_SYSTEM_RESET) { 872 if(rst_opt == OPT_SYSTEM_RESET) {
884 switch(priv->firmware_source) { 873 switch(priv->firmware_source) {
885 case FW_SOURCE_IMG_FILE: 874 case FW_SOURCE_IMG_FILE:
886 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
887 rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev); 875 rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev);
888 if(rc < 0 ) { 876 if(rc < 0 ) {
889 RT_TRACE(COMP_ERR, "request firmware fail!\n"); 877 RT_TRACE(COMP_ERR, "request firmware fail!\n");
@@ -912,7 +900,6 @@ bool init_firmware(struct net_device *dev)
912 #endif 900 #endif
913 } 901 }
914 pfirmware->firmware_buf_size = file_length; 902 pfirmware->firmware_buf_size = file_length;
915 #endif
916 break; 903 break;
917 904
918 case FW_SOURCE_HEADER_FILE: 905 case FW_SOURCE_HEADER_FILE:
@@ -943,11 +930,10 @@ bool init_firmware(struct net_device *dev)
943 * and Tx descriptor info 930 * and Tx descriptor info
944 * */ 931 * */
945 rt_status = fw_download_code(dev,mapped_file,file_length); 932 rt_status = fw_download_code(dev,mapped_file,file_length);
946 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 933
947 if(rst_opt == OPT_SYSTEM_RESET) { 934 if(rst_opt == OPT_SYSTEM_RESET) {
948 release_firmware(fw_entry); 935 release_firmware(fw_entry);
949 } 936 }
950 #endif
951 937
952 if(rt_status != TRUE) { 938 if(rt_status != TRUE) {
953 goto download_firmware_fail; 939 goto download_firmware_fail;
diff --git a/drivers/staging/rtl8192su/r8192S_phy.c b/drivers/staging/rtl8192su/r8192S_phy.c
index 80a8e14906b..5e922cb50c2 100644
--- a/drivers/staging/rtl8192su/r8192S_phy.c
+++ b/drivers/staging/rtl8192su/r8192S_phy.c
@@ -4678,29 +4678,15 @@ void InitialGain819xUsb(struct net_device *dev, u8 Operation)
4678 4678
4679 if(priv->up) 4679 if(priv->up)
4680 { 4680 {
4681 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
4682 queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0); 4681 queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0);
4683 #else
4684 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
4685 schedule_task(&priv->initialgain_operate_wq);
4686 #else
4687 queue_work(priv->priv_wq,&priv->initialgain_operate_wq);
4688 #endif
4689 #endif
4690 } 4682 }
4691} 4683}
4692 4684
4693#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4694extern void InitialGainOperateWorkItemCallBack(struct work_struct *work) 4685extern void InitialGainOperateWorkItemCallBack(struct work_struct *work)
4695{ 4686{
4696 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 4687 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
4697 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq); 4688 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq);
4698 struct net_device *dev = priv->ieee80211->dev; 4689 struct net_device *dev = priv->ieee80211->dev;
4699#else
4700extern void InitialGainOperateWorkItemCallBack(struct net_device *dev)
4701{
4702 struct r8192_priv *priv = ieee80211_priv(dev);
4703#endif
4704#define SCAN_RX_INITIAL_GAIN 0x17 4690#define SCAN_RX_INITIAL_GAIN 0x17
4705#define POWER_DETECTION_TH 0x08 4691#define POWER_DETECTION_TH 0x08
4706 u32 BitMask; 4692 u32 BitMask;
diff --git a/drivers/staging/rtl8192su/r8192S_phy.h b/drivers/staging/rtl8192su/r8192S_phy.h
index 580a7c6a760..b752fa35a7a 100644
--- a/drivers/staging/rtl8192su/r8192S_phy.h
+++ b/drivers/staging/rtl8192su/r8192S_phy.h
@@ -121,11 +121,8 @@ extern void PHY_IQCalibrateBcut(struct net_device* dev);
121extern void PHY_IQCalibrate(struct net_device* dev); 121extern void PHY_IQCalibrate(struct net_device* dev);
122extern void PHY_GetHWRegOriginalValue(struct net_device* dev); 122extern void PHY_GetHWRegOriginalValue(struct net_device* dev);
123 123
124#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
125extern void InitialGainOperateWorkItemCallBack(struct work_struct *work); 124extern void InitialGainOperateWorkItemCallBack(struct work_struct *work);
126#else 125
127extern void InitialGainOperateWorkItemCallBack(struct net_device *dev);
128#endif
129void PHY_SetTxPowerLevel8192S(struct net_device* dev, u8 channel); 126void PHY_SetTxPowerLevel8192S(struct net_device* dev, u8 channel);
130void PHY_InitialGain8192S(struct net_device* dev,u8 Operation ); 127void PHY_InitialGain8192S(struct net_device* dev,u8 Operation );
131 128
diff --git a/drivers/staging/rtl8192su/r8192U.h b/drivers/staging/rtl8192su/r8192U.h
index 38c345fdc18..2a9ccab7523 100644
--- a/drivers/staging/rtl8192su/r8192U.h
+++ b/drivers/staging/rtl8192su/r8192U.h
@@ -39,9 +39,7 @@
39#include <linux/random.h> 39#include <linux/random.h>
40#include <linux/version.h> 40#include <linux/version.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) 42
43#include <asm/semaphore.h>
44#endif
45#include "ieee80211/ieee80211.h" 43#include "ieee80211/ieee80211.h"
46 44
47#ifdef RTL8192SU 45#ifdef RTL8192SU
@@ -1555,11 +1553,7 @@ typedef struct r8192_priv
1555// spinlock_t irq_th_lock; 1553// spinlock_t irq_th_lock;
1556 spinlock_t tx_lock; 1554 spinlock_t tx_lock;
1557 spinlock_t ps_lock; 1555 spinlock_t ps_lock;
1558#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
1559 struct semaphore mutex;
1560#else
1561 struct mutex mutex; 1556 struct mutex mutex;
1562#endif
1563 spinlock_t rf_lock; //used to lock rf write operation added by wb 1557 spinlock_t rf_lock; //used to lock rf write operation added by wb
1564 1558
1565 u16 irq_mask; 1559 u16 irq_mask;
@@ -1619,11 +1613,9 @@ typedef struct r8192_priv
1619/* modified by davad for Rx process */ 1613/* modified by davad for Rx process */
1620 struct sk_buff_head rx_queue; 1614 struct sk_buff_head rx_queue;
1621 struct sk_buff_head skb_queue; 1615 struct sk_buff_head skb_queue;
1622#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) 1616
1623 struct tq_struct qos_activate;
1624#else
1625 struct work_struct qos_activate; 1617 struct work_struct qos_activate;
1626#endif 1618
1627 short tx_urb_index; 1619 short tx_urb_index;
1628 atomic_t tx_pending[0x10];//UART_PRIORITY+1 1620 atomic_t tx_pending[0x10];//UART_PRIORITY+1
1629 1621
@@ -1653,11 +1645,8 @@ typedef struct r8192_priv
1653 u16 rts; 1645 u16 rts;
1654 1646
1655 struct ChnlAccessSetting ChannelAccessSetting; 1647 struct ChnlAccessSetting ChannelAccessSetting;
1656#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 1648
1657 struct work_struct reset_wq; 1649 struct work_struct reset_wq;
1658#else
1659 struct tq_struct reset_wq;
1660#endif
1661 1650
1662/**********************************************************/ 1651/**********************************************************/
1663 //for rtl819xUsb 1652 //for rtl819xUsb
@@ -1874,33 +1863,14 @@ typedef struct r8192_priv
1874 u16 SifsTime; 1863 u16 SifsTime;
1875 1864
1876 //define work item by amy 080526 1865 //define work item by amy 080526
1877#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1878
1879#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1880 struct delayed_work update_beacon_wq; 1866 struct delayed_work update_beacon_wq;
1881 struct delayed_work watch_dog_wq; 1867 struct delayed_work watch_dog_wq;
1882 struct delayed_work txpower_tracking_wq; 1868 struct delayed_work txpower_tracking_wq;
1883 struct delayed_work rfpath_check_wq; 1869 struct delayed_work rfpath_check_wq;
1884 struct delayed_work gpio_change_rf_wq; 1870 struct delayed_work gpio_change_rf_wq;
1885 struct delayed_work initialgain_operate_wq; 1871 struct delayed_work initialgain_operate_wq;
1886#else 1872
1887 struct work_struct update_beacon_wq;
1888 struct work_struct watch_dog_wq;
1889 struct work_struct txpower_tracking_wq;
1890 struct work_struct rfpath_check_wq;
1891 struct work_struct gpio_change_rf_wq;
1892 struct work_struct initialgain_operate_wq;
1893#endif
1894 struct workqueue_struct *priv_wq; 1873 struct workqueue_struct *priv_wq;
1895#else
1896 /* used for periodly scan */
1897 struct tq_struct update_beacon_wq;
1898 struct tq_struct txpower_tracking_wq;
1899 struct tq_struct rfpath_check_wq;
1900 struct tq_struct watch_dog_wq;
1901 struct tq_struct gpio_change_rf_wq;
1902 struct tq_struct initialgain_operate_wq;
1903#endif
1904//#ifdef RTL8192SU 1874//#ifdef RTL8192SU
1905 //lzm add for 8192S 1875 //lzm add for 8192S
1906 u32 IntrMask; 1876 u32 IntrMask;
diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c
index 287182a2dca..d5a15bb42cb 100644
--- a/drivers/staging/rtl8192su/r8192U_core.c
+++ b/drivers/staging/rtl8192su/r8192U_core.c
@@ -75,10 +75,6 @@ double __extendsfdf2(float a) {return a;}
75#include "r8192U_dm.h" 75#include "r8192U_dm.h"
76//#include "r8192xU_phyreg.h" 76//#include "r8192xU_phyreg.h"
77#include <linux/usb.h> 77#include <linux/usb.h>
78// FIXME: check if 2.6.7 is ok
79#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
80#define usb_kill_urb usb_unlink_urb
81#endif
82 78
83#ifdef CONFIG_RTL8192_PM 79#ifdef CONFIG_RTL8192_PM
84#include "r8192U_pm.h" 80#include "r8192U_pm.h"
@@ -102,10 +98,6 @@ double __extendsfdf2(float a) {return a;}
102#include "r8192U_dm.h" 98#include "r8192U_dm.h"
103//#include "r8192xU_phyreg.h" 99//#include "r8192xU_phyreg.h"
104#include <linux/usb.h> 100#include <linux/usb.h>
105// FIXME: check if 2.6.7 is ok
106#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
107#define usb_kill_urb usb_unlink_urb
108#endif
109 101
110#ifdef CONFIG_RTL8192_PM 102#ifdef CONFIG_RTL8192_PM
111#include "r8192U_pm.h" 103#include "r8192U_pm.h"
@@ -201,9 +193,7 @@ static struct usb_device_id rtl8192_usb_id_tbl[] = {
201}; 193};
202 194
203MODULE_LICENSE("GPL"); 195MODULE_LICENSE("GPL");
204#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
205MODULE_VERSION("V 1.1"); 196MODULE_VERSION("V 1.1");
206#endif
207MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl); 197MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl);
208MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards"); 198MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards");
209 199
@@ -217,57 +207,34 @@ static int channels = 0x3fff;
217 207
218 208
219 209
220#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
221module_param(ifname, charp, S_IRUGO|S_IWUSR ); 210module_param(ifname, charp, S_IRUGO|S_IWUSR );
222//module_param(hwseqnum,int, S_IRUGO|S_IWUSR); 211//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
223module_param(hwwep,int, S_IRUGO|S_IWUSR); 212module_param(hwwep,int, S_IRUGO|S_IWUSR);
224module_param(channels,int, S_IRUGO|S_IWUSR); 213module_param(channels,int, S_IRUGO|S_IWUSR);
225#else
226MODULE_PARM(ifname, "s");
227//MODULE_PARM(hwseqnum,"i");
228MODULE_PARM(hwwep,"i");
229MODULE_PARM(channels,"i");
230#endif
231 214
232MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default"); 215MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default");
233//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); 216//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
234MODULE_PARM_DESC(hwwep," Try to use hardware security support. "); 217MODULE_PARM_DESC(hwwep," Try to use hardware security support. ");
235MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); 218MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
236 219
237#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
238static int __devinit rtl8192_usb_probe(struct usb_interface *intf, 220static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
239 const struct usb_device_id *id); 221 const struct usb_device_id *id);
240static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf); 222static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf);
241#else
242static void *__devinit rtl8192_usb_probe(struct usb_device *udev,unsigned int ifnum,
243 const struct usb_device_id *id);
244static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr);
245#endif
246
247 223
248static struct usb_driver rtl8192_usb_driver = { 224static struct usb_driver rtl8192_usb_driver = {
249#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
250 .owner = THIS_MODULE,
251#endif
252 .name = RTL819xU_MODULE_NAME, /* Driver name */ 225 .name = RTL819xU_MODULE_NAME, /* Driver name */
253 .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */ 226 .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */
254 .probe = rtl8192_usb_probe, /* probe fn */ 227 .probe = rtl8192_usb_probe, /* probe fn */
255 .disconnect = rtl8192_usb_disconnect, /* remove fn */ 228 .disconnect = rtl8192_usb_disconnect, /* remove fn */
256#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
257#ifdef CONFIG_RTL8192_PM 229#ifdef CONFIG_RTL8192_PM
258 .suspend = rtl8192U_suspend, /* PM suspend fn */ 230 .suspend = rtl8192U_suspend, /* PM suspend fn */
259 .resume = rtl8192U_resume, /* PM resume fn */ 231 .resume = rtl8192U_resume, /* PM resume fn */
260#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)
261 .reset_resume = rtl8192U_resume, /* PM reset resume fn */ 232 .reset_resume = rtl8192U_resume, /* PM reset resume fn */
262#endif
263#else 233#else
264 .suspend = NULL, /* PM suspend fn */ 234 .suspend = NULL, /* PM suspend fn */
265 .resume = NULL, /* PM resume fn */ 235 .resume = NULL, /* PM resume fn */
266#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)
267 .reset_resume = NULL, /* PM reset resume fn */ 236 .reset_resume = NULL, /* PM reset resume fn */
268#endif 237#endif
269#endif
270#endif
271}; 238};
272 239
273 240
@@ -686,13 +653,8 @@ inline void force_pci_posting(struct net_device *dev)
686static struct net_device_stats *rtl8192_stats(struct net_device *dev); 653static struct net_device_stats *rtl8192_stats(struct net_device *dev);
687void rtl8192_commit(struct net_device *dev); 654void rtl8192_commit(struct net_device *dev);
688//void rtl8192_restart(struct net_device *dev); 655//void rtl8192_restart(struct net_device *dev);
689#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
690void rtl8192_restart(struct work_struct *work); 656void rtl8192_restart(struct work_struct *work);
691//void rtl8192_rq_tx_ack(struct work_struct *work); 657//void rtl8192_rq_tx_ack(struct work_struct *work);
692#else
693 void rtl8192_restart(struct net_device *dev);
694// //void rtl8192_rq_tx_ack(struct net_device *dev);
695 #endif
696 658
697void watch_dog_timer_callback(unsigned long data); 659void watch_dog_timer_callback(unsigned long data);
698 660
@@ -1297,21 +1259,13 @@ static struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
1297void rtl8192_proc_module_init(void) 1259void rtl8192_proc_module_init(void)
1298{ 1260{
1299 RT_TRACE(COMP_INIT, "Initializing proc filesystem"); 1261 RT_TRACE(COMP_INIT, "Initializing proc filesystem");
1300#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
1301 rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, proc_net);
1302#else
1303 rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net); 1262 rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net);
1304#endif
1305} 1263}
1306 1264
1307 1265
1308void rtl8192_proc_module_remove(void) 1266void rtl8192_proc_module_remove(void)
1309{ 1267{
1310#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
1311 remove_proc_entry(RTL819xU_MODULE_NAME, proc_net);
1312#else
1313 remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net); 1268 remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net);
1314#endif
1315} 1269}
1316 1270
1317 1271
@@ -1533,11 +1487,7 @@ void tx_timeout(struct net_device *dev)
1533 struct r8192_priv *priv = ieee80211_priv(dev); 1487 struct r8192_priv *priv = ieee80211_priv(dev);
1534 //rtl8192_commit(dev); 1488 //rtl8192_commit(dev);
1535 1489
1536#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
1537 schedule_work(&priv->reset_wq); 1490 schedule_work(&priv->reset_wq);
1538#else
1539 schedule_task(&priv->reset_wq);
1540#endif
1541 //DMESG("TXTIMEOUT"); 1491 //DMESG("TXTIMEOUT");
1542} 1492}
1543 1493
@@ -1672,12 +1622,7 @@ void rtl8192_set_chan(struct net_device *dev,short ch)
1672#endif 1622#endif
1673} 1623}
1674 1624
1675#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
1676static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs);
1677#else
1678static void rtl8192_rx_isr(struct urb *urb); 1625static void rtl8192_rx_isr(struct urb *urb);
1679#endif
1680//static void rtl8192_rx_isr(struct urb *rx_urb);
1681 1626
1682u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats) 1627u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats)
1683{ 1628{
@@ -1704,11 +1649,7 @@ static int rtl8192_rx_initiate(struct net_device*dev)
1704 skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL); 1649 skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL);
1705 if (!skb) 1650 if (!skb)
1706 break; 1651 break;
1707#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1708 entry = usb_alloc_urb(0, GFP_KERNEL); 1652 entry = usb_alloc_urb(0, GFP_KERNEL);
1709#else
1710 entry = usb_alloc_urb(0);
1711#endif
1712 if (!entry) { 1653 if (!entry) {
1713 kfree_skb(skb); 1654 kfree_skb(skb);
1714 break; 1655 break;
@@ -1722,11 +1663,7 @@ static int rtl8192_rx_initiate(struct net_device*dev)
1722 info->dev = dev; 1663 info->dev = dev;
1723 info->out_pipe = 3; //denote rx normal packet queue 1664 info->out_pipe = 3; //denote rx normal packet queue
1724 skb_queue_tail(&priv->rx_queue, skb); 1665 skb_queue_tail(&priv->rx_queue, skb);
1725#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1726 usb_submit_urb(entry, GFP_KERNEL); 1666 usb_submit_urb(entry, GFP_KERNEL);
1727#else
1728 usb_submit_urb(entry);
1729#endif
1730 } 1667 }
1731 1668
1732 /* command packet rx procedure */ 1669 /* command packet rx procedure */
@@ -1735,11 +1672,7 @@ static int rtl8192_rx_initiate(struct net_device*dev)
1735 skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL); 1672 skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL);
1736 if (!skb) 1673 if (!skb)
1737 break; 1674 break;
1738#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1739 entry = usb_alloc_urb(0, GFP_KERNEL); 1675 entry = usb_alloc_urb(0, GFP_KERNEL);
1740#else
1741 entry = usb_alloc_urb(0);
1742#endif
1743 if (!entry) { 1676 if (!entry) {
1744 kfree_skb(skb); 1677 kfree_skb(skb);
1745 break; 1678 break;
@@ -1752,11 +1685,7 @@ static int rtl8192_rx_initiate(struct net_device*dev)
1752 info->dev = dev; 1685 info->dev = dev;
1753 info->out_pipe = 9; //denote rx cmd packet queue 1686 info->out_pipe = 9; //denote rx cmd packet queue
1754 skb_queue_tail(&priv->rx_queue, skb); 1687 skb_queue_tail(&priv->rx_queue, skb);
1755#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1756 usb_submit_urb(entry, GFP_KERNEL); 1688 usb_submit_urb(entry, GFP_KERNEL);
1757#else
1758 usb_submit_urb(entry);
1759#endif
1760 } 1689 }
1761 1690
1762 return 0; 1691 return 0;
@@ -2083,13 +2012,7 @@ inline u16 rtl8192_rate2rate(short rate)
2083 return rtl_rate[rate]; 2012 return rtl_rate[rate];
2084} 2013}
2085 2014
2086
2087/* The protype of rx_isr has changed since one verion of Linux Kernel */
2088#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
2089static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs)
2090#else
2091static void rtl8192_rx_isr(struct urb *urb) 2015static void rtl8192_rx_isr(struct urb *urb)
2092#endif
2093{ 2016{
2094 struct sk_buff *skb = (struct sk_buff *) urb->context; 2017 struct sk_buff *skb = (struct sk_buff *) urb->context;
2095 struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; 2018 struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb;
@@ -2107,20 +2030,8 @@ static void rtl8192_rx_isr(struct urb *urb)
2107 // printk("%s():rx status err\n",__FUNCTION__); 2030 // printk("%s():rx status err\n",__FUNCTION__);
2108 return; 2031 return;
2109 } 2032 }
2110#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) 2033
2111 skb_unlink(skb, &priv->rx_queue); 2034 skb_unlink(skb, &priv->rx_queue);
2112#else
2113 /*
2114 * __skb_unlink before linux2.6.14 does not use spinlock to protect list head.
2115 * add spinlock function manually. john,2008/12/03
2116 */
2117 {
2118 unsigned long flags;
2119 spin_lock_irqsave(&(priv->rx_queue.lock), flags);
2120 __skb_unlink(skb,&priv->rx_queue);
2121 spin_unlock_irqrestore(&(priv->rx_queue.lock), flags);
2122 }
2123#endif
2124 skb_put(skb, urb->actual_length); 2035 skb_put(skb, urb->actual_length);
2125 2036
2126 skb_queue_tail(&priv->skb_queue, skb); 2037 skb_queue_tail(&priv->skb_queue, skb);
@@ -2146,11 +2057,7 @@ static void rtl8192_rx_isr(struct urb *urb)
2146 urb->transfer_buffer = skb->tail; 2057 urb->transfer_buffer = skb->tail;
2147 urb->context = skb; 2058 urb->context = skb;
2148 skb_queue_tail(&priv->rx_queue, skb); 2059 skb_queue_tail(&priv->rx_queue, skb);
2149#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2150 err = usb_submit_urb(urb, GFP_ATOMIC); 2060 err = usb_submit_urb(urb, GFP_ATOMIC);
2151#else
2152 err = usb_submit_urb(urb);
2153#endif
2154 if(err && err != EPERM) 2061 if(err && err != EPERM)
2155 printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status); 2062 printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status);
2156} 2063}
@@ -2300,11 +2207,7 @@ u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc);
2300u8 MapHwQueueToFirmwareQueue(u8 QueueID); 2207u8 MapHwQueueToFirmwareQueue(u8 QueueID);
2301struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList) 2208struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList)
2302{ 2209{
2303#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
2304 struct ieee80211_device *ieee = netdev_priv(dev); 2210 struct ieee80211_device *ieee = netdev_priv(dev);
2305#else
2306 struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
2307#endif
2308 struct r8192_priv *priv = ieee80211_priv(dev); 2211 struct r8192_priv *priv = ieee80211_priv(dev);
2309 cb_desc *tcb_desc = NULL; 2212 cb_desc *tcb_desc = NULL;
2310 u8 i; 2213 u8 i;
@@ -2517,11 +2420,7 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
2517u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb, 2420u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb,
2518 struct ieee80211_drv_agg_txb *pSendList) 2421 struct ieee80211_drv_agg_txb *pSendList)
2519{ 2422{
2520#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
2521 struct ieee80211_device *ieee = netdev_priv(dev); 2423 struct ieee80211_device *ieee = netdev_priv(dev);
2522#else
2523 struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
2524#endif
2525 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; 2424 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
2526 u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum; 2425 u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum;
2527 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); 2426 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
@@ -2540,11 +2439,7 @@ u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb,
2540} 2439}
2541#endif 2440#endif
2542 2441
2543#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
2544static void rtl8192_tx_isr(struct urb *tx_urb, struct pt_regs *reg)
2545#else
2546static void rtl8192_tx_isr(struct urb *tx_urb) 2442static void rtl8192_tx_isr(struct urb *tx_urb)
2547#endif
2548{ 2443{
2549 struct sk_buff *skb = (struct sk_buff*)tx_urb->context; 2444 struct sk_buff *skb = (struct sk_buff*)tx_urb->context;
2550 struct net_device *dev = NULL; 2445 struct net_device *dev = NULL;
@@ -3036,11 +2931,7 @@ short rtl8192SU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
3036 //printk("\n %s::::::::::::::::::::::queue_index = %d\n",__FUNCTION__, queue_index); 2931 //printk("\n %s::::::::::::::::::::::queue_index = %d\n",__FUNCTION__, queue_index);
3037 atomic_inc(&priv->tx_pending[queue_index]); 2932 atomic_inc(&priv->tx_pending[queue_index]);
3038 2933
3039#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3040 tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 2934 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
3041#else
3042 tx_urb = usb_alloc_urb(0);
3043#endif
3044 if(!tx_urb){ 2935 if(!tx_urb){
3045 dev_kfree_skb(skb); 2936 dev_kfree_skb(skb);
3046 return -ENOMEM; 2937 return -ENOMEM;
@@ -3076,12 +2967,7 @@ short rtl8192SU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
3076 rtl8192_tx_isr, 2967 rtl8192_tx_isr,
3077 skb); 2968 skb);
3078 2969
3079#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3080 status = usb_submit_urb(tx_urb, GFP_ATOMIC); 2970 status = usb_submit_urb(tx_urb, GFP_ATOMIC);
3081#else
3082 status = usb_submit_urb(tx_urb);
3083#endif
3084
3085 if (!status){ 2971 if (!status){
3086 return 0; 2972 return 0;
3087 }else{ 2973 }else{
@@ -3105,11 +2991,8 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
3105 2991
3106 //printk("\n %s::queue_index = %d\n",__FUNCTION__, queue_index); 2992 //printk("\n %s::queue_index = %d\n",__FUNCTION__, queue_index);
3107 atomic_inc(&priv->tx_pending[queue_index]); 2993 atomic_inc(&priv->tx_pending[queue_index]);
3108#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 2994
3109 tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 2995 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
3110#else
3111 tx_urb = usb_alloc_urb(0);
3112#endif
3113 if(!tx_urb){ 2996 if(!tx_urb){
3114 dev_kfree_skb(skb); 2997 dev_kfree_skb(skb);
3115 return -ENOMEM; 2998 return -ENOMEM;
@@ -3143,12 +3026,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
3143 usb_fill_bulk_urb(tx_urb,priv->udev, usb_sndbulkpipe(priv->udev,idx_pipe), \ 3026 usb_fill_bulk_urb(tx_urb,priv->udev, usb_sndbulkpipe(priv->udev,idx_pipe), \
3144 skb->data, skb->len, rtl8192_tx_isr, skb); 3027 skb->data, skb->len, rtl8192_tx_isr, skb);
3145 3028
3146#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3147 status = usb_submit_urb(tx_urb, GFP_ATOMIC); 3029 status = usb_submit_urb(tx_urb, GFP_ATOMIC);
3148#else
3149 status = usb_submit_urb(tx_urb);
3150#endif
3151
3152 if (!status){ 3030 if (!status){
3153 return 0; 3031 return 0;
3154 }else{ 3032 }else{
@@ -3333,11 +3211,7 @@ u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc)
3333 return tmp_Short; 3211 return tmp_Short;
3334} 3212}
3335 3213
3336#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
3337static void tx_zero_isr(struct urb *tx_urb, struct pt_regs *reg)
3338#else
3339static void tx_zero_isr(struct urb *tx_urb) 3214static void tx_zero_isr(struct urb *tx_urb)
3340#endif
3341{ 3215{
3342 return; 3216 return;
3343} 3217}
@@ -3401,11 +3275,7 @@ short rtl8192SU_tx(struct net_device *dev, struct sk_buff* skb)
3401 return -1; 3275 return -1;
3402 } 3276 }
3403 3277
3404#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3405 tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 3278 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
3406#else
3407 tx_urb = usb_alloc_urb(0);
3408#endif
3409 if(!tx_urb){ 3279 if(!tx_urb){
3410 dev_kfree_skb_any(skb); 3280 dev_kfree_skb_any(skb);
3411 return -ENOMEM; 3281 return -ENOMEM;
@@ -3674,11 +3544,7 @@ short rtl8192SU_tx(struct net_device *dev, struct sk_buff* skb)
3674 skb->data, 3544 skb->data,
3675 skb->len, rtl8192_tx_isr, skb); 3545 skb->len, rtl8192_tx_isr, skb);
3676 3546
3677#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3678 status = usb_submit_urb(tx_urb, GFP_ATOMIC); 3547 status = usb_submit_urb(tx_urb, GFP_ATOMIC);
3679#else
3680 status = usb_submit_urb(tx_urb);
3681#endif
3682 if (!status){ 3548 if (!status){
3683//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 3549//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
3684 bool bSend0Byte = false; 3550 bool bSend0Byte = false;
@@ -3696,11 +3562,7 @@ short rtl8192SU_tx(struct net_device *dev, struct sk_buff* skb)
3696 if (bSend0Byte) 3562 if (bSend0Byte)
3697 { 3563 {
3698#if 1 3564#if 1
3699#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3700 tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC); 3565 tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC);
3701#else
3702 tx_urb_zero = usb_alloc_urb(0);
3703#endif
3704 if(!tx_urb_zero){ 3566 if(!tx_urb_zero){
3705 RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n"); 3567 RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n");
3706 return -ENOMEM; 3568 return -ENOMEM;
@@ -3708,11 +3570,7 @@ short rtl8192SU_tx(struct net_device *dev, struct sk_buff* skb)
3708 usb_fill_bulk_urb(tx_urb_zero,udev, 3570 usb_fill_bulk_urb(tx_urb_zero,udev,
3709 usb_sndbulkpipe(udev,idx_pipe), &zero, 3571 usb_sndbulkpipe(udev,idx_pipe), &zero,
3710 0, tx_zero_isr, dev); 3572 0, tx_zero_isr, dev);
3711#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3712 status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC); 3573 status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC);
3713#else
3714 status = usb_submit_urb(tx_urb_zero);
3715#endif
3716 if (status){ 3574 if (status){
3717 RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); 3575 RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
3718 return -1; 3576 return -1;
@@ -3780,11 +3638,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
3780 return -1; 3638 return -1;
3781 } 3639 }
3782 3640
3783#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3784 tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 3641 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
3785#else
3786 tx_urb = usb_alloc_urb(0);
3787#endif
3788 if(!tx_urb){ 3642 if(!tx_urb){
3789 dev_kfree_skb_any(skb); 3643 dev_kfree_skb_any(skb);
3790 return -ENOMEM; 3644 return -ENOMEM;
@@ -3972,11 +3826,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
3972 usb_sndbulkpipe(udev,idx_pipe), skb->data, 3826 usb_sndbulkpipe(udev,idx_pipe), skb->data,
3973 skb->len, rtl8192_tx_isr, skb); 3827 skb->len, rtl8192_tx_isr, skb);
3974 3828
3975#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3976 status = usb_submit_urb(tx_urb, GFP_ATOMIC); 3829 status = usb_submit_urb(tx_urb, GFP_ATOMIC);
3977#else
3978 status = usb_submit_urb(tx_urb);
3979#endif
3980 if (!status){ 3830 if (!status){
3981//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 3831//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
3982 bool bSend0Byte = false; 3832 bool bSend0Byte = false;
@@ -3994,11 +3844,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
3994 if (bSend0Byte) 3844 if (bSend0Byte)
3995 { 3845 {
3996#if 1 3846#if 1
3997#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3998 tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC); 3847 tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC);
3999#else
4000 tx_urb_zero = usb_alloc_urb(0);
4001#endif
4002 if(!tx_urb_zero){ 3848 if(!tx_urb_zero){
4003 RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n"); 3849 RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n");
4004 return -ENOMEM; 3850 return -ENOMEM;
@@ -4006,11 +3852,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
4006 usb_fill_bulk_urb(tx_urb_zero,udev, 3852 usb_fill_bulk_urb(tx_urb_zero,udev,
4007 usb_sndbulkpipe(udev,idx_pipe), &zero, 3853 usb_sndbulkpipe(udev,idx_pipe), &zero,
4008 0, tx_zero_isr, dev); 3854 0, tx_zero_isr, dev);
4009#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4010 status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC); 3855 status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC);
4011#else
4012 status = usb_submit_urb(tx_urb_zero);
4013#endif
4014 if (status){ 3856 if (status){
4015 RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); 3857 RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
4016 return -1; 3858 return -1;
@@ -4333,16 +4175,10 @@ static struct ieee80211_qos_parameters def_qos_parameters = {
4333}; 4175};
4334 4176
4335 4177
4336#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
4337void rtl8192_update_beacon(struct work_struct * work) 4178void rtl8192_update_beacon(struct work_struct * work)
4338{ 4179{
4339 struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work); 4180 struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work);
4340 struct net_device *dev = priv->ieee80211->dev; 4181 struct net_device *dev = priv->ieee80211->dev;
4341#else
4342void rtl8192_update_beacon(struct net_device *dev)
4343{
4344 struct r8192_priv *priv = ieee80211_priv(dev);
4345#endif
4346 struct ieee80211_device* ieee = priv->ieee80211; 4182 struct ieee80211_device* ieee = priv->ieee80211;
4347 struct ieee80211_network* net = &ieee->current_network; 4183 struct ieee80211_network* net = &ieee->current_network;
4348 4184
@@ -4357,16 +4193,11 @@ void rtl8192_update_beacon(struct net_device *dev)
4357* background support to run QoS activate functionality 4193* background support to run QoS activate functionality
4358*/ 4194*/
4359int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO}; 4195int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO};
4360#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20) 4196
4361void rtl8192_qos_activate(struct work_struct * work) 4197void rtl8192_qos_activate(struct work_struct * work)
4362{ 4198{
4363 struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate); 4199 struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate);
4364 struct net_device *dev = priv->ieee80211->dev; 4200 struct net_device *dev = priv->ieee80211->dev;
4365#else
4366void rtl8192_qos_activate(struct net_device *dev)
4367{
4368 struct r8192_priv *priv = ieee80211_priv(dev);
4369#endif
4370 struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; 4201 struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
4371 u8 mode = priv->ieee80211->current_network.mode; 4202 u8 mode = priv->ieee80211->current_network.mode;
4372 //u32 size = sizeof(struct ieee80211_qos_parameters); 4203 //u32 size = sizeof(struct ieee80211_qos_parameters);
@@ -4377,11 +4208,8 @@ void rtl8192_qos_activate(struct net_device *dev)
4377 if (priv == NULL) 4208 if (priv == NULL)
4378 return; 4209 return;
4379 4210
4380#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
4381 down(&priv->mutex);
4382#else
4383 mutex_lock(&priv->mutex); 4211 mutex_lock(&priv->mutex);
4384#endif 4212
4385 if(priv->ieee80211->state != IEEE80211_LINKED) 4213 if(priv->ieee80211->state != IEEE80211_LINKED)
4386 goto success; 4214 goto success;
4387 RT_TRACE(COMP_QOS,"qos active process with associate response received\n"); 4215 RT_TRACE(COMP_QOS,"qos active process with associate response received\n");
@@ -4401,11 +4229,7 @@ void rtl8192_qos_activate(struct net_device *dev)
4401 } 4229 }
4402 4230
4403success: 4231success:
4404#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
4405 up(&priv->mutex);
4406#else
4407 mutex_unlock(&priv->mutex); 4232 mutex_unlock(&priv->mutex);
4408#endif
4409} 4233}
4410 4234
4411static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, 4235static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
@@ -4432,11 +4256,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
4432 network->qos_data.param_count)) { 4256 network->qos_data.param_count)) {
4433 network->qos_data.old_param_count = 4257 network->qos_data.old_param_count =
4434 network->qos_data.param_count; 4258 network->qos_data.param_count;
4435#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4436 queue_work(priv->priv_wq, &priv->qos_activate); 4259 queue_work(priv->priv_wq, &priv->qos_activate);
4437#else
4438 schedule_task(&priv->qos_activate);
4439#endif
4440 RT_TRACE (COMP_QOS, "QoS parameters change call " 4260 RT_TRACE (COMP_QOS, "QoS parameters change call "
4441 "qos_activate\n"); 4261 "qos_activate\n");
4442 } 4262 }
@@ -4445,11 +4265,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
4445 &def_qos_parameters, size); 4265 &def_qos_parameters, size);
4446 4266
4447 if ((network->qos_data.active == 1) && (active_network == 1)) { 4267 if ((network->qos_data.active == 1) && (active_network == 1)) {
4448#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4449 queue_work(priv->priv_wq, &priv->qos_activate); 4268 queue_work(priv->priv_wq, &priv->qos_activate);
4450#else
4451 schedule_task(&priv->qos_activate);
4452#endif
4453 RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n"); 4269 RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n");
4454 } 4270 }
4455 network->qos_data.active = 0; 4271 network->qos_data.active = 0;
@@ -4467,16 +4283,8 @@ static int rtl8192_handle_beacon(struct net_device * dev,
4467 struct r8192_priv *priv = ieee80211_priv(dev); 4283 struct r8192_priv *priv = ieee80211_priv(dev);
4468 4284
4469 rtl8192_qos_handle_probe_response(priv,1,network); 4285 rtl8192_qos_handle_probe_response(priv,1,network);
4470#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
4471 queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0); 4286 queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0);
4472#else
4473#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
4474 schedule_task(&priv->update_beacon_wq);
4475#else
4476 queue_work(priv->priv_wq, &priv->update_beacon_wq);
4477#endif
4478 4287
4479#endif
4480 return 0; 4288 return 0;
4481 4289
4482} 4290}
@@ -4533,12 +4341,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv,
4533 4341
4534 RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active); 4342 RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active);
4535 if (set_qos_param == 1) 4343 if (set_qos_param == 1)
4536#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4537 queue_work(priv->priv_wq, &priv->qos_activate); 4344 queue_work(priv->priv_wq, &priv->qos_activate);
4538#else
4539 schedule_task(&priv->qos_activate);
4540#endif
4541
4542 4345
4543 return ret; 4346 return ret;
4544} 4347}
@@ -4793,7 +4596,7 @@ void rtl8192_hw_sleep_down(struct net_device *dev)
4793// MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS); 4596// MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS);
4794#endif 4597#endif
4795} 4598}
4796#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 4599
4797void rtl8192_hw_sleep_wq (struct work_struct *work) 4600void rtl8192_hw_sleep_wq (struct work_struct *work)
4798{ 4601{
4799// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq); 4602// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
@@ -4802,10 +4605,7 @@ void rtl8192_hw_sleep_wq (struct work_struct *work)
4802 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 4605 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
4803 struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_sleep_wq); 4606 struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_sleep_wq);
4804 struct net_device *dev = ieee->dev; 4607 struct net_device *dev = ieee->dev;
4805#else 4608
4806void rtl8192_hw_sleep_wq(struct net_device* dev)
4807{
4808#endif
4809 //printk("=========>%s()\n", __FUNCTION__); 4609 //printk("=========>%s()\n", __FUNCTION__);
4810 rtl8192_hw_sleep_down(dev); 4610 rtl8192_hw_sleep_down(dev);
4811} 4611}
@@ -4823,7 +4623,7 @@ void rtl8192_hw_wakeup(struct net_device* dev)
4823 //FIXME: will we send package stored while nic is sleep? 4623 //FIXME: will we send package stored while nic is sleep?
4824// spin_unlock_irqrestore(&priv->ps_lock,flags); 4624// spin_unlock_irqrestore(&priv->ps_lock,flags);
4825} 4625}
4826#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 4626
4827void rtl8192_hw_wakeup_wq (struct work_struct *work) 4627void rtl8192_hw_wakeup_wq (struct work_struct *work)
4828{ 4628{
4829// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq); 4629// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
@@ -4832,12 +4632,8 @@ void rtl8192_hw_wakeup_wq (struct work_struct *work)
4832 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 4632 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
4833 struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_wakeup_wq); 4633 struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_wakeup_wq);
4834 struct net_device *dev = ieee->dev; 4634 struct net_device *dev = ieee->dev;
4835#else
4836void rtl8192_hw_wakeup_wq(struct net_device* dev)
4837{
4838#endif
4839 rtl8192_hw_wakeup(dev);
4840 4635
4636 rtl8192_hw_wakeup(dev);
4841} 4637}
4842 4638
4843#define MIN_SLEEP_TIME 50 4639#define MIN_SLEEP_TIME 50
@@ -4881,11 +4677,7 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl)
4881 u32 tmp = (tl>rb)?(tl-rb):(rb-tl); 4677 u32 tmp = (tl>rb)?(tl-rb):(rb-tl);
4882 // if (tl<rb) 4678 // if (tl<rb)
4883 4679
4884#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
4885 schedule_task(&priv->ieee80211->hw_wakeup_wq);
4886#else
4887 queue_delayed_work(priv->ieee80211->wq, &priv->ieee80211->hw_wakeup_wq, tmp); //as tl may be less than rb 4680 queue_delayed_work(priv->ieee80211->wq, &priv->ieee80211->hw_wakeup_wq, tmp); //as tl may be less than rb
4888#endif
4889 } 4681 }
4890 /* if we suspect the TimerInt is gone beyond tl 4682 /* if we suspect the TimerInt is gone beyond tl
4891 * while setting it, then give up 4683 * while setting it, then give up
@@ -4902,11 +4694,8 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl)
4902// priv->rf_sleep(dev); 4694// priv->rf_sleep(dev);
4903 4695
4904 //printk("<=========%s()\n", __FUNCTION__); 4696 //printk("<=========%s()\n", __FUNCTION__);
4905#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
4906 schedule_task(&priv->ieee80211->hw_sleep_wq);
4907#else
4908 queue_delayed_work(priv->ieee80211->wq, (void *)&priv->ieee80211->hw_sleep_wq,0); 4697 queue_delayed_work(priv->ieee80211->wq, (void *)&priv->ieee80211->hw_sleep_wq,0);
4909#endif 4698
4910 spin_unlock_irqrestore(&priv->ps_lock,flags); 4699 spin_unlock_irqrestore(&priv->ps_lock,flags);
4911} 4700}
4912//init priv variables here. only non_zero value should be initialized here. 4701//init priv variables here. only non_zero value should be initialized here.
@@ -5113,18 +4902,10 @@ static void rtl8192_init_priv_lock(struct r8192_priv* priv)
5113 sema_init(&priv->wx_sem,1); 4902 sema_init(&priv->wx_sem,1);
5114 sema_init(&priv->rf_sem,1); 4903 sema_init(&priv->rf_sem,1);
5115 spin_lock_init(&priv->ps_lock); 4904 spin_lock_init(&priv->ps_lock);
5116#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
5117 sema_init(&priv->mutex, 1);
5118#else
5119 mutex_init(&priv->mutex); 4905 mutex_init(&priv->mutex);
5120#endif
5121} 4906}
5122 4907
5123#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
5124extern void rtl819x_watchdog_wqcallback(struct work_struct *work); 4908extern void rtl819x_watchdog_wqcallback(struct work_struct *work);
5125#else
5126extern void rtl819x_watchdog_wqcallback(struct net_device *dev);
5127#endif
5128 4909
5129void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); 4910void rtl8192_irq_rx_tasklet(struct r8192_priv *priv);
5130//init tasklet and wait_queue here. only 2.6 above kernel is considered 4911//init tasklet and wait_queue here. only 2.6 above kernel is considered
@@ -5133,15 +4914,12 @@ static void rtl8192_init_priv_task(struct net_device* dev)
5133{ 4914{
5134 struct r8192_priv *priv = ieee80211_priv(dev); 4915 struct r8192_priv *priv = ieee80211_priv(dev);
5135 4916
5136#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
5137#ifdef PF_SYNCTHREAD 4917#ifdef PF_SYNCTHREAD
5138 priv->priv_wq = create_workqueue(DRV_NAME,0); 4918 priv->priv_wq = create_workqueue(DRV_NAME,0);
5139#else 4919#else
5140 priv->priv_wq = create_workqueue(DRV_NAME); 4920 priv->priv_wq = create_workqueue(DRV_NAME);
5141#endif 4921#endif
5142#endif
5143 4922
5144#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
5145 INIT_WORK(&priv->reset_wq, rtl8192_restart); 4923 INIT_WORK(&priv->reset_wq, rtl8192_restart);
5146 4924
5147 //INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog); 4925 //INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog);
@@ -5157,36 +4935,6 @@ static void rtl8192_init_priv_task(struct net_device* dev)
5157 INIT_DELAYED_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq); 4935 INIT_DELAYED_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq);
5158 INIT_DELAYED_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq); 4936 INIT_DELAYED_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq);
5159 4937
5160#else
5161#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
5162 tq_init(&priv->reset_wq, (void*)rtl8192_restart, dev);
5163 tq_init(&priv->watch_dog_wq, (void*)rtl819x_watchdog_wqcallback, dev);
5164 tq_init(&priv->txpower_tracking_wq, (void*)dm_txpower_trackingcallback, dev);
5165 tq_init(&priv->rfpath_check_wq, (void*)dm_rf_pathcheck_workitemcallback, dev);
5166 tq_init(&priv->update_beacon_wq, (void*)rtl8192_update_beacon, dev);
5167 //tq_init(&priv->SwChnlWorkItem, (void*) rtl8192_SwChnl_WorkItem, dev);
5168 //tq_init(&priv->SetBWModeWorkItem, (void*)rtl8192_SetBWModeWorkItem, dev);
5169 tq_init(&priv->qos_activate, (void *)rtl8192_qos_activate, dev);
5170 tq_init(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq, dev);
5171 tq_init(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq, dev);
5172
5173#else
5174 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8192_restart,dev);
5175 //INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) hal_dm_watchdog,dev);
5176 INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) rtl819x_watchdog_wqcallback,dev);
5177 INIT_WORK(&priv->txpower_tracking_wq, (void(*)(void*)) dm_txpower_trackingcallback,dev);
5178// INIT_WORK(&priv->gpio_change_rf_wq, (void(*)(void*)) dm_gpio_change_rf_callback,dev);
5179 INIT_WORK(&priv->rfpath_check_wq, (void(*)(void*)) dm_rf_pathcheck_workitemcallback,dev);
5180 INIT_WORK(&priv->update_beacon_wq, (void(*)(void*))rtl8192_update_beacon,dev);
5181 INIT_WORK(&priv->initialgain_operate_wq, (void(*)(void*))InitialGainOperateWorkItemCallBack,dev);
5182 //INIT_WORK(&priv->SwChnlWorkItem, (void(*)(void*)) rtl8192_SwChnl_WorkItem, dev);
5183 //INIT_WORK(&priv->SetBWModeWorkItem, (void(*)(void*)) rtl8192_SetBWModeWorkItem, dev);
5184 INIT_WORK(&priv->qos_activate, (void(*)(void *))rtl8192_qos_activate, dev);
5185 INIT_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq, dev);
5186 INIT_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq, dev);
5187#endif
5188#endif
5189
5190 tasklet_init(&priv->irq_rx_tasklet, 4938 tasklet_init(&priv->irq_rx_tasklet,
5191 (void(*)(unsigned long))rtl8192_irq_rx_tasklet, 4939 (void(*)(unsigned long))rtl8192_irq_rx_tasklet,
5192 (unsigned long)priv); 4940 (unsigned long)priv);
@@ -9092,9 +8840,7 @@ RESET_START:
9092 printk("ieee->state is IEEE80211_LINKED\n"); 8840 printk("ieee->state is IEEE80211_LINKED\n");
9093 ieee80211_stop_send_beacons(priv->ieee80211); 8841 ieee80211_stop_send_beacons(priv->ieee80211);
9094 del_timer_sync(&ieee->associate_timer); 8842 del_timer_sync(&ieee->associate_timer);
9095 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
9096 cancel_delayed_work(&ieee->associate_retry_wq); 8843 cancel_delayed_work(&ieee->associate_retry_wq);
9097 #endif
9098 ieee80211_stop_scan(ieee); 8844 ieee80211_stop_scan(ieee);
9099 netif_carrier_off(dev); 8845 netif_carrier_off(dev);
9100 up(&ieee->wx_sem); 8846 up(&ieee->wx_sem);
@@ -9131,11 +8877,7 @@ RESET_START:
9131 ieee->set_chan(ieee->dev, ieee->current_network.channel); 8877 ieee->set_chan(ieee->dev, ieee->current_network.channel);
9132 8878
9133#if 1 8879#if 1
9134#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
9135 queue_work(ieee->wq, &ieee->associate_complete_wq); 8880 queue_work(ieee->wq, &ieee->associate_complete_wq);
9136#else
9137 schedule_task(&ieee->associate_complete_wq);
9138#endif
9139#endif 8881#endif
9140 8882
9141 } 8883 }
@@ -9231,18 +8973,11 @@ void rtl819x_update_rxcounts(
9231 } 8973 }
9232} 8974}
9233 8975
9234
9235#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
9236extern void rtl819x_watchdog_wqcallback(struct work_struct *work) 8976extern void rtl819x_watchdog_wqcallback(struct work_struct *work)
9237{ 8977{
9238 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 8978 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
9239 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq); 8979 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq);
9240 struct net_device *dev = priv->ieee80211->dev; 8980 struct net_device *dev = priv->ieee80211->dev;
9241#else
9242extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
9243{
9244 struct r8192_priv *priv = ieee80211_priv(dev);
9245#endif
9246 struct ieee80211_device* ieee = priv->ieee80211; 8981 struct ieee80211_device* ieee = priv->ieee80211;
9247 RESET_TYPE ResetType = RESET_TYPE_NORESET; 8982 RESET_TYPE ResetType = RESET_TYPE_NORESET;
9248 static u8 check_reset_cnt=0; 8983 static u8 check_reset_cnt=0;
@@ -9288,12 +9023,7 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
9288 RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid); 9023 RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid);
9289 ieee->is_roaming = true; 9024 ieee->is_roaming = true;
9290 priv->ieee80211->link_change(dev); 9025 priv->ieee80211->link_change(dev);
9291#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
9292 queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq); 9026 queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq);
9293#else
9294 schedule_task(&priv->ieee80211->associate_procedure_wq);
9295#endif
9296
9297 } 9027 }
9298 } 9028 }
9299 priv->ieee80211->LinkDetectInfo.NumRecvBcnInPeriod=0; 9029 priv->ieee80211->LinkDetectInfo.NumRecvBcnInPeriod=0;
@@ -9328,15 +9058,7 @@ void watch_dog_timer_callback(unsigned long data)
9328{ 9058{
9329 struct r8192_priv *priv = ieee80211_priv((struct net_device *) data); 9059 struct r8192_priv *priv = ieee80211_priv((struct net_device *) data);
9330 //printk("===============>watch_dog timer\n"); 9060 //printk("===============>watch_dog timer\n");
9331#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
9332 queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq, 0); 9061 queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq, 0);
9333#else
9334#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
9335 schedule_task(&priv->watch_dog_wq);
9336#else
9337 queue_work(priv->priv_wq,&priv->watch_dog_wq);
9338#endif
9339#endif
9340 mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME)); 9062 mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME));
9341#if 0 9063#if 0
9342 priv->watch_dog_timer.expires = jiffies + MSECS(IEEE80211_WATCH_DOG_TIME); 9064 priv->watch_dog_timer.expires = jiffies + MSECS(IEEE80211_WATCH_DOG_TIME);
@@ -9488,17 +9210,10 @@ void rtl8192_restart(struct net_device *dev)
9488{ 9210{
9489 struct r8192_priv *priv = ieee80211_priv(dev); 9211 struct r8192_priv *priv = ieee80211_priv(dev);
9490*/ 9212*/
9491#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
9492void rtl8192_restart(struct work_struct *work) 9213void rtl8192_restart(struct work_struct *work)
9493{ 9214{
9494 struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); 9215 struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq);
9495 struct net_device *dev = priv->ieee80211->dev; 9216 struct net_device *dev = priv->ieee80211->dev;
9496#else
9497void rtl8192_restart(struct net_device *dev)
9498{
9499
9500 struct r8192_priv *priv = ieee80211_priv(dev);
9501#endif
9502 9217
9503 down(&priv->wx_sem); 9218 down(&priv->wx_sem);
9504 9219
@@ -9537,11 +9252,8 @@ int r8192_set_mac_adr(struct net_device *dev, void *mac)
9537 9252
9538 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 9253 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
9539 9254
9540#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
9541 schedule_work(&priv->reset_wq); 9255 schedule_work(&priv->reset_wq);
9542#else 9256
9543 schedule_task(&priv->reset_wq);
9544#endif
9545 up(&priv->wx_sem); 9257 up(&priv->wx_sem);
9546 9258
9547 return 0; 9259 return 0;
@@ -12038,7 +11750,6 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv)
12038/**************************************************************************** 11750/****************************************************************************
12039 ---------------------------- USB_STUFF--------------------------- 11751 ---------------------------- USB_STUFF---------------------------
12040*****************************************************************************/ 11752*****************************************************************************/
12041#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12042//LZM Merge from windows HalUsbSetQueuePipeMapping8192SUsb 090319 11753//LZM Merge from windows HalUsbSetQueuePipeMapping8192SUsb 090319
12043static void HalUsbSetQueuePipeMapping8192SUsb(struct usb_interface *intf, struct net_device *dev) 11754static void HalUsbSetQueuePipeMapping8192SUsb(struct usb_interface *intf, struct net_device *dev)
12044{ 11755{
@@ -12058,7 +11769,6 @@ static void HalUsbSetQueuePipeMapping8192SUsb(struct usb_interface *intf, struct
12058 11769
12059 for (i = 0; i < priv->ep_num; ++i) { 11770 for (i = 0; i < priv->ep_num; ++i) {
12060 endpoint = &iface_desc->endpoint[i].desc; 11771 endpoint = &iface_desc->endpoint[i].desc;
12061#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
12062 if (usb_endpoint_is_bulk_in(endpoint)) { 11772 if (usb_endpoint_is_bulk_in(endpoint)) {
12063 priv->RtInPipes[priv->ep_in_num] = usb_endpoint_num(endpoint); 11773 priv->RtInPipes[priv->ep_in_num] = usb_endpoint_num(endpoint);
12064 priv->ep_in_num ++; 11774 priv->ep_in_num ++;
@@ -12068,19 +11778,6 @@ static void HalUsbSetQueuePipeMapping8192SUsb(struct usb_interface *intf, struct
12068 priv->ep_out_num ++; 11778 priv->ep_out_num ++;
12069 //printk("out_endpoint_idx = %d\n", usb_endpoint_num(endpoint)); 11779 //printk("out_endpoint_idx = %d\n", usb_endpoint_num(endpoint));
12070 } 11780 }
12071#else
12072 if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) &&
12073 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) {
12074 /* we found a bulk in endpoint */
12075 priv->RtInPipes[priv->ep_in_num] = (endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
12076 priv->ep_in_num ++;
12077 } else if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) &&
12078 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) {
12079 /* We found bulk out endpoint */
12080 priv->RtOutPipes[priv->ep_out_num] = endpoint->bEndpointAddress;
12081 priv->ep_out_num ++;
12082 }
12083#endif
12084 } 11781 }
12085 { 11782 {
12086 memset(priv->txqueue_to_outpipemap,0,9); 11783 memset(priv->txqueue_to_outpipemap,0,9);
@@ -12130,7 +11827,6 @@ static void HalUsbSetQueuePipeMapping8192SUsb(struct usb_interface *intf, struct
12130 11827
12131 return; 11828 return;
12132} 11829}
12133#endif
12134 11830
12135static const struct net_device_ops rtl8192_netdev_ops = { 11831static const struct net_device_ops rtl8192_netdev_ops = {
12136 .ndo_open = rtl8192_open, 11832 .ndo_open = rtl8192_open,
@@ -12145,50 +11841,26 @@ static const struct net_device_ops rtl8192_netdev_ops = {
12145 .ndo_start_xmit = rtl8192_ieee80211_xmit, 11841 .ndo_start_xmit = rtl8192_ieee80211_xmit,
12146}; 11842};
12147 11843
12148#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12149static int __devinit rtl8192_usb_probe(struct usb_interface *intf, 11844static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
12150 const struct usb_device_id *id) 11845 const struct usb_device_id *id)
12151#else
12152static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
12153 unsigned int ifnum,
12154 const struct usb_device_id *id)
12155#endif
12156{ 11846{
12157// unsigned long ioaddr = 0; 11847// unsigned long ioaddr = 0;
12158 struct net_device *dev = NULL; 11848 struct net_device *dev = NULL;
12159 struct r8192_priv *priv= NULL; 11849 struct r8192_priv *priv= NULL;
12160#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12161 struct usb_device *udev = interface_to_usbdev(intf); 11850 struct usb_device *udev = interface_to_usbdev(intf);
12162#endif 11851
12163 RT_TRACE(COMP_INIT, "Oops: i'm coming\n"); 11852 RT_TRACE(COMP_INIT, "Oops: i'm coming\n");
12164 11853
12165 dev = alloc_ieee80211(sizeof(struct r8192_priv)); 11854 dev = alloc_ieee80211(sizeof(struct r8192_priv));
12166 11855
12167#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
12168 SET_MODULE_OWNER(dev);
12169#endif
12170
12171#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12172 usb_set_intfdata(intf, dev); 11856 usb_set_intfdata(intf, dev);
12173 SET_NETDEV_DEV(dev, &intf->dev); 11857 SET_NETDEV_DEV(dev, &intf->dev);
12174#endif
12175 priv = ieee80211_priv(dev); 11858 priv = ieee80211_priv(dev);
12176#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12177 priv->ieee80211 = netdev_priv(dev); 11859 priv->ieee80211 = netdev_priv(dev);
12178#else
12179 priv->ieee80211 = (struct net_device *)dev->priv;
12180#endif
12181 priv->udev=udev; 11860 priv->udev=udev;
12182 11861
12183#ifdef RTL8192SU 11862#ifdef RTL8192SU
12184#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12185 HalUsbSetQueuePipeMapping8192SUsb(intf, dev); 11863 HalUsbSetQueuePipeMapping8192SUsb(intf, dev);
12186#else//use one pipe
12187 {
12188 memset(priv->txqueue_to_outpipemap,0,9);
12189 memset(priv->RtOutPipes,4,16);//all use endpoint 4 for out
12190 }
12191#endif
12192#endif 11864#endif
12193 11865
12194#ifdef RTL8192SU 11866#ifdef RTL8192SU
@@ -12234,29 +11906,17 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
12234 11906
12235 11907
12236 RT_TRACE(COMP_INIT, "Driver probe completed\n"); 11908 RT_TRACE(COMP_INIT, "Driver probe completed\n");
12237#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
12238 return dev;
12239#else
12240 return 0; 11909 return 0;
12241#endif
12242
12243
12244fail: 11910fail:
12245 free_ieee80211(dev); 11911 free_ieee80211(dev);
12246 11912
12247 RT_TRACE(COMP_ERR, "wlan driver load failed\n"); 11913 RT_TRACE(COMP_ERR, "wlan driver load failed\n");
12248#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
12249 return NULL;
12250#else
12251 return -ENODEV; 11914 return -ENODEV;
12252#endif
12253
12254} 11915}
12255 11916
12256//detach all the work and timer structure declared or inititialize in r8192U_init function. 11917//detach all the work and timer structure declared or inititialize in r8192U_init function.
12257void rtl8192_cancel_deferred_work(struct r8192_priv* priv) 11918void rtl8192_cancel_deferred_work(struct r8192_priv* priv)
12258{ 11919{
12259#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
12260 cancel_work_sync(&priv->reset_wq); 11920 cancel_work_sync(&priv->reset_wq);
12261 cancel_work_sync(&priv->qos_activate); 11921 cancel_work_sync(&priv->qos_activate);
12262 cancel_delayed_work(&priv->watch_dog_wq); 11922 cancel_delayed_work(&priv->watch_dog_wq);
@@ -12265,35 +11925,11 @@ void rtl8192_cancel_deferred_work(struct r8192_priv* priv)
12265 cancel_delayed_work(&priv->ieee80211->hw_sleep_wq); 11925 cancel_delayed_work(&priv->ieee80211->hw_sleep_wq);
12266 //cancel_work_sync(&priv->SetBWModeWorkItem); 11926 //cancel_work_sync(&priv->SetBWModeWorkItem);
12267 //cancel_work_sync(&priv->SwChnlWorkItem); 11927 //cancel_work_sync(&priv->SwChnlWorkItem);
12268#else
12269#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12270 cancel_delayed_work(&priv->reset_wq);
12271 cancel_delayed_work(&priv->qos_activate);
12272 cancel_delayed_work(&priv->watch_dog_wq);
12273 cancel_delayed_work(&priv->update_beacon_wq);
12274 cancel_delayed_work(&priv->ieee80211->hw_wakeup_wq);
12275 cancel_delayed_work(&priv->ieee80211->hw_sleep_wq);
12276
12277 //cancel_delayed_work(&priv->SetBWModeWorkItem);
12278 //cancel_delayed_work(&priv->SwChnlWorkItem);
12279#endif
12280#endif
12281
12282} 11928}
12283 11929
12284
12285#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12286static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf) 11930static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf)
12287#else
12288static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
12289#endif
12290{ 11931{
12291#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
12292 struct net_device *dev = usb_get_intfdata(intf); 11932 struct net_device *dev = usb_get_intfdata(intf);
12293#else
12294 struct net_device *dev = (struct net_device *)ptr;
12295#endif
12296
12297 struct r8192_priv *priv = ieee80211_priv(dev); 11933 struct r8192_priv *priv = ieee80211_priv(dev);
12298 if(dev){ 11934 if(dev){
12299 11935
@@ -12310,9 +11946,7 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
12310 } 11946 }
12311 // priv->rf_close(dev); 11947 // priv->rf_close(dev);
12312// rtl8192_SetRFPowerState(dev, eRfOff); 11948// rtl8192_SetRFPowerState(dev, eRfOff);
12313#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
12314 destroy_workqueue(priv->priv_wq); 11949 destroy_workqueue(priv->priv_wq);
12315#endif
12316 //rtl8192_irq_disable(dev); 11950 //rtl8192_irq_disable(dev);
12317 //rtl8192_reset(dev); 11951 //rtl8192_reset(dev);
12318 mdelay(10); 11952 mdelay(10);
diff --git a/drivers/staging/rtl8192su/r8192U_dm.c b/drivers/staging/rtl8192su/r8192U_dm.c
index 304274b886e..7902f623f8f 100644
--- 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_device *dev);
98 98
99 99
100extern void init_rate_adaptive(struct net_device *dev); 100extern void init_rate_adaptive(struct net_device *dev);
101#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
102extern void dm_txpower_trackingcallback(struct work_struct *work); 101extern void dm_txpower_trackingcallback(struct work_struct *work);
103#else
104extern void dm_txpower_trackingcallback(struct net_device *dev);
105#endif
106
107extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); 102extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
108extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); 103extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
109extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); 104extern void dm_backup_dynamic_mechanism_state(struct net_device *dev);
@@ -118,11 +113,7 @@ extern void dm_force_tx_fw_info(struct net_device *dev,
118 u32 force_value); 113 u32 force_value);
119extern void dm_init_edca_turbo(struct net_device *dev); 114extern void dm_init_edca_turbo(struct net_device *dev);
120extern void dm_rf_operation_test_callback(unsigned long data); 115extern void dm_rf_operation_test_callback(unsigned long data);
121#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
122extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); 116extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
123#else
124extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev);
125#endif
126extern void dm_fsync_timer_callback(unsigned long data); 117extern void dm_fsync_timer_callback(unsigned long data);
127#if 0 118#if 0
128extern bool dm_check_lbus_status(struct net_device *dev); 119extern bool dm_check_lbus_status(struct net_device *dev);
@@ -1180,17 +1171,11 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev)
1180 priv->txpower_count = 0; 1171 priv->txpower_count = 0;
1181} 1172}
1182 1173
1183#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1184extern void dm_txpower_trackingcallback(struct work_struct *work) 1174extern void dm_txpower_trackingcallback(struct work_struct *work)
1185{ 1175{
1186 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 1176 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
1187 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq); 1177 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq);
1188 struct net_device *dev = priv->ieee80211->dev; 1178 struct net_device *dev = priv->ieee80211->dev;
1189#else
1190extern void dm_txpower_trackingcallback(struct net_device *dev)
1191{
1192 struct r8192_priv *priv = ieee80211_priv(dev);
1193#endif
1194 1179
1195#ifdef RTL8190P 1180#ifdef RTL8190P
1196 dm_TXPowerTrackingCallback_TSSI(dev); 1181 dm_TXPowerTrackingCallback_TSSI(dev);
@@ -1754,15 +1739,7 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
1754 { 1739 {
1755 if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0)) 1740 if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0))
1756 { 1741 {
1757 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1758 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); 1742 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
1759 #else
1760 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1761 schedule_task(&priv->txpower_tracking_wq);
1762 #else
1763 queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
1764 #endif
1765 #endif
1766 } 1743 }
1767 tx_power_track_counter++; 1744 tx_power_track_counter++;
1768 } 1745 }
@@ -1821,15 +1798,7 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
1821 else 1798 else
1822 { 1799 {
1823 //DbgPrint("Schedule TxPowerTrackingWorkItem\n"); 1800 //DbgPrint("Schedule TxPowerTrackingWorkItem\n");
1824 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1825 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); 1801 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
1826 #else
1827 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1828 schedule_task(&priv->txpower_tracking_wq);
1829 #else
1830 queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
1831 #endif
1832 #endif
1833 TM_Trigger = 0; 1802 TM_Trigger = 0;
1834 } 1803 }
1835#endif 1804#endif
@@ -3345,15 +3314,7 @@ static void dm_check_rfctrl_gpio(struct net_device * dev)
3345 return; 3314 return;
3346#endif 3315#endif
3347#ifdef RTL8192E 3316#ifdef RTL8192E
3348 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
3349 queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0); 3317 queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0);
3350 #else
3351 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
3352 schedule_task(&priv->gpio_change_rf_wq);
3353 #else
3354 queue_work(priv->priv_wq,&priv->gpio_change_rf_wq);
3355 #endif
3356 #endif
3357#endif 3318#endif
3358 3319
3359} /* dm_CheckRfCtrlGPIO */ 3320} /* dm_CheckRfCtrlGPIO */
@@ -3442,17 +3403,11 @@ static void dm_check_pbc_gpio(struct net_device *dev)
3442 * 02/21/2008 MHC Create Version 0. 3403 * 02/21/2008 MHC Create Version 0.
3443 * 3404 *
3444 *---------------------------------------------------------------------------*/ 3405 *---------------------------------------------------------------------------*/
3445 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3446extern void dm_gpio_change_rf_callback(struct work_struct *work) 3406extern void dm_gpio_change_rf_callback(struct work_struct *work)
3447{ 3407{
3448 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 3408 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
3449 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq); 3409 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq);
3450 struct net_device *dev = priv->ieee80211->dev; 3410 struct net_device *dev = priv->ieee80211->dev;
3451#else
3452extern void dm_gpio_change_rf_callback(struct net_device *dev)
3453{
3454 struct r8192_priv *priv = ieee80211_priv(dev);
3455#endif
3456 u8 tmp1byte; 3411 u8 tmp1byte;
3457 RT_RF_POWER_STATE eRfPowerStateToSet; 3412 RT_RF_POWER_STATE eRfPowerStateToSet;
3458 bool bActuallySet = false; 3413 bool bActuallySet = false;
@@ -3520,17 +3475,11 @@ extern void dm_gpio_change_rf_callback(struct net_device *dev)
3520 * 01/30/2008 MHC Create Version 0. 3475 * 01/30/2008 MHC Create Version 0.
3521 * 3476 *
3522 *---------------------------------------------------------------------------*/ 3477 *---------------------------------------------------------------------------*/
3523#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3524extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work) 3478extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
3525{ 3479{
3526 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 3480 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
3527 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq); 3481 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq);
3528 struct net_device *dev =priv->ieee80211->dev; 3482 struct net_device *dev =priv->ieee80211->dev;
3529#else
3530extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev)
3531{
3532 struct r8192_priv *priv = ieee80211_priv(dev);
3533#endif
3534 //bool bactually_set = false; 3483 //bool bactually_set = false;
3535 u8 rfpath = 0, i; 3484 u8 rfpath = 0, i;
3536 3485
@@ -3855,15 +3804,8 @@ static void dm_rxpath_sel_byrssi(struct net_device * dev)
3855static void dm_check_rx_path_selection(struct net_device *dev) 3804static void dm_check_rx_path_selection(struct net_device *dev)
3856{ 3805{
3857 struct r8192_priv *priv = ieee80211_priv(dev); 3806 struct r8192_priv *priv = ieee80211_priv(dev);
3858#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 3807
3859 queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0); 3808 queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0);
3860#else
3861#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
3862 schedule_task(&priv->rfpath_check_wq);
3863#else
3864 queue_work(priv->priv_wq,&priv->rfpath_check_wq);
3865#endif
3866#endif
3867} /* dm_CheckRxRFPath */ 3809} /* dm_CheckRxRFPath */
3868 3810
3869 3811
diff --git a/drivers/staging/rtl8192su/r8192U_dm.h b/drivers/staging/rtl8192su/r8192U_dm.h
index 1e05d757988..c21c2d864ac 100644
--- 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_device *dev);
275extern void hal_dm_watchdog(struct net_device *dev); 275extern void hal_dm_watchdog(struct net_device *dev);
276 276
277extern void init_rate_adaptive(struct net_device *dev); 277extern void init_rate_adaptive(struct net_device *dev);
278#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
279extern void dm_txpower_trackingcallback(struct work_struct *work); 278extern void dm_txpower_trackingcallback(struct work_struct *work);
280#else
281extern void dm_txpower_trackingcallback(struct net_device *dev);
282#endif
283extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); 279extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
284extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); 280extern void dm_backup_dynamic_mechanism_state(struct net_device *dev);
285extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, 281extern void dm_change_dynamic_initgain_thresh(struct net_device *dev,
@@ -287,11 +283,7 @@ extern void dm_change_dynamic_initgain_thresh(struct net_device *dev,
287extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value); 283extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value);
288extern void dm_init_edca_turbo(struct net_device *dev); 284extern void dm_init_edca_turbo(struct net_device *dev);
289extern void dm_rf_operation_test_callback(unsigned long data); 285extern void dm_rf_operation_test_callback(unsigned long data);
290#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
291extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); 286extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
292#else
293extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev);
294#endif
295extern void dm_fsync_timer_callback(unsigned long data); 287extern void dm_fsync_timer_callback(unsigned long data);
296extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); 288extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
297#if 0 289#if 0
diff --git a/drivers/staging/rtl8192su/r8192U_pm.c b/drivers/staging/rtl8192su/r8192U_pm.c
index b1531a8d0cd..d095f7dff9e 100644
--- 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 *dev, u32 state)
22 22
23int rtl8192U_suspend(struct usb_interface *intf, pm_message_t state) 23int rtl8192U_suspend(struct usb_interface *intf, pm_message_t state)
24{ 24{
25#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
26 struct net_device *dev = usb_get_intfdata(intf); 25 struct net_device *dev = usb_get_intfdata(intf);
27#else 26
28 //struct net_device *dev = (struct net_device *)ptr;
29#endif
30 RT_TRACE(COMP_POWER, "============> r8192U suspend call.\n"); 27 RT_TRACE(COMP_POWER, "============> r8192U suspend call.\n");
31 28
32 if(dev) { 29 if(dev) {
@@ -48,11 +45,7 @@ int rtl8192U_suspend(struct usb_interface *intf, pm_message_t state)
48 45
49int rtl8192U_resume (struct usb_interface *intf) 46int rtl8192U_resume (struct usb_interface *intf)
50{ 47{
51#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
52 struct net_device *dev = usb_get_intfdata(intf); 48 struct net_device *dev = usb_get_intfdata(intf);
53#else
54 //struct net_device *dev = (struct net_device *)ptr;
55#endif
56 49
57 RT_TRACE(COMP_POWER, "================>r8192U resume call."); 50 RT_TRACE(COMP_POWER, "================>r8192U resume call.");
58 51
diff --git a/drivers/staging/rtl8192su/r8192U_wx.c b/drivers/staging/rtl8192su/r8192U_wx.c
index 9b3c4db5d4c..4568312a52a 100644
--- 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 net_device *dev,
981 union iwreq_data *wrqu, char *extra) 981 union iwreq_data *wrqu, char *extra)
982{ 982{
983 int ret=0; 983 int ret=0;
984 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
985 struct r8192_priv *priv = ieee80211_priv(dev); 984 struct r8192_priv *priv = ieee80211_priv(dev);
986 struct ieee80211_device* ieee = priv->ieee80211; 985 struct ieee80211_device* ieee = priv->ieee80211;
987 //printk("===>%s()\n", __FUNCTION__); 986 //printk("===>%s()\n", __FUNCTION__);
@@ -1065,22 +1064,19 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
1065end_hw_sec: 1064end_hw_sec:
1066 1065
1067 up(&priv->wx_sem); 1066 up(&priv->wx_sem);
1068#endif
1069 return ret; 1067 return ret;
1070
1071} 1068}
1072static int r8192_wx_set_auth(struct net_device *dev, 1069static int r8192_wx_set_auth(struct net_device *dev,
1073 struct iw_request_info *info, 1070 struct iw_request_info *info,
1074 union iwreq_data *data, char *extra) 1071 union iwreq_data *data, char *extra)
1075{ 1072{
1076 int ret=0; 1073 int ret=0;
1077#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 1074
1078 //printk("====>%s()\n", __FUNCTION__); 1075 //printk("====>%s()\n", __FUNCTION__);
1079 struct r8192_priv *priv = ieee80211_priv(dev); 1076 struct r8192_priv *priv = ieee80211_priv(dev);
1080 down(&priv->wx_sem); 1077 down(&priv->wx_sem);
1081 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra); 1078 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra);
1082 up(&priv->wx_sem); 1079 up(&priv->wx_sem);
1083#endif
1084 return ret; 1080 return ret;
1085} 1081}
1086 1082
@@ -1091,13 +1087,10 @@ static int r8192_wx_set_mlme(struct net_device *dev,
1091 //printk("====>%s()\n", __FUNCTION__); 1087 //printk("====>%s()\n", __FUNCTION__);
1092 1088
1093 int ret=0; 1089 int ret=0;
1094#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1095 struct r8192_priv *priv = ieee80211_priv(dev); 1090 struct r8192_priv *priv = ieee80211_priv(dev);
1096 down(&priv->wx_sem); 1091 down(&priv->wx_sem);
1097 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra); 1092 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra);
1098
1099 up(&priv->wx_sem); 1093 up(&priv->wx_sem);
1100#endif
1101 return ret; 1094 return ret;
1102} 1095}
1103#endif 1096#endif
@@ -1107,7 +1100,6 @@ static int r8192_wx_set_gen_ie(struct net_device *dev,
1107{ 1100{
1108 //printk("====>%s(), len:%d\n", __FUNCTION__, data->length); 1101 //printk("====>%s(), len:%d\n", __FUNCTION__, data->length);
1109 int ret=0; 1102 int ret=0;
1110#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1111 struct r8192_priv *priv = ieee80211_priv(dev); 1103 struct r8192_priv *priv = ieee80211_priv(dev);
1112 down(&priv->wx_sem); 1104 down(&priv->wx_sem);
1113#if 1 1105#if 1
@@ -1115,7 +1107,6 @@ static int r8192_wx_set_gen_ie(struct net_device *dev,
1115#endif 1107#endif
1116 up(&priv->wx_sem); 1108 up(&priv->wx_sem);
1117 //printk("<======%s(), ret:%d\n", __FUNCTION__, ret); 1109 //printk("<======%s(), ret:%d\n", __FUNCTION__, ret);
1118#endif
1119 return ret; 1110 return ret;
1120 1111
1121 1112
@@ -1311,11 +1302,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
1311 wstats->qual.qual = 0; 1302 wstats->qual.qual = 0;
1312 wstats->qual.level = 0; 1303 wstats->qual.level = 0;
1313 wstats->qual.noise = 0; 1304 wstats->qual.noise = 0;
1314#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
1315 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; 1305 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
1316#else
1317 wstats->qual.updated = 0x0f;
1318#endif
1319 return wstats; 1306 return wstats;
1320 } 1307 }
1321 1308
@@ -1327,11 +1314,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
1327 wstats->qual.level = tmp_level; 1314 wstats->qual.level = tmp_level;
1328 wstats->qual.qual = tmp_qual; 1315 wstats->qual.qual = tmp_qual;
1329 wstats->qual.noise = tmp_noise; 1316 wstats->qual.noise = tmp_noise;
1330#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
1331 wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM; 1317 wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM;
1332#else
1333 wstats->qual.updated = 0x0f;
1334#endif
1335 return wstats; 1318 return wstats;
1336} 1319}
1337//#endif 1320//#endif
diff --git a/drivers/staging/rtl8192su/r819xU_firmware.c b/drivers/staging/rtl8192su/r819xU_firmware.c
index 68ba5d4a612..6a10bc11d97 100644
--- a/drivers/staging/rtl8192su/r819xU_firmware.c
+++ b/drivers/staging/rtl8192su/r819xU_firmware.c
@@ -15,9 +15,8 @@
15#include "r8192U_hw.h" 15#include "r8192U_hw.h"
16#include "r819xU_firmware_img.h" 16#include "r819xU_firmware_img.h"
17#include "r819xU_firmware.h" 17#include "r819xU_firmware.h"
18#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
19#include <linux/firmware.h> 18#include <linux/firmware.h>
20#endif 19
21void firmware_init_param(struct net_device *dev) 20void firmware_init_param(struct net_device *dev)
22{ 21{
23 struct r8192_priv *priv = ieee80211_priv(dev); 22 struct r8192_priv *priv = ieee80211_priv(dev);
@@ -338,11 +337,8 @@ bool init_firmware(struct net_device *dev)
338 * Download boot, main, and data image for System reset. 337 * Download boot, main, and data image for System reset.
339 * Download data image for firmware reseta 338 * Download data image for firmware reseta
340 */ 339 */
341#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
342 priv->firmware_source = FW_SOURCE_HEADER_FILE;
343#else
344 priv->firmware_source = FW_SOURCE_IMG_FILE; 340 priv->firmware_source = FW_SOURCE_IMG_FILE;
345#endif 341
346 for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) { 342 for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
347 /* 343 /*
348 * Open Image file, and map file to contineous memory if open file success. 344 * Open Image file, and map file to contineous memory if open file success.
@@ -351,7 +347,6 @@ bool init_firmware(struct net_device *dev)
351 if(rst_opt == OPT_SYSTEM_RESET) { 347 if(rst_opt == OPT_SYSTEM_RESET) {
352 switch(priv->firmware_source) { 348 switch(priv->firmware_source) {
353 case FW_SOURCE_IMG_FILE: 349 case FW_SOURCE_IMG_FILE:
354#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
355 if(pfirmware->firmware_buf_size[init_step] == 0) { 350 if(pfirmware->firmware_buf_size[init_step] == 0) {
356 rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev); 351 rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev);
357 if(rc < 0 ) { 352 if(rc < 0 ) {
@@ -382,16 +377,12 @@ bool init_firmware(struct net_device *dev)
382 } 377 }
383 //pfirmware->firmware_buf_size = file_length; 378 //pfirmware->firmware_buf_size = file_length;
384 379
385#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
386 if(rst_opt == OPT_SYSTEM_RESET) { 380 if(rst_opt == OPT_SYSTEM_RESET) {
387 release_firmware(fw_entry); 381 release_firmware(fw_entry);
388 } 382 }
389#endif
390 } 383 }
391 mapped_file = pfirmware->firmware_buf[init_step]; 384 mapped_file = pfirmware->firmware_buf[init_step];
392 file_length = pfirmware->firmware_buf_size[init_step]; 385 file_length = pfirmware->firmware_buf_size[init_step];
393#endif
394
395 break; 386 break;
396 387
397 case FW_SOURCE_HEADER_FILE: 388 case FW_SOURCE_HEADER_FILE:
diff --git a/drivers/staging/rtl8192su/r819xU_phy.c b/drivers/staging/rtl8192su/r819xU_phy.c
index 81b462aa1c3..f8f7de8dd85 100644
--- a/drivers/staging/rtl8192su/r819xU_phy.c
+++ b/drivers/staging/rtl8192su/r819xU_phy.c
@@ -1726,29 +1726,15 @@ void InitialGain819xUsb(struct net_device *dev, u8 Operation)
1726 1726
1727 if(priv->up) 1727 if(priv->up)
1728 { 1728 {
1729 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1730 queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0); 1729 queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0);
1731 #else
1732 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1733 schedule_task(&priv->initialgain_operate_wq);
1734 #else
1735 queue_work(priv->priv_wq,&priv->initialgain_operate_wq);
1736 #endif
1737 #endif
1738 } 1730 }
1739} 1731}
1740 1732
1741#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1742extern void InitialGainOperateWorkItemCallBack(struct work_struct *work) 1733extern void InitialGainOperateWorkItemCallBack(struct work_struct *work)
1743{ 1734{
1744 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 1735 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
1745 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq); 1736 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq);
1746 struct net_device *dev = priv->ieee80211->dev; 1737 struct net_device *dev = priv->ieee80211->dev;
1747#else
1748extern void InitialGainOperateWorkItemCallBack(struct net_device *dev)
1749{
1750 struct r8192_priv *priv = ieee80211_priv(dev);
1751#endif
1752#define SCAN_RX_INITIAL_GAIN 0x17 1738#define SCAN_RX_INITIAL_GAIN 0x17
1753#define POWER_DETECTION_TH 0x08 1739#define POWER_DETECTION_TH 0x08
1754 u32 BitMask; 1740 u32 BitMask;
diff --git a/drivers/staging/rtl8192su/r819xU_phy.h b/drivers/staging/rtl8192su/r819xU_phy.h
index c165ac1265d..3e3bc577e6c 100644
--- a/drivers/staging/rtl8192su/r819xU_phy.h
+++ b/drivers/staging/rtl8192su/r819xU_phy.h
@@ -85,10 +85,6 @@ extern bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eR
85//added by amy 85//added by amy
86extern void InitialGain819xUsb(struct net_device *dev, u8 Operation); 86extern void InitialGain819xUsb(struct net_device *dev, u8 Operation);
87 87
88#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
89extern void InitialGainOperateWorkItemCallBack(struct work_struct *work); 88extern void InitialGainOperateWorkItemCallBack(struct work_struct *work);
90#else
91extern void InitialGainOperateWorkItemCallBack(struct net_device *dev);
92#endif
93 89
94#endif 90#endif