aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2009-08-12 19:37:26 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 15:02:32 -0400
commit96a51d06ccaeb2ca7e23d9e7b9b91c4a45471841 (patch)
treef136ce6b441eef9ca103061a1d7c784521cc473e /drivers/staging
parent19bebc5217c0798a16b56c18609e0f52db6b0924 (diff)
Staging: rtl8192e: remove kernel version checks
This removes a lot of code that is never built in to the driver. The size of the built code after this patch is identical to before it. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/rtl8192e/ieee80211.h117
-rw-r--r--drivers/staging/rtl8192e/r8192E.h38
-rw-r--r--drivers/staging/rtl8192e/r8192E_core.c228
-rw-r--r--drivers/staging/rtl8192e/r8192E_dm.c68
-rw-r--r--drivers/staging/rtl8192e/r8192E_dm.h8
-rw-r--r--drivers/staging/rtl8192e/r8192E_wx.c20
-rw-r--r--drivers/staging/rtl8192e/r8192_pm.c14
-rw-r--r--drivers/staging/rtl8192e/r819xE_firmware.c10
8 files changed, 1 insertions, 502 deletions
diff --git a/drivers/staging/rtl8192e/ieee80211.h b/drivers/staging/rtl8192e/ieee80211.h
index 896fd17eea2c..97137ddefff4 100644
--- a/drivers/staging/rtl8192e/ieee80211.h
+++ b/drivers/staging/rtl8192e/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 "ieee80211/rtl819x_BA.h" 38#include "ieee80211/rtl819x_BA.h"
44#include "ieee80211/rtl819x_TS.h" 39#include "ieee80211/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
@@ -425,46 +395,8 @@ typedef struct ieee_param {
425#define IW_QUAL_NOISE_UPDATED 0x4 395#define IW_QUAL_NOISE_UPDATED 0x4
426#endif 396#endif
427 397
428#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
429static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data)
430{
431 task->routine = func;
432 task->data = data;
433 //task->next = NULL;
434 INIT_LIST_HEAD(&task->list);
435 task->sync = 0;
436}
437#endif
438
439// linux under 2.6.9 release may not support it, so modify it for common use
440#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
441//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
442#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
443static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
444{
445 unsigned long timeout = MSECS(msecs) + 1;
446
447 while (timeout) {
448 set_current_state(TASK_INTERRUPTIBLE);
449 timeout = schedule_timeout(timeout);
450 }
451 return timeout;
452}
453#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
454static inline void msleep(unsigned int msecs)
455{
456 unsigned long timeout = MSECS(msecs) + 1;
457
458 while (timeout) {
459 set_current_state(TASK_UNINTERRUPTIBLE);
460 timeout = schedule_timeout(timeout);
461 }
462}
463#endif
464#else
465#define MSECS(t) msecs_to_jiffies(t) 398#define MSECS(t) msecs_to_jiffies(t)
466#define msleep_interruptible_rsl msleep_interruptible 399#define msleep_interruptible_rsl msleep_interruptible
467#endif
468 400
469#define IEEE80211_DATA_LEN 2304 401#define IEEE80211_DATA_LEN 2304
470/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 402/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -1736,21 +1668,6 @@ enum ieee80211_state {
1736#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ 1668#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
1737 IEEE80211_52GHZ_MIN_CHANNEL + 1) 1669 IEEE80211_52GHZ_MIN_CHANNEL + 1)
1738 1670
1739#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
1740extern inline int is_multicast_ether_addr(const u8 *addr)
1741{
1742 return ((addr[0] != 0xff) && (0x01 & addr[0]));
1743}
1744#endif
1745
1746#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
1747extern inline int is_broadcast_ether_addr(const u8 *addr)
1748{
1749 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
1750 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
1751}
1752#endif
1753
1754typedef struct tx_pending_t{ 1671typedef struct tx_pending_t{
1755 int frag; 1672 int frag;
1756 struct ieee80211_txb *txb; 1673 struct ieee80211_txb *txb;
@@ -1827,11 +1744,7 @@ typedef struct _RT_POWER_SAVE_CONTROL
1827 bool bIPSModeBackup; 1744 bool bIPSModeBackup;
1828 bool bSwRfProcessing; 1745 bool bSwRfProcessing;
1829 RT_RF_POWER_STATE eInactivePowerState; 1746 RT_RF_POWER_STATE eInactivePowerState;
1830#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1831 struct work_struct InactivePsWorkItem; 1747 struct work_struct InactivePsWorkItem;
1832#else
1833 struct tq_struct InactivePsWorkItem;
1834#endif
1835 struct timer_list InactivePsTimer; 1748 struct timer_list InactivePsTimer;
1836 1749
1837 // Return point for join action 1750 // Return point for join action
@@ -2198,36 +2111,16 @@ struct ieee80211_device {
2198 2111
2199 /* used if IEEE_SOFTMAC_BEACONS is set */ 2112 /* used if IEEE_SOFTMAC_BEACONS is set */
2200 struct timer_list beacon_timer; 2113 struct timer_list beacon_timer;
2201#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 2114
2202 struct work_struct associate_complete_wq; 2115 struct work_struct associate_complete_wq;
2203 struct work_struct associate_procedure_wq; 2116 struct work_struct associate_procedure_wq;
2204#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2205 struct delayed_work softmac_scan_wq; 2117 struct delayed_work softmac_scan_wq;
2206 struct delayed_work associate_retry_wq; 2118 struct delayed_work associate_retry_wq;
2207 struct delayed_work start_ibss_wq; 2119 struct delayed_work start_ibss_wq;
2208 struct delayed_work hw_wakeup_wq; 2120 struct delayed_work hw_wakeup_wq;
2209 struct delayed_work hw_sleep_wq; 2121 struct delayed_work hw_sleep_wq;
2210#else
2211 struct work_struct softmac_scan_wq;
2212 struct work_struct associate_retry_wq;
2213 struct work_struct start_ibss_wq;
2214 struct work_struct hw_wakeup_wq;
2215 struct work_struct hw_sleep_wq;
2216#endif
2217 struct work_struct wx_sync_scan_wq; 2122 struct work_struct wx_sync_scan_wq;
2218 struct workqueue_struct *wq; 2123 struct workqueue_struct *wq;
2219#else
2220 /* used for periodly scan */
2221 struct timer_list scan_timer;
2222
2223 struct tq_struct associate_complete_wq;
2224 struct tq_struct associate_retry_wq;
2225 struct tq_struct start_ibss_wq;
2226 struct tq_struct associate_procedure_wq;
2227 struct tq_struct softmac_scan_wq;
2228 struct tq_struct wx_sync_scan_wq;
2229
2230#endif
2231 // Qos related. Added by Annie, 2005-11-01. 2124 // Qos related. Added by Annie, 2005-11-01.
2232 //STA_QOS StaQos; 2125 //STA_QOS StaQos;
2233 2126
@@ -2413,11 +2306,7 @@ struct ieee80211_device {
2413 2306
2414static inline void *ieee80211_priv(struct net_device *dev) 2307static inline void *ieee80211_priv(struct net_device *dev)
2415{ 2308{
2416#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2417 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 2309 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
2418#else
2419 return ((struct ieee80211_device *)dev->priv)->priv;
2420#endif
2421} 2310}
2422 2311
2423extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) 2312extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
@@ -2670,11 +2559,7 @@ extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_reques
2670 union iwreq_data *wrqu, char *b); 2559 union iwreq_data *wrqu, char *b);
2671 2560
2672//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); 2561//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2673#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2674extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); 2562extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
2675#else
2676 extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2677#endif
2678 2563
2679 2564
2680extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 2565extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
diff --git a/drivers/staging/rtl8192e/r8192E.h b/drivers/staging/rtl8192e/r8192E.h
index 52b1dd06eaf8..61b6f250b917 100644
--- a/drivers/staging/rtl8192e/r8192E.h
+++ b/drivers/staging/rtl8192e/r8192E.h
@@ -39,9 +39,6 @@
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))
43#include <asm/semaphore.h>
44#endif
45#include "ieee80211.h" 42#include "ieee80211.h"
46 43
47 44
@@ -1020,11 +1017,7 @@ typedef struct r8192_priv
1020 spinlock_t irq_th_lock; 1017 spinlock_t irq_th_lock;
1021 spinlock_t tx_lock; 1018 spinlock_t tx_lock;
1022 spinlock_t rf_ps_lock; 1019 spinlock_t rf_ps_lock;
1023#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
1024 struct semaphore mutex;
1025#else
1026 struct mutex mutex; 1020 struct mutex mutex;
1027#endif
1028 spinlock_t rf_lock; //used to lock rf write operation added by wb 1021 spinlock_t rf_lock; //used to lock rf write operation added by wb
1029 spinlock_t ps_lock; 1022 spinlock_t ps_lock;
1030 1023
@@ -1163,11 +1156,7 @@ typedef struct r8192_priv
1163/* modified by davad for Rx process */ 1156/* modified by davad for Rx process */
1164 struct sk_buff_head rx_queue; 1157 struct sk_buff_head rx_queue;
1165 struct sk_buff_head skb_queue; 1158 struct sk_buff_head skb_queue;
1166#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
1167 struct tq_struct qos_activate;
1168#else
1169 struct work_struct qos_activate; 1159 struct work_struct qos_activate;
1170#endif
1171 short tx_urb_index; 1160 short tx_urb_index;
1172 atomic_t tx_pending[0x10];//UART_PRIORITY+1 1161 atomic_t tx_pending[0x10];//UART_PRIORITY+1
1173 1162
@@ -1196,11 +1185,7 @@ typedef struct r8192_priv
1196 1185
1197 struct ChnlAccessSetting ChannelAccessSetting; 1186 struct ChnlAccessSetting ChannelAccessSetting;
1198 1187
1199#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1200 struct work_struct reset_wq; 1188 struct work_struct reset_wq;
1201#else
1202 struct tq_struct reset_wq;
1203#endif
1204 1189
1205/**********************************************************/ 1190/**********************************************************/
1206//for rtl819xPci 1191//for rtl819xPci
@@ -1379,32 +1364,13 @@ typedef struct r8192_priv
1379 u8 InitialGainOperateType; 1364 u8 InitialGainOperateType;
1380 1365
1381 //define work item by amy 080526 1366 //define work item by amy 080526
1382#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1383#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1384 struct delayed_work update_beacon_wq; 1367 struct delayed_work update_beacon_wq;
1385 struct delayed_work watch_dog_wq; 1368 struct delayed_work watch_dog_wq;
1386 struct delayed_work txpower_tracking_wq; 1369 struct delayed_work txpower_tracking_wq;
1387 struct delayed_work rfpath_check_wq; 1370 struct delayed_work rfpath_check_wq;
1388 struct delayed_work gpio_change_rf_wq; 1371 struct delayed_work gpio_change_rf_wq;
1389 struct delayed_work initialgain_operate_wq; 1372 struct delayed_work initialgain_operate_wq;
1390#else
1391 struct work_struct update_beacon_wq;
1392 struct work_struct watch_dog_wq;
1393 struct work_struct txpower_tracking_wq;
1394 struct work_struct rfpath_check_wq;
1395 struct work_struct gpio_change_rf_wq;
1396 struct work_struct initialgain_operate_wq;
1397#endif
1398 struct workqueue_struct *priv_wq; 1373 struct workqueue_struct *priv_wq;
1399#else
1400 struct tq_struct update_beacon_wq;
1401 /* used for periodly scan */
1402 struct tq_struct txpower_tracking_wq;
1403 struct tq_struct rfpath_check_wq;
1404 struct tq_struct watch_dog_wq;
1405 struct tq_struct gpio_change_rf_wq;
1406 struct tq_struct initialgain_operate_wq;
1407#endif
1408}r8192_priv; 1374}r8192_priv;
1409 1375
1410// for rtl8187 1376// for rtl8187
@@ -1540,11 +1506,7 @@ void CamPrintDbgReg(struct net_device* dev);
1540extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); 1506extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
1541extern void firmware_init_param(struct net_device *dev); 1507extern void firmware_init_param(struct net_device *dev);
1542extern RT_STATUS cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len); 1508extern RT_STATUS cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len);
1543#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1544void rtl8192_hw_wakeup_wq (struct work_struct *work); 1509void rtl8192_hw_wakeup_wq (struct work_struct *work);
1545#else
1546void rtl8192_hw_wakeup_wq(struct net_device *dev);
1547#endif
1548 1510
1549short rtl8192_is_tx_queue_empty(struct net_device *dev); 1511short rtl8192_is_tx_queue_empty(struct net_device *dev);
1550#ifdef ENABLE_IPS 1512#ifdef ENABLE_IPS
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index e9d0a69359a6..681488bf6534 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -119,25 +119,16 @@ static int hwwep = 1; //default use hw. set 0 to use software security
119static int channels = 0x3fff; 119static int channels = 0x3fff;
120 120
121MODULE_LICENSE("GPL"); 121MODULE_LICENSE("GPL");
122#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
123MODULE_VERSION("V 1.1"); 122MODULE_VERSION("V 1.1");
124#endif
125MODULE_DEVICE_TABLE(pci, rtl8192_pci_id_tbl); 123MODULE_DEVICE_TABLE(pci, rtl8192_pci_id_tbl);
126//MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); 124//MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
127MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards"); 125MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards");
128 126
129 127
130#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
131module_param(ifname, charp, S_IRUGO|S_IWUSR ); 128module_param(ifname, charp, S_IRUGO|S_IWUSR );
132//module_param(hwseqnum,int, S_IRUGO|S_IWUSR); 129//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
133module_param(hwwep,int, S_IRUGO|S_IWUSR); 130module_param(hwwep,int, S_IRUGO|S_IWUSR);
134module_param(channels,int, S_IRUGO|S_IWUSR); 131module_param(channels,int, S_IRUGO|S_IWUSR);
135#else
136MODULE_PARM(ifname, "s");
137//MODULE_PARM(hwseqnum,"i");
138MODULE_PARM(hwwep,"i");
139MODULE_PARM(channels,"i");
140#endif
141 132
142MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default"); 133MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default");
143//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); 134//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
@@ -153,7 +144,6 @@ static struct pci_driver rtl8192_pci_driver = {
153 .id_table = rtl8192_pci_id_tbl, /* PCI_ID table */ 144 .id_table = rtl8192_pci_id_tbl, /* PCI_ID table */
154 .probe = rtl8192_pci_probe, /* probe fn */ 145 .probe = rtl8192_pci_probe, /* probe fn */
155 .remove = __devexit_p(rtl8192_pci_disconnect), /* remove fn */ 146 .remove = __devexit_p(rtl8192_pci_disconnect), /* remove fn */
156#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
157#ifdef CONFIG_PM_RTL 147#ifdef CONFIG_PM_RTL
158 .suspend = rtl8192E_suspend, /* PM suspend fn */ 148 .suspend = rtl8192E_suspend, /* PM suspend fn */
159 .resume = rtl8192E_resume, /* PM resume fn */ 149 .resume = rtl8192E_resume, /* PM resume fn */
@@ -161,7 +151,6 @@ static struct pci_driver rtl8192_pci_driver = {
161 .suspend = NULL, /* PM suspend fn */ 151 .suspend = NULL, /* PM suspend fn */
162 .resume = NULL, /* PM resume fn */ 152 .resume = NULL, /* PM resume fn */
163#endif 153#endif
164#endif
165}; 154};
166 155
167#ifdef ENABLE_DOT11D 156#ifdef ENABLE_DOT11D
@@ -367,25 +356,12 @@ inline void force_pci_posting(struct net_device *dev)
367 356
368 357
369//warning message WB 358//warning message WB
370#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
371#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
372void rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs);
373#else
374irqreturn_t rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs);
375#endif
376#else
377irqreturn_t rtl8192_interrupt(int irq, void *netdev); 359irqreturn_t rtl8192_interrupt(int irq, void *netdev);
378#endif
379//static struct net_device_stats *rtl8192_stats(struct net_device *dev); 360//static struct net_device_stats *rtl8192_stats(struct net_device *dev);
380void rtl8192_commit(struct net_device *dev); 361void rtl8192_commit(struct net_device *dev);
381//void rtl8192_restart(struct net_device *dev); 362//void rtl8192_restart(struct net_device *dev);
382#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
383void rtl8192_restart(struct work_struct *work); 363void rtl8192_restart(struct work_struct *work);
384//void rtl8192_rq_tx_ack(struct work_struct *work); 364//void rtl8192_rq_tx_ack(struct work_struct *work);
385#else
386 void rtl8192_restart(struct net_device *dev);
387// //void rtl8192_rq_tx_ack(struct net_device *dev);
388 #endif
389 365
390void watch_dog_timer_callback(unsigned long data); 366void watch_dog_timer_callback(unsigned long data);
391#ifdef ENABLE_IPS 367#ifdef ENABLE_IPS
@@ -608,21 +584,13 @@ static int proc_get_stats_rx(char *page, char **start,
608static void rtl8192_proc_module_init(void) 584static void rtl8192_proc_module_init(void)
609{ 585{
610 RT_TRACE(COMP_INIT, "Initializing proc filesystem"); 586 RT_TRACE(COMP_INIT, "Initializing proc filesystem");
611#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
612 rtl8192_proc=create_proc_entry(RTL819xE_MODULE_NAME, S_IFDIR, proc_net);
613#else
614 rtl8192_proc=create_proc_entry(RTL819xE_MODULE_NAME, S_IFDIR, init_net.proc_net); 587 rtl8192_proc=create_proc_entry(RTL819xE_MODULE_NAME, S_IFDIR, init_net.proc_net);
615#endif
616} 588}
617 589
618 590
619static void rtl8192_proc_module_remove(void) 591static void rtl8192_proc_module_remove(void)
620{ 592{
621#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
622 remove_proc_entry(RTL819xE_MODULE_NAME, proc_net);
623#else
624 remove_proc_entry(RTL819xE_MODULE_NAME, init_net.proc_net); 593 remove_proc_entry(RTL819xE_MODULE_NAME, init_net.proc_net);
625#endif
626} 594}
627 595
628 596
@@ -720,11 +688,7 @@ static void tx_timeout(struct net_device *dev)
720 struct r8192_priv *priv = ieee80211_priv(dev); 688 struct r8192_priv *priv = ieee80211_priv(dev);
721 //rtl8192_commit(dev); 689 //rtl8192_commit(dev);
722 690
723#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
724 schedule_work(&priv->reset_wq); 691 schedule_work(&priv->reset_wq);
725#else
726 schedule_task(&priv->reset_wq);
727#endif
728 printk("TXTIMEOUT"); 692 printk("TXTIMEOUT");
729} 693}
730 694
@@ -1773,16 +1737,10 @@ static struct ieee80211_qos_parameters def_qos_parameters = {
1773 {0,0,0,0} /* tx_op_limit */ 1737 {0,0,0,0} /* tx_op_limit */
1774}; 1738};
1775 1739
1776#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
1777static void rtl8192_update_beacon(struct work_struct * work) 1740static void rtl8192_update_beacon(struct work_struct * work)
1778{ 1741{
1779 struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work); 1742 struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work);
1780 struct net_device *dev = priv->ieee80211->dev; 1743 struct net_device *dev = priv->ieee80211->dev;
1781#else
1782void rtl8192_update_beacon(struct net_device *dev)
1783{
1784 struct r8192_priv *priv = ieee80211_priv(dev);
1785#endif
1786 struct ieee80211_device* ieee = priv->ieee80211; 1744 struct ieee80211_device* ieee = priv->ieee80211;
1787 struct ieee80211_network* net = &ieee->current_network; 1745 struct ieee80211_network* net = &ieee->current_network;
1788 1746
@@ -1795,16 +1753,10 @@ void rtl8192_update_beacon(struct net_device *dev)
1795* background support to run QoS activate functionality 1753* background support to run QoS activate functionality
1796*/ 1754*/
1797static int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO}; 1755static int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO};
1798#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
1799static void rtl8192_qos_activate(struct work_struct * work) 1756static void rtl8192_qos_activate(struct work_struct * work)
1800{ 1757{
1801 struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate); 1758 struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate);
1802 struct net_device *dev = priv->ieee80211->dev; 1759 struct net_device *dev = priv->ieee80211->dev;
1803#else
1804void rtl8192_qos_activate(struct net_device *dev)
1805{
1806 struct r8192_priv *priv = ieee80211_priv(dev);
1807#endif
1808 struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; 1760 struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
1809 u8 mode = priv->ieee80211->current_network.mode; 1761 u8 mode = priv->ieee80211->current_network.mode;
1810// u32 size = sizeof(struct ieee80211_qos_parameters); 1762// u32 size = sizeof(struct ieee80211_qos_parameters);
@@ -1814,11 +1766,7 @@ void rtl8192_qos_activate(struct net_device *dev)
1814 if (priv == NULL) 1766 if (priv == NULL)
1815 return; 1767 return;
1816 1768
1817#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
1818 down(&priv->mutex);
1819#else
1820 mutex_lock(&priv->mutex); 1769 mutex_lock(&priv->mutex);
1821#endif
1822 if(priv->ieee80211->state != IEEE80211_LINKED) 1770 if(priv->ieee80211->state != IEEE80211_LINKED)
1823 goto success; 1771 goto success;
1824 RT_TRACE(COMP_QOS,"qos active process with associate response received\n"); 1772 RT_TRACE(COMP_QOS,"qos active process with associate response received\n");
@@ -1838,11 +1786,7 @@ void rtl8192_qos_activate(struct net_device *dev)
1838 } 1786 }
1839 1787
1840success: 1788success:
1841#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
1842 up(&priv->mutex);
1843#else
1844 mutex_unlock(&priv->mutex); 1789 mutex_unlock(&priv->mutex);
1845#endif
1846} 1790}
1847 1791
1848static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, 1792static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
@@ -1869,11 +1813,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
1869 network->qos_data.param_count)) { 1813 network->qos_data.param_count)) {
1870 network->qos_data.old_param_count = 1814 network->qos_data.old_param_count =
1871 network->qos_data.param_count; 1815 network->qos_data.param_count;
1872#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1873 queue_work(priv->priv_wq, &priv->qos_activate); 1816 queue_work(priv->priv_wq, &priv->qos_activate);
1874#else
1875 schedule_task(&priv->qos_activate);
1876#endif
1877 RT_TRACE (COMP_QOS, "QoS parameters change call " 1817 RT_TRACE (COMP_QOS, "QoS parameters change call "
1878 "qos_activate\n"); 1818 "qos_activate\n");
1879 } 1819 }
@@ -1882,11 +1822,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
1882 &def_qos_parameters, size); 1822 &def_qos_parameters, size);
1883 1823
1884 if ((network->qos_data.active == 1) && (active_network == 1)) { 1824 if ((network->qos_data.active == 1) && (active_network == 1)) {
1885#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1886 queue_work(priv->priv_wq, &priv->qos_activate); 1825 queue_work(priv->priv_wq, &priv->qos_activate);
1887#else
1888 schedule_task(&priv->qos_activate);
1889#endif
1890 RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n"); 1826 RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n");
1891 } 1827 }
1892 network->qos_data.active = 0; 1828 network->qos_data.active = 0;
@@ -1905,15 +1841,7 @@ static int rtl8192_handle_beacon(struct net_device * dev,
1905 1841
1906 rtl8192_qos_handle_probe_response(priv,1,network); 1842 rtl8192_qos_handle_probe_response(priv,1,network);
1907 1843
1908#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1909 queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0); 1844 queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0);
1910#else
1911#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1912 schedule_task(&priv->update_beacon_wq);
1913#else
1914 queue_work(priv->priv_wq, &priv->update_beacon_wq);
1915#endif
1916#endif
1917 return 0; 1845 return 0;
1918 1846
1919} 1847}
@@ -1970,12 +1898,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv,
1970 1898
1971 RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active); 1899 RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active);
1972 if (set_qos_param == 1) 1900 if (set_qos_param == 1)
1973#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1974 queue_work(priv->priv_wq, &priv->qos_activate); 1901 queue_work(priv->priv_wq, &priv->qos_activate);
1975#else
1976 schedule_task(&priv->qos_activate);
1977#endif
1978
1979 1902
1980 return ret; 1903 return ret;
1981} 1904}
@@ -2208,7 +2131,6 @@ static void rtl8192_hw_sleep_down(struct net_device *dev)
2208 RT_TRACE(COMP_POWER, "%s()============>come to sleep down\n", __FUNCTION__); 2131 RT_TRACE(COMP_POWER, "%s()============>come to sleep down\n", __FUNCTION__);
2209 MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS); 2132 MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS);
2210} 2133}
2211#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2212static void rtl8192_hw_sleep_wq (struct work_struct *work) 2134static void rtl8192_hw_sleep_wq (struct work_struct *work)
2213{ 2135{
2214// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq); 2136// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
@@ -2217,10 +2139,6 @@ static void rtl8192_hw_sleep_wq (struct work_struct *work)
2217 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 2139 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
2218 struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_sleep_wq); 2140 struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_sleep_wq);
2219 struct net_device *dev = ieee->dev; 2141 struct net_device *dev = ieee->dev;
2220#else
2221void rtl8192_hw_sleep_wq(struct net_device* dev)
2222{
2223#endif
2224 //printk("=========>%s()\n", __FUNCTION__); 2142 //printk("=========>%s()\n", __FUNCTION__);
2225 rtl8192_hw_sleep_down(dev); 2143 rtl8192_hw_sleep_down(dev);
2226} 2144}
@@ -2236,7 +2154,6 @@ static void rtl8192_hw_wakeup(struct net_device* dev)
2236 //FIXME: will we send package stored while nic is sleep? 2154 //FIXME: will we send package stored while nic is sleep?
2237// spin_unlock_irqrestore(&priv->ps_lock,flags); 2155// spin_unlock_irqrestore(&priv->ps_lock,flags);
2238} 2156}
2239#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2240void rtl8192_hw_wakeup_wq (struct work_struct *work) 2157void rtl8192_hw_wakeup_wq (struct work_struct *work)
2241{ 2158{
2242// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq); 2159// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
@@ -2245,10 +2162,6 @@ void rtl8192_hw_wakeup_wq (struct work_struct *work)
2245 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 2162 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
2246 struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_wakeup_wq); 2163 struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_wakeup_wq);
2247 struct net_device *dev = ieee->dev; 2164 struct net_device *dev = ieee->dev;
2248#else
2249void rtl8192_hw_wakeup_wq(struct net_device* dev)
2250{
2251#endif
2252 rtl8192_hw_wakeup(dev); 2165 rtl8192_hw_wakeup(dev);
2253 2166
2254} 2167}
@@ -2468,18 +2381,10 @@ static void rtl8192_init_priv_lock(struct r8192_priv* priv)
2468 //spin_lock_init(&priv->rf_lock); 2381 //spin_lock_init(&priv->rf_lock);
2469 sema_init(&priv->wx_sem,1); 2382 sema_init(&priv->wx_sem,1);
2470 sema_init(&priv->rf_sem,1); 2383 sema_init(&priv->rf_sem,1);
2471#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
2472 sema_init(&priv->mutex, 1);
2473#else
2474 mutex_init(&priv->mutex); 2384 mutex_init(&priv->mutex);
2475#endif
2476} 2385}
2477 2386
2478#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2479extern void rtl819x_watchdog_wqcallback(struct work_struct *work); 2387extern void rtl819x_watchdog_wqcallback(struct work_struct *work);
2480#else
2481extern void rtl819x_watchdog_wqcallback(struct net_device *dev);
2482#endif
2483 2388
2484void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); 2389void rtl8192_irq_rx_tasklet(struct r8192_priv *priv);
2485void rtl8192_irq_tx_tasklet(struct r8192_priv *priv); 2390void rtl8192_irq_tx_tasklet(struct r8192_priv *priv);
@@ -2490,15 +2395,12 @@ static void rtl8192_init_priv_task(struct net_device* dev)
2490{ 2395{
2491 struct r8192_priv *priv = ieee80211_priv(dev); 2396 struct r8192_priv *priv = ieee80211_priv(dev);
2492 2397
2493#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2494#ifdef PF_SYNCTHREAD 2398#ifdef PF_SYNCTHREAD
2495 priv->priv_wq = create_workqueue(DRV_NAME,0); 2399 priv->priv_wq = create_workqueue(DRV_NAME,0);
2496#else 2400#else
2497 priv->priv_wq = create_workqueue(DRV_NAME); 2401 priv->priv_wq = create_workqueue(DRV_NAME);
2498#endif 2402#endif
2499#endif
2500 2403
2501#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2502// INIT_WORK(&priv->reset_wq, (void(*)(void*)) rtl8192_restart); 2404// INIT_WORK(&priv->reset_wq, (void(*)(void*)) rtl8192_restart);
2503 INIT_WORK(&priv->reset_wq, rtl8192_restart); 2405 INIT_WORK(&priv->reset_wq, rtl8192_restart);
2504// INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog); 2406// INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog);
@@ -2512,34 +2414,6 @@ static void rtl8192_init_priv_task(struct net_device* dev)
2512 INIT_DELAYED_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq); 2414 INIT_DELAYED_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq);
2513 INIT_DELAYED_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq); 2415 INIT_DELAYED_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq);
2514 2416
2515#else
2516#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
2517 tq_init(&priv->reset_wq, (void*)rtl8192_restart, dev);
2518 tq_init(&priv->watch_dog_wq, (void*)rtl819x_watchdog_wqcallback, dev);
2519 tq_init(&priv->txpower_tracking_wq, (void*)dm_txpower_trackingcallback, dev);
2520 tq_init(&priv->rfpath_check_wq, (void*)dm_rf_pathcheck_workitemcallback, dev);
2521 tq_init(&priv->update_beacon_wq, (void*)rtl8192_update_beacon, dev);
2522 //tq_init(&priv->SwChnlWorkItem, (void*) rtl8192_SwChnl_WorkItem, dev);
2523 //tq_init(&priv->SetBWModeWorkItem, (void*)rtl8192_SetBWModeWorkItem, dev);
2524 tq_init(&priv->qos_activate, (void *)rtl8192_qos_activate, dev);
2525 tq_init(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq, dev);
2526 tq_init(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq, dev);
2527
2528#else
2529 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8192_restart,dev);
2530// INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) hal_dm_watchdog,dev);
2531 INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) rtl819x_watchdog_wqcallback,dev);
2532 INIT_WORK(&priv->txpower_tracking_wq, (void(*)(void*)) dm_txpower_trackingcallback,dev);
2533 INIT_WORK(&priv->rfpath_check_wq, (void(*)(void*)) dm_rf_pathcheck_workitemcallback,dev);
2534 INIT_WORK(&priv->update_beacon_wq, (void(*)(void*))rtl8192_update_beacon,dev);
2535 //INIT_WORK(&priv->SwChnlWorkItem, (void(*)(void*)) rtl8192_SwChnl_WorkItem, dev);
2536 //INIT_WORK(&priv->SetBWModeWorkItem, (void(*)(void*)) rtl8192_SetBWModeWorkItem, dev);
2537 INIT_WORK(&priv->qos_activate, (void(*)(void *))rtl8192_qos_activate, dev);
2538 INIT_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8192_hw_wakeup_wq, dev);
2539 INIT_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8192_hw_sleep_wq, dev);
2540#endif
2541#endif
2542
2543 tasklet_init(&priv->irq_rx_tasklet, 2417 tasklet_init(&priv->irq_rx_tasklet,
2544 (void(*)(unsigned long))rtl8192_irq_rx_tasklet, 2418 (void(*)(unsigned long))rtl8192_irq_rx_tasklet,
2545 (unsigned long)priv); 2419 (unsigned long)priv);
@@ -4171,9 +4045,7 @@ RESET_START:
4171 printk("ieee->state is IEEE80211_LINKED\n"); 4045 printk("ieee->state is IEEE80211_LINKED\n");
4172 ieee80211_stop_send_beacons(priv->ieee80211); 4046 ieee80211_stop_send_beacons(priv->ieee80211);
4173 del_timer_sync(&ieee->associate_timer); 4047 del_timer_sync(&ieee->associate_timer);
4174#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4175 cancel_delayed_work(&ieee->associate_retry_wq); 4048 cancel_delayed_work(&ieee->associate_retry_wq);
4176#endif
4177 ieee80211_stop_scan(ieee); 4049 ieee80211_stop_scan(ieee);
4178 netif_carrier_off(dev); 4050 netif_carrier_off(dev);
4179 up(&ieee->wx_sem); 4051 up(&ieee->wx_sem);
@@ -4211,11 +4083,7 @@ RESET_START:
4211 ieee->set_chan(ieee->dev, ieee->current_network.channel); 4083 ieee->set_chan(ieee->dev, ieee->current_network.channel);
4212 4084
4213#if 1 4085#if 1
4214#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4215 queue_work(ieee->wq, &ieee->associate_complete_wq); 4086 queue_work(ieee->wq, &ieee->associate_complete_wq);
4216#else
4217 schedule_task(&ieee->associate_complete_wq);
4218#endif
4219#endif 4087#endif
4220 4088
4221 } 4089 }
@@ -4366,17 +4234,11 @@ static void rtl819x_update_rxcounts(
4366} 4234}
4367 4235
4368 4236
4369#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4370void rtl819x_watchdog_wqcallback(struct work_struct *work) 4237void rtl819x_watchdog_wqcallback(struct work_struct *work)
4371{ 4238{
4372 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 4239 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
4373 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq); 4240 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq);
4374 struct net_device *dev = priv->ieee80211->dev; 4241 struct net_device *dev = priv->ieee80211->dev;
4375#else
4376extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
4377{
4378 struct r8192_priv *priv = ieee80211_priv(dev);
4379#endif
4380 struct ieee80211_device* ieee = priv->ieee80211; 4242 struct ieee80211_device* ieee = priv->ieee80211;
4381 RESET_TYPE ResetType = RESET_TYPE_NORESET; 4243 RESET_TYPE ResetType = RESET_TYPE_NORESET;
4382 static u8 check_reset_cnt=0; 4244 static u8 check_reset_cnt=0;
@@ -4434,11 +4296,7 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
4434 ieee->is_roaming = true; 4296 ieee->is_roaming = true;
4435 ieee->is_set_key = false; 4297 ieee->is_set_key = false;
4436 ieee->link_change(dev); 4298 ieee->link_change(dev);
4437#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4438 queue_work(ieee->wq, &ieee->associate_procedure_wq); 4299 queue_work(ieee->wq, &ieee->associate_procedure_wq);
4439#else
4440 schedule_task(&ieee->associate_procedure_wq);
4441#endif
4442 } 4300 }
4443 } 4301 }
4444 ieee->LinkDetectInfo.NumRecvBcnInPeriod=0; 4302 ieee->LinkDetectInfo.NumRecvBcnInPeriod=0;
@@ -4480,15 +4338,7 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
4480void watch_dog_timer_callback(unsigned long data) 4338void watch_dog_timer_callback(unsigned long data)
4481{ 4339{
4482 struct r8192_priv *priv = ieee80211_priv((struct net_device *) data); 4340 struct r8192_priv *priv = ieee80211_priv((struct net_device *) data);
4483#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
4484 queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq,0); 4341 queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq,0);
4485#else
4486#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
4487 schedule_task(&priv->watch_dog_wq);
4488#else
4489 queue_work(priv->priv_wq,&priv->watch_dog_wq);
4490#endif
4491#endif
4492 mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME)); 4342 mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME));
4493 4343
4494} 4344}
@@ -4637,17 +4487,10 @@ void rtl8192_commit(struct net_device *dev)
4637 _rtl8192_up(dev); 4487 _rtl8192_up(dev);
4638} 4488}
4639 4489
4640#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4641void rtl8192_restart(struct work_struct *work) 4490void rtl8192_restart(struct work_struct *work)
4642{ 4491{
4643 struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); 4492 struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq);
4644 struct net_device *dev = priv->ieee80211->dev; 4493 struct net_device *dev = priv->ieee80211->dev;
4645#else
4646void rtl8192_restart(struct net_device *dev)
4647{
4648
4649 struct r8192_priv *priv = ieee80211_priv(dev);
4650#endif
4651 4494
4652 down(&priv->wx_sem); 4495 down(&priv->wx_sem);
4653 4496
@@ -4688,11 +4531,7 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac)
4688 4531
4689 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 4532 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
4690 4533
4691#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
4692 schedule_work(&priv->reset_wq); 4534 schedule_work(&priv->reset_wq);
4693#else
4694 schedule_task(&priv->reset_wq);
4695#endif
4696 up(&priv->wx_sem); 4535 up(&priv->wx_sem);
4697 4536
4698 return 0; 4537 return 0;
@@ -5899,11 +5738,7 @@ static void rtl8192_rx(struct net_device *dev)
5899 stats.RxBufShift = ((pdesc->Shift)&0x03); 5738 stats.RxBufShift = ((pdesc->Shift)&0x03);
5900 stats.Decrypted = !pdesc->SWDec; 5739 stats.Decrypted = !pdesc->SWDec;
5901 5740
5902#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
5903 pci_dma_sync_single_for_cpu(priv->pdev, 5741 pci_dma_sync_single_for_cpu(priv->pdev,
5904#else
5905 pci_unmap_single(priv->pdev,
5906#endif
5907 *((dma_addr_t *)skb->cb), 5742 *((dma_addr_t *)skb->cb),
5908 priv->rxbuffersize, 5743 priv->rxbuffersize,
5909 PCI_DMA_FROMDEVICE); 5744 PCI_DMA_FROMDEVICE);
@@ -6034,33 +5869,19 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
6034 pci_set_master(pdev); 5869 pci_set_master(pdev);
6035 //pci_set_wmi(pdev); 5870 //pci_set_wmi(pdev);
6036 pci_set_dma_mask(pdev, 0xffffff00ULL); 5871 pci_set_dma_mask(pdev, 0xffffff00ULL);
6037#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6038 pci_set_consistent_dma_mask(pdev,0xffffff00ULL); 5872 pci_set_consistent_dma_mask(pdev,0xffffff00ULL);
6039#endif
6040 dev = alloc_ieee80211(sizeof(struct r8192_priv)); 5873 dev = alloc_ieee80211(sizeof(struct r8192_priv));
6041 if (!dev) 5874 if (!dev)
6042 return -ENOMEM; 5875 return -ENOMEM;
6043 5876
6044#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
6045 SET_MODULE_OWNER(dev);
6046#endif
6047
6048 pci_set_drvdata(pdev, dev); 5877 pci_set_drvdata(pdev, dev);
6049#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6050 SET_NETDEV_DEV(dev, &pdev->dev); 5878 SET_NETDEV_DEV(dev, &pdev->dev);
6051#endif
6052 priv = ieee80211_priv(dev); 5879 priv = ieee80211_priv(dev);
6053#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6054 priv->ieee80211 = netdev_priv(dev); 5880 priv->ieee80211 = netdev_priv(dev);
6055#else
6056 priv->ieee80211 = (struct ieee80211_device *)dev->priv;
6057#endif
6058 priv->pdev=pdev; 5881 priv->pdev=pdev;
6059#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6060 if((pdev->subsystem_vendor == PCI_VENDOR_ID_DLINK)&&(pdev->subsystem_device == 0x3304)){ 5882 if((pdev->subsystem_vendor == PCI_VENDOR_ID_DLINK)&&(pdev->subsystem_device == 0x3304)){
6061 priv->ieee80211->bSupportRemoteWakeUp = 1; 5883 priv->ieee80211->bSupportRemoteWakeUp = 1;
6062 } else 5884 } else
6063#endif
6064 { 5885 {
6065 priv->ieee80211->bSupportRemoteWakeUp = 0; 5886 priv->ieee80211->bSupportRemoteWakeUp = 0;
6066 } 5887 }
@@ -6171,11 +5992,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
6171 5992
6172 5993
6173 RT_TRACE(COMP_INIT, "Driver probe completed\n"); 5994 RT_TRACE(COMP_INIT, "Driver probe completed\n");
6174//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6175// return dev;
6176//#else
6177 return 0; 5995 return 0;
6178//#endif
6179 5996
6180fail1: 5997fail1:
6181 5998
@@ -6222,7 +6039,6 @@ void rtl8192_cancel_deferred_work(struct r8192_priv* priv)
6222 * Otherwise call cancel_delayed_work is enough. 6039 * Otherwise call cancel_delayed_work is enough.
6223 * FIXME (2.6.20 shoud 2.6.22, work_struct shoud not cancel) 6040 * FIXME (2.6.20 shoud 2.6.22, work_struct shoud not cancel)
6224 * */ 6041 * */
6225#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6226 cancel_delayed_work(&priv->watch_dog_wq); 6042 cancel_delayed_work(&priv->watch_dog_wq);
6227 cancel_delayed_work(&priv->update_beacon_wq); 6043 cancel_delayed_work(&priv->update_beacon_wq);
6228 cancel_delayed_work(&priv->ieee80211->hw_wakeup_wq); 6044 cancel_delayed_work(&priv->ieee80211->hw_wakeup_wq);
@@ -6230,20 +6046,10 @@ void rtl8192_cancel_deferred_work(struct r8192_priv* priv)
6230#ifdef RTL8192E 6046#ifdef RTL8192E
6231 cancel_delayed_work(&priv->gpio_change_rf_wq); 6047 cancel_delayed_work(&priv->gpio_change_rf_wq);
6232#endif 6048#endif
6233#endif
6234#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,22)
6235 cancel_work_sync(&priv->reset_wq); 6049 cancel_work_sync(&priv->reset_wq);
6236 cancel_work_sync(&priv->qos_activate); 6050 cancel_work_sync(&priv->qos_activate);
6237 //cancel_work_sync(&priv->SetBWModeWorkItem); 6051 //cancel_work_sync(&priv->SetBWModeWorkItem);
6238 //cancel_work_sync(&priv->SwChnlWorkItem); 6052 //cancel_work_sync(&priv->SwChnlWorkItem);
6239#else
6240#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6241 cancel_delayed_work(&priv->reset_wq);
6242 cancel_delayed_work(&priv->qos_activate);
6243 //cancel_delayed_work(&priv->SetBWModeWorkItem);
6244 //cancel_delayed_work(&priv->SwChnlWorkItem);
6245#endif
6246#endif
6247 6053
6248} 6054}
6249 6055
@@ -6269,9 +6075,7 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev)
6269 } 6075 }
6270 // priv->rf_close(dev); 6076 // priv->rf_close(dev);
6271 // rtl8192_usb_deleteendpoints(dev); 6077 // rtl8192_usb_deleteendpoints(dev);
6272#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6273 destroy_workqueue(priv->priv_wq); 6078 destroy_workqueue(priv->priv_wq);
6274#endif
6275 /* redundant with rtl8192_down */ 6079 /* redundant with rtl8192_down */
6276 // rtl8192_irq_disable(dev); 6080 // rtl8192_irq_disable(dev);
6277 // rtl8192_reset(dev); 6081 // rtl8192_reset(dev);
@@ -6334,11 +6138,7 @@ static int __init rtl8192_pci_module_init(void)
6334 RT_TRACE(COMP_INIT, "Initializing module"); 6138 RT_TRACE(COMP_INIT, "Initializing module");
6335 RT_TRACE(COMP_INIT, "Wireless extensions version %d", WIRELESS_EXT); 6139 RT_TRACE(COMP_INIT, "Wireless extensions version %d", WIRELESS_EXT);
6336 rtl8192_proc_module_init(); 6140 rtl8192_proc_module_init();
6337#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
6338 if(0!=pci_module_init(&rtl8192_pci_driver))
6339#else
6340 if(0!=pci_register_driver(&rtl8192_pci_driver)) 6141 if(0!=pci_register_driver(&rtl8192_pci_driver))
6341#endif
6342 { 6142 {
6343 DMESG("No device found"); 6143 DMESG("No device found");
6344 /*pci_unregister_driver (&rtl8192_pci_driver);*/ 6144 /*pci_unregister_driver (&rtl8192_pci_driver);*/
@@ -6358,15 +6158,7 @@ static void __exit rtl8192_pci_module_exit(void)
6358} 6158}
6359 6159
6360//warning message WB 6160//warning message WB
6361#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
6362#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6363void rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs)
6364#else
6365irqreturn_t rtl8192_interrupt(int irq, void *netdev, struct pt_regs *regs)
6366#endif
6367#else
6368irqreturn_t rtl8192_interrupt(int irq, void *netdev) 6161irqreturn_t rtl8192_interrupt(int irq, void *netdev)
6369#endif
6370{ 6162{
6371 struct net_device *dev = (struct net_device *) netdev; 6163 struct net_device *dev = (struct net_device *) netdev;
6372 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); 6164 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
@@ -6374,11 +6166,7 @@ irqreturn_t rtl8192_interrupt(int irq, void *netdev)
6374 u32 inta; 6166 u32 inta;
6375 /* We should return IRQ_NONE, but for now let me keep this */ 6167 /* We should return IRQ_NONE, but for now let me keep this */
6376 if(priv->irq_enabled == 0){ 6168 if(priv->irq_enabled == 0){
6377#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6378 return;
6379#else
6380 return IRQ_HANDLED; 6169 return IRQ_HANDLED;
6381#endif
6382 } 6170 }
6383 6171
6384 spin_lock_irqsave(&priv->irq_th_lock,flags); 6172 spin_lock_irqsave(&priv->irq_th_lock,flags);
@@ -6392,11 +6180,7 @@ irqreturn_t rtl8192_interrupt(int irq, void *netdev)
6392 //DMESG("Enter interrupt, ISR value = 0x%08x", inta); 6180 //DMESG("Enter interrupt, ISR value = 0x%08x", inta);
6393 if(!inta){ 6181 if(!inta){
6394 spin_unlock_irqrestore(&priv->irq_th_lock,flags); 6182 spin_unlock_irqrestore(&priv->irq_th_lock,flags);
6395#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6396 return;
6397#else
6398 return IRQ_HANDLED; 6183 return IRQ_HANDLED;
6399#endif
6400 /* 6184 /*
6401 most probably we can safely return IRQ_NONE, 6185 most probably we can safely return IRQ_NONE,
6402 but for now is better to avoid problems 6186 but for now is better to avoid problems
@@ -6406,11 +6190,7 @@ irqreturn_t rtl8192_interrupt(int irq, void *netdev)
6406 if(inta == 0xffff){ 6190 if(inta == 0xffff){
6407 /* HW disappared */ 6191 /* HW disappared */
6408 spin_unlock_irqrestore(&priv->irq_th_lock,flags); 6192 spin_unlock_irqrestore(&priv->irq_th_lock,flags);
6409#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6410 return;
6411#else
6412 return IRQ_HANDLED; 6193 return IRQ_HANDLED;
6413#endif
6414 } 6194 }
6415 6195
6416 priv->stats.ints++; 6196 priv->stats.ints++;
@@ -6422,11 +6202,7 @@ irqreturn_t rtl8192_interrupt(int irq, void *netdev)
6422 6202
6423 if(!netif_running(dev)) { 6203 if(!netif_running(dev)) {
6424 spin_unlock_irqrestore(&priv->irq_th_lock,flags); 6204 spin_unlock_irqrestore(&priv->irq_th_lock,flags);
6425#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6426 return;
6427#else
6428 return IRQ_HANDLED; 6205 return IRQ_HANDLED;
6429#endif
6430 } 6206 }
6431 6207
6432 if(inta & IMR_TIMEOUT0){ 6208 if(inta & IMR_TIMEOUT0){
@@ -6523,11 +6299,7 @@ irqreturn_t rtl8192_interrupt(int irq, void *netdev)
6523 force_pci_posting(dev); 6299 force_pci_posting(dev);
6524 spin_unlock_irqrestore(&priv->irq_th_lock,flags); 6300 spin_unlock_irqrestore(&priv->irq_th_lock,flags);
6525 6301
6526#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6527 return;
6528#else
6529 return IRQ_HANDLED; 6302 return IRQ_HANDLED;
6530#endif
6531} 6303}
6532 6304
6533void rtl8192_try_wake_queue(struct net_device *dev, int pri) 6305void rtl8192_try_wake_queue(struct net_device *dev, int pri)
diff --git a/drivers/staging/rtl8192e/r8192E_dm.c b/drivers/staging/rtl8192e/r8192E_dm.c
index e3d5aa3f8cb7..bf876322dac2 100644
--- a/drivers/staging/rtl8192e/r8192E_dm.c
+++ b/drivers/staging/rtl8192e/r8192E_dm.c
@@ -69,11 +69,7 @@ extern void hal_dm_watchdog(struct net_device *dev);
69 69
70 70
71extern void init_rate_adaptive(struct net_device *dev); 71extern void init_rate_adaptive(struct net_device *dev);
72#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
73extern void dm_txpower_trackingcallback(struct work_struct *work); 72extern void dm_txpower_trackingcallback(struct work_struct *work);
74#else
75extern void dm_txpower_trackingcallback(struct net_device *dev);
76#endif
77 73
78extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); 74extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
79extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); 75extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
@@ -89,22 +85,14 @@ extern void dm_force_tx_fw_info(struct net_device *dev,
89 u32 force_value); 85 u32 force_value);
90extern void dm_init_edca_turbo(struct net_device *dev); 86extern void dm_init_edca_turbo(struct net_device *dev);
91extern void dm_rf_operation_test_callback(unsigned long data); 87extern void dm_rf_operation_test_callback(unsigned long data);
92#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
93extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); 88extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
94#else
95extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev);
96#endif
97extern void dm_fsync_timer_callback(unsigned long data); 89extern void dm_fsync_timer_callback(unsigned long data);
98extern void dm_check_fsync(struct net_device *dev); 90extern void dm_check_fsync(struct net_device *dev);
99extern void dm_shadow_init(struct net_device *dev); 91extern void dm_shadow_init(struct net_device *dev);
100extern void dm_initialize_txpower_tracking(struct net_device *dev); 92extern void dm_initialize_txpower_tracking(struct net_device *dev);
101 93
102#ifdef RTL8192E 94#ifdef RTL8192E
103#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
104extern void dm_gpio_change_rf_callback(struct work_struct *work); 95extern void dm_gpio_change_rf_callback(struct work_struct *work);
105#else
106extern void dm_gpio_change_rf_callback(struct net_device *dev);
107#endif
108#endif 96#endif
109 97
110 98
@@ -217,11 +205,7 @@ void init_hal_dm(struct net_device *dev)
217 dm_init_rxpath_selection(dev); 205 dm_init_rxpath_selection(dev);
218 dm_init_ctstoself(dev); 206 dm_init_ctstoself(dev);
219#ifdef RTL8192E 207#ifdef RTL8192E
220#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
221 INIT_DELAYED_WORK(&priv->gpio_change_rf_wq, dm_gpio_change_rf_callback); 208 INIT_DELAYED_WORK(&priv->gpio_change_rf_wq, dm_gpio_change_rf_callback);
222#else
223 INIT_WORK(&priv->gpio_change_rf_wq, (void(*)(void*)) dm_gpio_change_rf_callback,dev);
224#endif
225#endif 209#endif
226 210
227} // InitHalDm 211} // InitHalDm
@@ -1021,19 +1005,11 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev)
1021 priv->txpower_count = 0; 1005 priv->txpower_count = 0;
1022} 1006}
1023#endif 1007#endif
1024#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1025void dm_txpower_trackingcallback(struct work_struct *work) 1008void dm_txpower_trackingcallback(struct work_struct *work)
1026{ 1009{
1027 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 1010 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
1028 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq); 1011 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq);
1029 struct net_device *dev = priv->ieee80211->dev; 1012 struct net_device *dev = priv->ieee80211->dev;
1030#else
1031extern void dm_txpower_trackingcallback(struct net_device *dev)
1032{
1033#ifndef RTL8190P
1034 struct r8192_priv *priv = ieee80211_priv(dev);
1035#endif
1036#endif
1037 1013
1038#ifdef RTL8190P 1014#ifdef RTL8190P
1039 dm_TXPowerTrackingCallback_TSSI(dev); 1015 dm_TXPowerTrackingCallback_TSSI(dev);
@@ -1599,15 +1575,7 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
1599 1575
1600 if(tx_power_track_counter > 90) 1576 if(tx_power_track_counter > 90)
1601 { 1577 {
1602 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1603 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); 1578 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
1604 #else
1605 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1606 schedule_task(&priv->txpower_tracking_wq);
1607 #else
1608 queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
1609 #endif
1610 #endif
1611 tx_power_track_counter =0; 1579 tx_power_track_counter =0;
1612 } 1580 }
1613 1581
@@ -1646,15 +1614,7 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
1646 else 1614 else
1647 { 1615 {
1648 //DbgPrint("Schedule TxPowerTrackingWorkItem\n"); 1616 //DbgPrint("Schedule TxPowerTrackingWorkItem\n");
1649 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1650 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); 1617 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
1651 #else
1652 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1653 schedule_task(&priv->txpower_tracking_wq);
1654 #else
1655 queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
1656 #endif
1657 #endif
1658 TM_Trigger = 0; 1618 TM_Trigger = 0;
1659 } 1619 }
1660} 1620}
@@ -2880,15 +2840,7 @@ static void dm_check_rfctrl_gpio(struct net_device * dev)
2880 return; 2840 return;
2881#endif 2841#endif
2882#ifdef RTL8192E 2842#ifdef RTL8192E
2883 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2884 queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0); 2843 queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0);
2885 #else
2886 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
2887 schedule_task(&priv->gpio_change_rf_wq);
2888 #else
2889 queue_work(priv->priv_wq,&priv->gpio_change_rf_wq);
2890 #endif
2891 #endif
2892#endif 2844#endif
2893 2845
2894} /* dm_CheckRfCtrlGPIO */ 2846} /* dm_CheckRfCtrlGPIO */
@@ -2949,17 +2901,11 @@ static void dm_check_pbc_gpio(struct net_device *dev)
2949 * 02/21/2008 MHC Create Version 0. 2901 * 02/21/2008 MHC Create Version 0.
2950 * 2902 *
2951 *---------------------------------------------------------------------------*/ 2903 *---------------------------------------------------------------------------*/
2952#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2953void dm_gpio_change_rf_callback(struct work_struct *work) 2904void dm_gpio_change_rf_callback(struct work_struct *work)
2954{ 2905{
2955 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 2906 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
2956 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq); 2907 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq);
2957 struct net_device *dev = priv->ieee80211->dev; 2908 struct net_device *dev = priv->ieee80211->dev;
2958#else
2959extern void dm_gpio_change_rf_callback(struct net_device *dev)
2960{
2961 struct r8192_priv *priv = ieee80211_priv(dev);
2962#endif
2963 u8 tmp1byte; 2909 u8 tmp1byte;
2964 RT_RF_POWER_STATE eRfPowerStateToSet; 2910 RT_RF_POWER_STATE eRfPowerStateToSet;
2965 bool bActuallySet = false; 2911 bool bActuallySet = false;
@@ -3025,17 +2971,11 @@ extern void dm_gpio_change_rf_callback(struct net_device *dev)
3025 * 01/30/2008 MHC Create Version 0. 2971 * 01/30/2008 MHC Create Version 0.
3026 * 2972 *
3027 *---------------------------------------------------------------------------*/ 2973 *---------------------------------------------------------------------------*/
3028#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3029void dm_rf_pathcheck_workitemcallback(struct work_struct *work) 2974void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
3030{ 2975{
3031 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 2976 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
3032 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq); 2977 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq);
3033 struct net_device *dev =priv->ieee80211->dev; 2978 struct net_device *dev =priv->ieee80211->dev;
3034#else
3035extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev)
3036{
3037 struct r8192_priv *priv = ieee80211_priv(dev);
3038#endif
3039 //bool bactually_set = false; 2979 //bool bactually_set = false;
3040 u8 rfpath = 0, i; 2980 u8 rfpath = 0, i;
3041 2981
@@ -3360,15 +3300,7 @@ static void dm_rxpath_sel_byrssi(struct net_device * dev)
3360static void dm_check_rx_path_selection(struct net_device *dev) 3300static void dm_check_rx_path_selection(struct net_device *dev)
3361{ 3301{
3362 struct r8192_priv *priv = ieee80211_priv(dev); 3302 struct r8192_priv *priv = ieee80211_priv(dev);
3363#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
3364 queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0); 3303 queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0);
3365#else
3366#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
3367 schedule_task(&priv->rfpath_check_wq);
3368#else
3369 queue_work(priv->priv_wq,&priv->rfpath_check_wq);
3370#endif
3371#endif
3372} /* dm_CheckRxRFPath */ 3304} /* dm_CheckRxRFPath */
3373 3305
3374 3306
diff --git a/drivers/staging/rtl8192e/r8192E_dm.h b/drivers/staging/rtl8192e/r8192E_dm.h
index ef452a22fa5d..f74a880506f1 100644
--- a/drivers/staging/rtl8192e/r8192E_dm.h
+++ b/drivers/staging/rtl8192e/r8192E_dm.h
@@ -280,11 +280,7 @@ extern void hal_dm_watchdog(struct net_device *dev);
280 280
281 281
282extern void init_rate_adaptive(struct net_device *dev); 282extern void init_rate_adaptive(struct net_device *dev);
283#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
284extern void dm_txpower_trackingcallback(struct work_struct *work); 283extern void dm_txpower_trackingcallback(struct work_struct *work);
285#else
286extern void dm_txpower_trackingcallback(struct net_device *dev);
287#endif
288 284
289extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); 285extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
290extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); 286extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
@@ -300,11 +296,7 @@ extern void dm_force_tx_fw_info(struct net_device *dev,
300 u32 force_value); 296 u32 force_value);
301extern void dm_init_edca_turbo(struct net_device *dev); 297extern void dm_init_edca_turbo(struct net_device *dev);
302extern void dm_rf_operation_test_callback(unsigned long data); 298extern void dm_rf_operation_test_callback(unsigned long data);
303#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
304extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); 299extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
305#else
306extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev);
307#endif
308extern void dm_fsync_timer_callback(unsigned long data); 300extern void dm_fsync_timer_callback(unsigned long data);
309#if 0 301#if 0
310extern bool dm_check_lbus_status(struct net_device *dev); 302extern bool dm_check_lbus_status(struct net_device *dev);
diff --git a/drivers/staging/rtl8192e/r8192E_wx.c b/drivers/staging/rtl8192e/r8192E_wx.c
index 88ad00db056e..e9e799c22863 100644
--- a/drivers/staging/rtl8192e/r8192E_wx.c
+++ b/drivers/staging/rtl8192e/r8192E_wx.c
@@ -1008,7 +1008,6 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
1008 union iwreq_data *wrqu, char *extra) 1008 union iwreq_data *wrqu, char *extra)
1009{ 1009{
1010 int ret=0; 1010 int ret=0;
1011#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1012 struct r8192_priv *priv = ieee80211_priv(dev); 1011 struct r8192_priv *priv = ieee80211_priv(dev);
1013 struct ieee80211_device* ieee = priv->ieee80211; 1012 struct ieee80211_device* ieee = priv->ieee80211;
1014 1013
@@ -1093,7 +1092,6 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
1093 1092
1094end_hw_sec: 1093end_hw_sec:
1095 up(&priv->wx_sem); 1094 up(&priv->wx_sem);
1096#endif
1097 return ret; 1095 return ret;
1098 1096
1099} 1097}
@@ -1102,13 +1100,11 @@ static int r8192_wx_set_auth(struct net_device *dev,
1102 union iwreq_data *data, char *extra) 1100 union iwreq_data *data, char *extra)
1103{ 1101{
1104 int ret=0; 1102 int ret=0;
1105#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1106 //printk("====>%s()\n", __FUNCTION__); 1103 //printk("====>%s()\n", __FUNCTION__);
1107 struct r8192_priv *priv = ieee80211_priv(dev); 1104 struct r8192_priv *priv = ieee80211_priv(dev);
1108 down(&priv->wx_sem); 1105 down(&priv->wx_sem);
1109 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra); 1106 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra);
1110 up(&priv->wx_sem); 1107 up(&priv->wx_sem);
1111#endif
1112 return ret; 1108 return ret;
1113} 1109}
1114 1110
@@ -1119,12 +1115,10 @@ static int r8192_wx_set_mlme(struct net_device *dev,
1119 //printk("====>%s()\n", __FUNCTION__); 1115 //printk("====>%s()\n", __FUNCTION__);
1120 1116
1121 int ret=0; 1117 int ret=0;
1122#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1123 struct r8192_priv *priv = ieee80211_priv(dev); 1118 struct r8192_priv *priv = ieee80211_priv(dev);
1124 down(&priv->wx_sem); 1119 down(&priv->wx_sem);
1125 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra); 1120 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra);
1126 up(&priv->wx_sem); 1121 up(&priv->wx_sem);
1127#endif
1128 return ret; 1122 return ret;
1129} 1123}
1130#endif 1124#endif
@@ -1134,18 +1128,12 @@ static int r8192_wx_set_gen_ie(struct net_device *dev,
1134{ 1128{
1135 //printk("====>%s(), len:%d\n", __FUNCTION__, data->length); 1129 //printk("====>%s(), len:%d\n", __FUNCTION__, data->length);
1136 int ret=0; 1130 int ret=0;
1137#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1138 struct r8192_priv *priv = ieee80211_priv(dev); 1131 struct r8192_priv *priv = ieee80211_priv(dev);
1139 down(&priv->wx_sem); 1132 down(&priv->wx_sem);
1140#if 1
1141 ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length); 1133 ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length);
1142#endif
1143 up(&priv->wx_sem); 1134 up(&priv->wx_sem);
1144 //printk("<======%s(), ret:%d\n", __FUNCTION__, ret); 1135 //printk("<======%s(), ret:%d\n", __FUNCTION__, ret);
1145#endif
1146 return ret; 1136 return ret;
1147
1148
1149} 1137}
1150 1138
1151static int dummy(struct net_device *dev, struct iw_request_info *a, 1139static int dummy(struct net_device *dev, struct iw_request_info *a,
@@ -1325,11 +1313,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
1325 wstats->qual.qual = 0; 1313 wstats->qual.qual = 0;
1326 wstats->qual.level = 0; 1314 wstats->qual.level = 0;
1327 wstats->qual.noise = 0; 1315 wstats->qual.noise = 0;
1328#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
1329 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; 1316 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
1330#else
1331 wstats->qual.updated = 0x0f;
1332#endif
1333 return wstats; 1317 return wstats;
1334 } 1318 }
1335 1319
@@ -1341,11 +1325,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
1341 wstats->qual.level = tmp_level; 1325 wstats->qual.level = tmp_level;
1342 wstats->qual.qual = tmp_qual; 1326 wstats->qual.qual = tmp_qual;
1343 wstats->qual.noise = tmp_noise; 1327 wstats->qual.noise = tmp_noise;
1344#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
1345 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; 1328 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
1346#else
1347 wstats->qual.updated = 0x0f;
1348#endif
1349 return wstats; 1329 return wstats;
1350} 1330}
1351//#endif 1331//#endif
diff --git a/drivers/staging/rtl8192e/r8192_pm.c b/drivers/staging/rtl8192e/r8192_pm.c
index d0f7c21bdf71..f898a19fe3fd 100644
--- a/drivers/staging/rtl8192e/r8192_pm.c
+++ b/drivers/staging/rtl8192e/r8192_pm.c
@@ -55,26 +55,12 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
55 write_nic_dword(dev,ISR,read_nic_dword(dev, ISR)); 55 write_nic_dword(dev,ISR,read_nic_dword(dev, ISR));
56 56
57 /* need to free DM related functions */ 57 /* need to free DM related functions */
58#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
59 cancel_work_sync(&priv->reset_wq); 58 cancel_work_sync(&priv->reset_wq);
60#else
61#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
62 cancel_delayed_work(&priv->reset_wq);
63#endif
64#endif
65 del_timer_sync(&priv->fsync_timer); 59 del_timer_sync(&priv->fsync_timer);
66 del_timer_sync(&priv->watch_dog_timer); 60 del_timer_sync(&priv->watch_dog_timer);
67#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
68 cancel_delayed_work(&priv->watch_dog_wq); 61 cancel_delayed_work(&priv->watch_dog_wq);
69 cancel_delayed_work(&priv->update_beacon_wq); 62 cancel_delayed_work(&priv->update_beacon_wq);
70#endif
71#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
72 cancel_work_sync(&priv->qos_activate); 63 cancel_work_sync(&priv->qos_activate);
73#else
74#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
75 cancel_delayed_work(&priv->qos_activate);
76#endif
77#endif
78 64
79 /* TODO 65 /* TODO
80#if ((DEV_BUS_TYPE == PCI_INTERFACE) && (HAL_CODE_BASE == RTL8192)) 66#if ((DEV_BUS_TYPE == PCI_INTERFACE) && (HAL_CODE_BASE == RTL8192))
diff --git a/drivers/staging/rtl8192e/r819xE_firmware.c b/drivers/staging/rtl8192e/r819xE_firmware.c
index 98fbd0c50281..6b62251d1ec3 100644
--- a/drivers/staging/rtl8192e/r819xE_firmware.c
+++ b/drivers/staging/rtl8192e/r819xE_firmware.c
@@ -20,9 +20,7 @@
20#include "r819xE_firmware_img.h" 20#include "r819xE_firmware_img.h"
21#endif 21#endif
22#include "r819xE_firmware.h" 22#include "r819xE_firmware.h"
23#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
24#include <linux/firmware.h> 23#include <linux/firmware.h>
25#endif
26 24
27void firmware_init_param(struct net_device *dev) 25void firmware_init_param(struct net_device *dev)
28{ 26{
@@ -254,11 +252,7 @@ bool init_firmware(struct net_device *dev)
254 * Download boot, main, and data image for System reset. 252 * Download boot, main, and data image for System reset.
255 * Download data image for firmware reseta 253 * Download data image for firmware reseta
256 */ 254 */
257#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
258 priv->firmware_source = FW_SOURCE_HEADER_FILE;
259#else
260 priv->firmware_source = FW_SOURCE_IMG_FILE; 255 priv->firmware_source = FW_SOURCE_IMG_FILE;
261#endif
262 for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) { 256 for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
263 /* 257 /*
264 * Open Image file, and map file to contineous memory if open file success. 258 * Open Image file, and map file to contineous memory if open file success.
@@ -268,7 +262,6 @@ bool init_firmware(struct net_device *dev)
268 switch(priv->firmware_source) { 262 switch(priv->firmware_source) {
269 case FW_SOURCE_IMG_FILE: 263 case FW_SOURCE_IMG_FILE:
270 { 264 {
271#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
272 if(pfirmware->firmware_buf_size[init_step] == 0) { 265 if(pfirmware->firmware_buf_size[init_step] == 0) {
273 rc = request_firmware(&fw_entry, fw_name[init_step],&priv->pdev->dev); 266 rc = request_firmware(&fw_entry, fw_name[init_step],&priv->pdev->dev);
274 if(rc < 0 ) { 267 if(rc < 0 ) {
@@ -300,15 +293,12 @@ bool init_firmware(struct net_device *dev)
300 } 293 }
301 //pfirmware->firmware_buf_size = file_length; 294 //pfirmware->firmware_buf_size = file_length;
302 295
303#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
304 if(rst_opt == OPT_SYSTEM_RESET) { 296 if(rst_opt == OPT_SYSTEM_RESET) {
305 release_firmware(fw_entry); 297 release_firmware(fw_entry);
306 } 298 }
307#endif
308 } 299 }
309 mapped_file = pfirmware->firmware_buf[init_step]; 300 mapped_file = pfirmware->firmware_buf[init_step];
310 file_length = pfirmware->firmware_buf_size[init_step]; 301 file_length = pfirmware->firmware_buf_size[init_step];
311#endif
312 break; 302 break;
313 } 303 }
314 case FW_SOURCE_HEADER_FILE: 304 case FW_SOURCE_HEADER_FILE: