aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/rtl8192e/r8192E.h3
-rw-r--r--drivers/staging/rtl8192e/r8192E_core.c178
-rw-r--r--drivers/staging/rtl8192e/r8192E_wx.c2
3 files changed, 82 insertions, 101 deletions
diff --git a/drivers/staging/rtl8192e/r8192E.h b/drivers/staging/rtl8192e/r8192E.h
index d04d4cc6900..7cbf69be6fe 100644
--- a/drivers/staging/rtl8192e/r8192E.h
+++ b/drivers/staging/rtl8192e/r8192E.h
@@ -1057,7 +1057,7 @@ void write_nic_dword(struct r8192_priv *priv, int x,u32 y);
1057 1057
1058int rtl8192_down(struct net_device *dev); 1058int rtl8192_down(struct net_device *dev);
1059int rtl8192_up(struct net_device *dev); 1059int rtl8192_up(struct net_device *dev);
1060void rtl8192_commit(struct net_device *dev); 1060void rtl8192_commit(struct r8192_priv *priv);
1061void write_phy(struct net_device *dev, u8 adr, u8 data); 1061void write_phy(struct net_device *dev, u8 adr, u8 data);
1062void CamResetAllEntry(struct r8192_priv *priv); 1062void CamResetAllEntry(struct r8192_priv *priv);
1063void EnableHWSecurityConfig8192(struct net_device *dev); 1063void EnableHWSecurityConfig8192(struct net_device *dev);
@@ -1069,7 +1069,6 @@ RT_STATUS cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress,
1069#ifdef ENABLE_IPS 1069#ifdef ENABLE_IPS
1070void IPSEnter(struct net_device *dev); 1070void IPSEnter(struct net_device *dev);
1071void IPSLeave(struct net_device *dev); 1071void IPSLeave(struct net_device *dev);
1072void InactivePsWorkItemCallback(struct net_device *dev);
1073void IPSLeave_wq(struct work_struct *work); 1072void IPSLeave_wq(struct work_struct *work);
1074void ieee80211_ips_leave_wq(struct net_device *dev); 1073void ieee80211_ips_leave_wq(struct net_device *dev);
1075void ieee80211_ips_leave(struct net_device *dev); 1074void ieee80211_ips_leave(struct net_device *dev);
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index 0ab40bc15c0..fb67e5f55f1 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -107,9 +107,9 @@ static void rtl819xE_tx_cmd(struct net_device *dev, struct sk_buff *skb);
107static void rtl8192_update_ratr_table(struct r8192_priv *priv); 107static void rtl8192_update_ratr_table(struct r8192_priv *priv);
108static void rtl8192_restart(struct work_struct *work); 108static void rtl8192_restart(struct work_struct *work);
109static void watch_dog_timer_callback(unsigned long data); 109static void watch_dog_timer_callback(unsigned long data);
110static int _rtl8192_up(struct net_device *dev); 110static int _rtl8192_up(struct r8192_priv *priv);
111static void rtl8192_cancel_deferred_work(struct r8192_priv* priv); 111static void rtl8192_cancel_deferred_work(struct r8192_priv* priv);
112static short rtl8192_tx(struct net_device *dev, struct sk_buff* skb); 112static short rtl8192_tx(struct r8192_priv *priv, struct sk_buff* skb);
113 113
114#ifdef ENABLE_DOT11D 114#ifdef ENABLE_DOT11D
115 115
@@ -528,9 +528,9 @@ static void rtl8192_proc_module_remove(void)
528} 528}
529 529
530 530
531static void rtl8192_proc_remove_one(struct net_device *dev) 531static void rtl8192_proc_remove_one(struct r8192_priv *priv)
532{ 532{
533 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); 533 struct net_device *dev = priv->ieee80211->dev;
534 534
535 printk("dev name=======> %s\n",dev->name); 535 printk("dev name=======> %s\n",dev->name);
536 536
@@ -545,10 +545,11 @@ static void rtl8192_proc_remove_one(struct net_device *dev)
545} 545}
546 546
547 547
548static void rtl8192_proc_init_one(struct net_device *dev) 548static void rtl8192_proc_init_one(struct r8192_priv *priv)
549{ 549{
550 struct net_device *dev = priv->ieee80211->dev;
550 struct proc_dir_entry *e; 551 struct proc_dir_entry *e;
551 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); 552
552 priv->dir_dev = create_proc_entry(dev->name, 553 priv->dir_dev = create_proc_entry(dev->name,
553 S_IFDIR | S_IRUGO | S_IXUGO, 554 S_IFDIR | S_IRUGO | S_IXUGO,
554 rtl8192_proc); 555 rtl8192_proc);
@@ -625,12 +626,10 @@ static void rtl8192_irq_enable(struct r8192_priv *priv)
625 write_nic_dword(priv, INTA_MASK, mask); 626 write_nic_dword(priv, INTA_MASK, mask);
626} 627}
627 628
628static void rtl8192_irq_disable(struct net_device *dev) 629static void rtl8192_irq_disable(struct r8192_priv *priv)
629{ 630{
630 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
631
632 write_nic_dword(priv, INTA_MASK, 0); 631 write_nic_dword(priv, INTA_MASK, 0);
633 synchronize_irq(dev->irq); 632 synchronize_irq(priv->irq);
634} 633}
635 634
636static void rtl8192_update_msr(struct r8192_priv *priv) 635static void rtl8192_update_msr(struct r8192_priv *priv)
@@ -700,9 +699,8 @@ static void rtl8192_tx_enable(struct r8192_priv *priv)
700} 699}
701 700
702 701
703static void rtl8192_free_rx_ring(struct net_device *dev) 702static void rtl8192_free_rx_ring(struct r8192_priv *priv)
704{ 703{
705 struct r8192_priv *priv = ieee80211_priv(dev);
706 int i; 704 int i;
707 705
708 for (i = 0; i < priv->rxringcount; i++) { 706 for (i = 0; i < priv->rxringcount; i++) {
@@ -721,9 +719,8 @@ static void rtl8192_free_rx_ring(struct net_device *dev)
721 priv->rx_ring = NULL; 719 priv->rx_ring = NULL;
722} 720}
723 721
724static void rtl8192_free_tx_ring(struct net_device *dev, unsigned int prio) 722static void rtl8192_free_tx_ring(struct r8192_priv *priv, unsigned int prio)
725{ 723{
726 struct r8192_priv *priv = ieee80211_priv(dev);
727 struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; 724 struct rtl8192_tx_ring *ring = &priv->tx_ring[prio];
728 725
729 while (skb_queue_len(&ring->queue)) { 726 while (skb_queue_len(&ring->queue)) {
@@ -760,9 +757,9 @@ void PHY_SetRtl8192eRfOff(struct r8192_priv *priv)
760 write_nic_byte(priv, ANAPAR_FOR_8192PciE, 0x07); 757 write_nic_byte(priv, ANAPAR_FOR_8192PciE, 0x07);
761} 758}
762 759
763static void rtl8192_halt_adapter(struct net_device *dev, bool reset) 760static void rtl8192_halt_adapter(struct r8192_priv *priv, bool reset)
764{ 761{
765 struct r8192_priv *priv = ieee80211_priv(dev); 762 struct net_device *dev = priv->ieee80211->dev;
766 int i; 763 int i;
767 u8 OpMode; 764 u8 OpMode;
768 u32 ulRegRead; 765 u32 ulRegRead;
@@ -848,7 +845,7 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
848 memcpy(skb->cb, &dev, sizeof(dev)); 845 memcpy(skb->cb, &dev, sizeof(dev));
849 846
850 skb_push(skb, priv->ieee80211->tx_headroom); 847 skb_push(skb, priv->ieee80211->tx_headroom);
851 ret = rtl8192_tx(dev, skb); 848 ret = rtl8192_tx(priv, skb);
852 if (ret != 0) { 849 if (ret != 0) {
853 kfree_skb(skb); 850 kfree_skb(skb);
854 } 851 }
@@ -891,7 +888,7 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
891 tcb_desc->bTxUseDriverAssingedRate = 1; 888 tcb_desc->bTxUseDriverAssingedRate = 1;
892 tcb_desc->bTxEnableFwCalcDur = 1; 889 tcb_desc->bTxEnableFwCalcDur = 1;
893 skb_push(skb, priv->ieee80211->tx_headroom); 890 skb_push(skb, priv->ieee80211->tx_headroom);
894 ret = rtl8192_tx(dev, skb); 891 ret = rtl8192_tx(priv, skb);
895 if (ret != 0) { 892 if (ret != 0) {
896 kfree_skb(skb); 893 kfree_skb(skb);
897 } 894 }
@@ -901,9 +898,8 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
901} 898}
902 899
903 900
904static void rtl8192_tx_isr(struct net_device *dev, int prio) 901static void rtl8192_tx_isr(struct r8192_priv *priv, int prio)
905{ 902{
906 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
907 struct rtl8192_tx_ring *ring = &priv->tx_ring[prio]; 903 struct rtl8192_tx_ring *ring = &priv->tx_ring[prio];
908 904
909 while (skb_queue_len(&ring->queue)) { 905 while (skb_queue_len(&ring->queue)) {
@@ -1203,9 +1199,8 @@ static u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc)
1203 * skb->cb will contain all the following information, 1199 * skb->cb will contain all the following information,
1204 * priority, morefrag, rate, &dev. 1200 * priority, morefrag, rate, &dev.
1205 */ 1201 */
1206static short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) 1202static short rtl8192_tx(struct r8192_priv *priv, struct sk_buff* skb)
1207{ 1203{
1208 struct r8192_priv *priv = ieee80211_priv(dev);
1209 struct rtl8192_tx_ring *ring; 1204 struct rtl8192_tx_ring *ring;
1210 unsigned long flags; 1205 unsigned long flags;
1211 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); 1206 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
@@ -1353,14 +1348,13 @@ static short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
1353 __skb_queue_tail(&ring->queue, skb); 1348 __skb_queue_tail(&ring->queue, skb);
1354 pdesc->OWN = 1; 1349 pdesc->OWN = 1;
1355 spin_unlock_irqrestore(&priv->irq_th_lock, flags); 1350 spin_unlock_irqrestore(&priv->irq_th_lock, flags);
1356 dev->trans_start = jiffies; 1351 priv->ieee80211->dev->trans_start = jiffies;
1357 write_nic_word(priv, TPPoll, 0x01<<tcb_desc->queue_index); 1352 write_nic_word(priv, TPPoll, 0x01<<tcb_desc->queue_index);
1358 return 0; 1353 return 0;
1359} 1354}
1360 1355
1361static short rtl8192_alloc_rx_desc_ring(struct net_device *dev) 1356static short rtl8192_alloc_rx_desc_ring(struct r8192_priv *priv)
1362{ 1357{
1363 struct r8192_priv *priv = ieee80211_priv(dev);
1364 rx_desc_819x_pci *entry = NULL; 1358 rx_desc_819x_pci *entry = NULL;
1365 int i; 1359 int i;
1366 1360
@@ -1396,10 +1390,9 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev)
1396 return 0; 1390 return 0;
1397} 1391}
1398 1392
1399static int rtl8192_alloc_tx_desc_ring(struct net_device *dev, 1393static int rtl8192_alloc_tx_desc_ring(struct r8192_priv *priv,
1400 unsigned int prio, unsigned int entries) 1394 unsigned int prio, unsigned int entries)
1401{ 1395{
1402 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1403 tx_desc_819x_pci *ring; 1396 tx_desc_819x_pci *ring;
1404 dma_addr_t dma; 1397 dma_addr_t dma;
1405 int i; 1398 int i;
@@ -1424,19 +1417,18 @@ static int rtl8192_alloc_tx_desc_ring(struct net_device *dev,
1424 return 0; 1417 return 0;
1425} 1418}
1426 1419
1427static short rtl8192_pci_initdescring(struct net_device *dev) 1420static short rtl8192_pci_initdescring(struct r8192_priv *priv)
1428{ 1421{
1429 u32 ret; 1422 u32 ret;
1430 int i; 1423 int i;
1431 struct r8192_priv *priv = ieee80211_priv(dev);
1432 1424
1433 ret = rtl8192_alloc_rx_desc_ring(dev); 1425 ret = rtl8192_alloc_rx_desc_ring(priv);
1434 if (ret) 1426 if (ret)
1435 return ret; 1427 return ret;
1436 1428
1437 /* general process for other queue */ 1429 /* general process for other queue */
1438 for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) { 1430 for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) {
1439 ret = rtl8192_alloc_tx_desc_ring(dev, i, priv->txringcount); 1431 ret = rtl8192_alloc_tx_desc_ring(priv, i, priv->txringcount);
1440 if (ret) 1432 if (ret)
1441 goto err_free_rings; 1433 goto err_free_rings;
1442 } 1434 }
@@ -1444,10 +1436,10 @@ static short rtl8192_pci_initdescring(struct net_device *dev)
1444 return 0; 1436 return 0;
1445 1437
1446err_free_rings: 1438err_free_rings:
1447 rtl8192_free_rx_ring(dev); 1439 rtl8192_free_rx_ring(priv);
1448 for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) 1440 for (i = 0; i < MAX_TX_QUEUE_COUNT; i++)
1449 if (priv->tx_ring[i].desc) 1441 if (priv->tx_ring[i].desc)
1450 rtl8192_free_tx_ring(dev, i); 1442 rtl8192_free_tx_ring(priv, i);
1451 return 1; 1443 return 1;
1452} 1444}
1453 1445
@@ -1762,7 +1754,7 @@ static void rtl8192_refresh_supportrate(struct r8192_priv* priv)
1762 memset(ieee->Regdot11HTOperationalRateSet, 0, 16); 1754 memset(ieee->Regdot11HTOperationalRateSet, 0, 16);
1763} 1755}
1764 1756
1765static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) 1757static u8 rtl8192_getSupportedWireleeMode(void)
1766{ 1758{
1767 return (WIRELESS_MODE_N_24G|WIRELESS_MODE_G|WIRELESS_MODE_B); 1759 return (WIRELESS_MODE_N_24G|WIRELESS_MODE_G|WIRELESS_MODE_B);
1768} 1760}
@@ -1770,7 +1762,7 @@ static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev)
1770static void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode) 1762static void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode)
1771{ 1763{
1772 struct r8192_priv *priv = ieee80211_priv(dev); 1764 struct r8192_priv *priv = ieee80211_priv(dev);
1773 u8 bSupportMode = rtl8192_getSupportedWireleeMode(dev); 1765 u8 bSupportMode = rtl8192_getSupportedWireleeMode();
1774 1766
1775 if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode&bSupportMode)==0)) 1767 if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode&bSupportMode)==0))
1776 { 1768 {
@@ -1889,9 +1881,8 @@ static void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl)
1889 rtl8192_hw_sleep_down(dev); 1881 rtl8192_hw_sleep_down(dev);
1890} 1882}
1891 1883
1892static void rtl8192_init_priv_variable(struct net_device* dev) 1884static void rtl8192_init_priv_variable(struct r8192_priv *priv)
1893{ 1885{
1894 struct r8192_priv *priv = ieee80211_priv(dev);
1895 u8 i; 1886 u8 i;
1896 PRT_POWER_SAVE_CONTROL pPSC = &priv->PowerSaveControl; 1887 PRT_POWER_SAVE_CONTROL pPSC = &priv->PowerSaveControl;
1897 1888
@@ -1920,7 +1911,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
1920 priv->ieee80211->rts = DEFAULT_RTS_THRESHOLD; 1911 priv->ieee80211->rts = DEFAULT_RTS_THRESHOLD;
1921 priv->ieee80211->rate = 110; //11 mbps 1912 priv->ieee80211->rate = 110; //11 mbps
1922 priv->ieee80211->short_slot = 1; 1913 priv->ieee80211->short_slot = 1;
1923 priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0; 1914 priv->promisc = (priv->ieee80211->dev->flags & IFF_PROMISC) ? 1:0;
1924 priv->bcck_in_ch14 = false; 1915 priv->bcck_in_ch14 = false;
1925 priv->CCKPresentAttentuation = 0; 1916 priv->CCKPresentAttentuation = 0;
1926 priv->rfa_txpowertrackingindex = 0; 1917 priv->rfa_txpowertrackingindex = 0;
@@ -2022,10 +2013,8 @@ static void rtl8192_init_priv_lock(struct r8192_priv* priv)
2022 2013
2023/* init tasklet and wait_queue here */ 2014/* init tasklet and wait_queue here */
2024#define DRV_NAME "wlan0" 2015#define DRV_NAME "wlan0"
2025static void rtl8192_init_priv_task(struct net_device* dev) 2016static void rtl8192_init_priv_task(struct r8192_priv *priv)
2026{ 2017{
2027 struct r8192_priv *priv = ieee80211_priv(dev);
2028
2029 priv->priv_wq = create_workqueue(DRV_NAME); 2018 priv->priv_wq = create_workqueue(DRV_NAME);
2030 2019
2031#ifdef ENABLE_IPS 2020#ifdef ENABLE_IPS
@@ -2048,10 +2037,9 @@ static void rtl8192_init_priv_task(struct net_device* dev)
2048 (unsigned long) priv); 2037 (unsigned long) priv);
2049} 2038}
2050 2039
2051static void rtl8192_get_eeprom_size(struct net_device* dev) 2040static void rtl8192_get_eeprom_size(struct r8192_priv *priv)
2052{ 2041{
2053 u16 curCR = 0; 2042 u16 curCR = 0;
2054 struct r8192_priv *priv = ieee80211_priv(dev);
2055 RT_TRACE(COMP_INIT, "===========>%s()\n", __FUNCTION__); 2043 RT_TRACE(COMP_INIT, "===========>%s()\n", __FUNCTION__);
2056 curCR = read_nic_dword(priv, EPROM_CMD); 2044 curCR = read_nic_dword(priv, EPROM_CMD);
2057 RT_TRACE(COMP_INIT, "read from Reg Cmd9346CR(%x):%x\n", EPROM_CMD, curCR); 2045 RT_TRACE(COMP_INIT, "read from Reg Cmd9346CR(%x):%x\n", EPROM_CMD, curCR);
@@ -2441,9 +2429,8 @@ static void rtl8192_read_eeprom_info(struct r8192_priv *priv)
2441} 2429}
2442 2430
2443 2431
2444static short rtl8192_get_channel_map(struct net_device * dev) 2432static short rtl8192_get_channel_map(struct r8192_priv *priv)
2445{ 2433{
2446 struct r8192_priv *priv = ieee80211_priv(dev);
2447#ifdef ENABLE_DOT11D 2434#ifdef ENABLE_DOT11D
2448 if(priv->ChannelPlan> COUNTRY_CODE_GLOBAL_DOMAIN){ 2435 if(priv->ChannelPlan> COUNTRY_CODE_GLOBAL_DOMAIN){
2449 printk("rtl8180_init:Error channel plan! Set to default.\n"); 2436 printk("rtl8180_init:Error channel plan! Set to default.\n");
@@ -2474,12 +2461,12 @@ static short rtl8192_init(struct net_device *dev)
2474{ 2461{
2475 struct r8192_priv *priv = ieee80211_priv(dev); 2462 struct r8192_priv *priv = ieee80211_priv(dev);
2476 memset(&(priv->stats),0,sizeof(struct Stats)); 2463 memset(&(priv->stats),0,sizeof(struct Stats));
2477 rtl8192_init_priv_variable(dev); 2464 rtl8192_init_priv_variable(priv);
2478 rtl8192_init_priv_lock(priv); 2465 rtl8192_init_priv_lock(priv);
2479 rtl8192_init_priv_task(dev); 2466 rtl8192_init_priv_task(priv);
2480 rtl8192_get_eeprom_size(dev); 2467 rtl8192_get_eeprom_size(priv);
2481 rtl8192_read_eeprom_info(priv); 2468 rtl8192_read_eeprom_info(priv);
2482 rtl8192_get_channel_map(dev); 2469 rtl8192_get_channel_map(priv);
2483 init_hal_dm(dev); 2470 init_hal_dm(dev);
2484 init_timer(&priv->watch_dog_timer); 2471 init_timer(&priv->watch_dog_timer);
2485 priv->watch_dog_timer.data = (unsigned long)dev; 2472 priv->watch_dog_timer.data = (unsigned long)dev;
@@ -2491,7 +2478,7 @@ static short rtl8192_init(struct net_device *dev)
2491 priv->irq=dev->irq; 2478 priv->irq=dev->irq;
2492 printk("IRQ %d",dev->irq); 2479 printk("IRQ %d",dev->irq);
2493 } 2480 }
2494 if(rtl8192_pci_initdescring(dev)!=0){ 2481 if (rtl8192_pci_initdescring(priv) != 0){
2495 printk("Endopoints initialization failed"); 2482 printk("Endopoints initialization failed");
2496 return -1; 2483 return -1;
2497 } 2484 }
@@ -2576,9 +2563,9 @@ static void rtl8192_hwconfig(struct r8192_priv *priv)
2576} 2563}
2577 2564
2578 2565
2579static RT_STATUS rtl8192_adapter_start(struct net_device *dev) 2566static RT_STATUS rtl8192_adapter_start(struct r8192_priv *priv)
2580{ 2567{
2581 struct r8192_priv *priv = ieee80211_priv(dev); 2568 struct net_device *dev = priv->ieee80211->dev;
2582 u32 ulRegRead; 2569 u32 ulRegRead;
2583 RT_STATUS rtStatus = RT_STATUS_SUCCESS; 2570 RT_STATUS rtStatus = RT_STATUS_SUCCESS;
2584 u8 tmpvalue; 2571 u8 tmpvalue;
@@ -2907,7 +2894,7 @@ static void rtl8192_prepare_beacon(unsigned long arg)
2907 2894
2908 skb_push(skb, priv->ieee80211->tx_headroom); 2895 skb_push(skb, priv->ieee80211->tx_headroom);
2909 if(skb){ 2896 if(skb){
2910 rtl8192_tx(priv->ieee80211->dev,skb); 2897 rtl8192_tx(priv, skb);
2911 } 2898 }
2912} 2899}
2913 2900
@@ -2926,7 +2913,7 @@ static void rtl8192_start_beacon(struct net_device *dev)
2926 u16 BcnIFS = 0xf; 2913 u16 BcnIFS = 0xf;
2927 2914
2928 DMESG("Enabling beacon TX"); 2915 DMESG("Enabling beacon TX");
2929 rtl8192_irq_disable(dev); 2916 rtl8192_irq_disable(priv);
2930 //rtl8192_beacon_tx_enable(dev); 2917 //rtl8192_beacon_tx_enable(dev);
2931 2918
2932 /* ATIM window */ 2919 /* ATIM window */
@@ -2964,9 +2951,8 @@ static void rtl8192_start_beacon(struct net_device *dev)
2964 rtl8192_irq_enable(priv); 2951 rtl8192_irq_enable(priv);
2965} 2952}
2966 2953
2967static bool HalRxCheckStuck8190Pci(struct net_device *dev) 2954static bool HalRxCheckStuck8190Pci(struct r8192_priv *priv)
2968{ 2955{
2969 struct r8192_priv *priv = ieee80211_priv(dev);
2970 u16 RegRxCounter = read_nic_word(priv, 0x130); 2956 u16 RegRxCounter = read_nic_word(priv, 0x130);
2971 bool bStuck = FALSE; 2957 bool bStuck = FALSE;
2972 2958
@@ -3024,10 +3010,10 @@ static bool HalRxCheckStuck8190Pci(struct net_device *dev)
3024 return bStuck; 3010 return bStuck;
3025} 3011}
3026 3012
3027static RESET_TYPE RxCheckStuck(struct net_device *dev) 3013static RESET_TYPE RxCheckStuck(struct r8192_priv *priv)
3028{ 3014{
3029 3015
3030 if(HalRxCheckStuck8190Pci(dev)) 3016 if(HalRxCheckStuck8190Pci(priv))
3031 { 3017 {
3032 RT_TRACE(COMP_RESET, "RxStuck Condition\n"); 3018 RT_TRACE(COMP_RESET, "RxStuck Condition\n");
3033 return RESET_TYPE_SILENT; 3019 return RESET_TYPE_SILENT;
@@ -3037,9 +3023,8 @@ static RESET_TYPE RxCheckStuck(struct net_device *dev)
3037} 3023}
3038 3024
3039static RESET_TYPE 3025static RESET_TYPE
3040rtl819x_ifcheck_resetornot(struct net_device *dev) 3026rtl819x_ifcheck_resetornot(struct r8192_priv *priv)
3041{ 3027{
3042 struct r8192_priv *priv = ieee80211_priv(dev);
3043 RESET_TYPE TxResetType = RESET_TYPE_NORESET; 3028 RESET_TYPE TxResetType = RESET_TYPE_NORESET;
3044 RESET_TYPE RxResetType = RESET_TYPE_NORESET; 3029 RESET_TYPE RxResetType = RESET_TYPE_NORESET;
3045 RT_RF_POWER_STATE rfState; 3030 RT_RF_POWER_STATE rfState;
@@ -3058,7 +3043,7 @@ rtl819x_ifcheck_resetornot(struct net_device *dev)
3058 // Driver should not check RX stuck in IBSS mode because it is required to 3043 // Driver should not check RX stuck in IBSS mode because it is required to
3059 // set Check BSSID in order to send beacon, however, if check BSSID is 3044 // set Check BSSID in order to send beacon, however, if check BSSID is
3060 // set, STA cannot hear any packet a all. Emily, 2008.04.12 3045 // set, STA cannot hear any packet a all. Emily, 2008.04.12
3061 RxResetType = RxCheckStuck(dev); 3046 RxResetType = RxCheckStuck(priv);
3062 } 3047 }
3063 3048
3064 RT_TRACE(COMP_RESET,"%s(): TxResetType is %d, RxResetType is %d\n",__FUNCTION__,TxResetType,RxResetType); 3049 RT_TRACE(COMP_RESET,"%s(): TxResetType is %d, RxResetType is %d\n",__FUNCTION__,TxResetType,RxResetType);
@@ -3072,9 +3057,10 @@ rtl819x_ifcheck_resetornot(struct net_device *dev)
3072} 3057}
3073 3058
3074#ifdef ENABLE_IPS 3059#ifdef ENABLE_IPS
3075void InactivePsWorkItemCallback(struct net_device *dev) 3060static void InactivePsWorkItemCallback(struct r8192_priv *priv)
3076{ 3061{
3077 struct r8192_priv *priv = ieee80211_priv(dev); 3062 struct net_device *dev = priv->ieee80211->dev;
3063
3078 PRT_POWER_SAVE_CONTROL pPSC = &priv->PowerSaveControl; 3064 PRT_POWER_SAVE_CONTROL pPSC = &priv->PowerSaveControl;
3079 3065
3080 RT_TRACE(COMP_POWER, "InactivePsWorkItemCallback() --------->\n"); 3066 RT_TRACE(COMP_POWER, "InactivePsWorkItemCallback() --------->\n");
@@ -3219,7 +3205,7 @@ IPSEnter(struct net_device *dev)
3219 RT_TRACE(COMP_RF,"IPSEnter(): Turn off RF.\n"); 3205 RT_TRACE(COMP_RF,"IPSEnter(): Turn off RF.\n");
3220 pPSC->eInactivePowerState = eRfOff; 3206 pPSC->eInactivePowerState = eRfOff;
3221// queue_work(priv->priv_wq,&(pPSC->InactivePsWorkItem)); 3207// queue_work(priv->priv_wq,&(pPSC->InactivePsWorkItem));
3222 InactivePsWorkItemCallback(dev); 3208 InactivePsWorkItemCallback(priv);
3223 } 3209 }
3224 } 3210 }
3225} 3211}
@@ -3243,7 +3229,7 @@ IPSLeave(struct net_device *dev)
3243 { 3229 {
3244 RT_TRACE(COMP_POWER, "IPSLeave(): Turn on RF.\n"); 3230 RT_TRACE(COMP_POWER, "IPSLeave(): Turn on RF.\n");
3245 pPSC->eInactivePowerState = eRfOn; 3231 pPSC->eInactivePowerState = eRfOn;
3246 InactivePsWorkItemCallback(dev); 3232 InactivePsWorkItemCallback(priv);
3247 } 3233 }
3248 } 3234 }
3249} 3235}
@@ -3315,7 +3301,7 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
3315{ 3301{
3316 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 3302 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
3317 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq); 3303 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq);
3318 struct net_device *dev = priv->ieee80211->dev; 3304 struct net_device *dev = priv->ieee80211->dev;
3319 struct ieee80211_device* ieee = priv->ieee80211; 3305 struct ieee80211_device* ieee = priv->ieee80211;
3320 RESET_TYPE ResetType = RESET_TYPE_NORESET; 3306 RESET_TYPE ResetType = RESET_TYPE_NORESET;
3321 bool bBusyTraffic = false; 3307 bool bBusyTraffic = false;
@@ -3413,7 +3399,7 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
3413 if (priv->watchdog_check_reset_cnt++ >= 3 && !ieee->is_roaming && 3399 if (priv->watchdog_check_reset_cnt++ >= 3 && !ieee->is_roaming &&
3414 priv->watchdog_last_time != 1) 3400 priv->watchdog_last_time != 1)
3415 { 3401 {
3416 ResetType = rtl819x_ifcheck_resetornot(dev); 3402 ResetType = rtl819x_ifcheck_resetornot(priv);
3417 priv->watchdog_check_reset_cnt = 3; 3403 priv->watchdog_check_reset_cnt = 3;
3418 } 3404 }
3419 if(!priv->bDisableNormalResetCheck && ResetType == RESET_TYPE_NORMAL) 3405 if(!priv->bDisableNormalResetCheck && ResetType == RESET_TYPE_NORMAL)
@@ -3446,16 +3432,17 @@ void watch_dog_timer_callback(unsigned long data)
3446 3432
3447} 3433}
3448 3434
3449static int _rtl8192_up(struct net_device *dev) 3435static int _rtl8192_up(struct r8192_priv *priv)
3450{ 3436{
3451 struct r8192_priv *priv = ieee80211_priv(dev);
3452 RT_STATUS init_status = RT_STATUS_SUCCESS; 3437 RT_STATUS init_status = RT_STATUS_SUCCESS;
3438 struct net_device *dev = priv->ieee80211->dev;
3439
3453 priv->up=1; 3440 priv->up=1;
3454 priv->ieee80211->ieee_up=1; 3441 priv->ieee80211->ieee_up=1;
3455 priv->bdisable_nic = false; //YJ,add,091111 3442 priv->bdisable_nic = false; //YJ,add,091111
3456 RT_TRACE(COMP_INIT, "Bringing up iface\n"); 3443 RT_TRACE(COMP_INIT, "Bringing up iface\n");
3457 3444
3458 init_status = rtl8192_adapter_start(dev); 3445 init_status = rtl8192_adapter_start(priv);
3459 if(init_status != RT_STATUS_SUCCESS) 3446 if(init_status != RT_STATUS_SUCCESS)
3460 { 3447 {
3461 RT_TRACE(COMP_ERR,"ERR!!! %s(): initialization is failed!\n",__FUNCTION__); 3448 RT_TRACE(COMP_ERR,"ERR!!! %s(): initialization is failed!\n",__FUNCTION__);
@@ -3498,7 +3485,7 @@ int rtl8192_up(struct net_device *dev)
3498 3485
3499 if (priv->up == 1) return -1; 3486 if (priv->up == 1) return -1;
3500 3487
3501 return _rtl8192_up(dev); 3488 return _rtl8192_up(priv);
3502} 3489}
3503 3490
3504 3491
@@ -3536,14 +3523,14 @@ int rtl8192_down(struct net_device *dev)
3536 if (!netif_queue_stopped(dev)) 3523 if (!netif_queue_stopped(dev))
3537 netif_stop_queue(dev); 3524 netif_stop_queue(dev);
3538 3525
3539 rtl8192_irq_disable(dev); 3526 rtl8192_irq_disable(priv);
3540 rtl8192_cancel_deferred_work(priv); 3527 rtl8192_cancel_deferred_work(priv);
3541 deinit_hal_dm(dev); 3528 deinit_hal_dm(dev);
3542 del_timer_sync(&priv->watch_dog_timer); 3529 del_timer_sync(&priv->watch_dog_timer);
3543 3530
3544 ieee80211_softmac_stop_protocol(priv->ieee80211,true); 3531 ieee80211_softmac_stop_protocol(priv->ieee80211,true);
3545 3532
3546 rtl8192_halt_adapter(dev,false); 3533 rtl8192_halt_adapter(priv, false);
3547 memset(&priv->ieee80211->current_network, 0 , offsetof(struct ieee80211_network, list)); 3534 memset(&priv->ieee80211->current_network, 0 , offsetof(struct ieee80211_network, list));
3548 3535
3549 RT_TRACE(COMP_DOWN, "<==========%s()\n", __FUNCTION__); 3536 RT_TRACE(COMP_DOWN, "<==========%s()\n", __FUNCTION__);
@@ -3552,28 +3539,25 @@ int rtl8192_down(struct net_device *dev)
3552} 3539}
3553 3540
3554 3541
3555void rtl8192_commit(struct net_device *dev) 3542void rtl8192_commit(struct r8192_priv *priv)
3556{ 3543{
3557 struct r8192_priv *priv = ieee80211_priv(dev);
3558
3559 if (priv->up == 0) return ; 3544 if (priv->up == 0) return ;
3560 3545
3561 3546
3562 ieee80211_softmac_stop_protocol(priv->ieee80211,true); 3547 ieee80211_softmac_stop_protocol(priv->ieee80211,true);
3563 3548
3564 rtl8192_irq_disable(dev); 3549 rtl8192_irq_disable(priv);
3565 rtl8192_halt_adapter(dev,true); 3550 rtl8192_halt_adapter(priv, true);
3566 _rtl8192_up(dev); 3551 _rtl8192_up(priv);
3567} 3552}
3568 3553
3569static void rtl8192_restart(struct work_struct *work) 3554static void rtl8192_restart(struct work_struct *work)
3570{ 3555{
3571 struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); 3556 struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq);
3572 struct net_device *dev = priv->ieee80211->dev;
3573 3557
3574 down(&priv->wx_sem); 3558 down(&priv->wx_sem);
3575 3559
3576 rtl8192_commit(dev); 3560 rtl8192_commit(priv);
3577 3561
3578 up(&priv->wx_sem); 3562 up(&priv->wx_sem);
3579} 3563}
@@ -4730,7 +4714,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
4730 4714
4731 register_netdev(dev); 4715 register_netdev(dev);
4732 RT_TRACE(COMP_INIT, "dev name=======> %s\n",dev->name); 4716 RT_TRACE(COMP_INIT, "dev name=======> %s\n",dev->name);
4733 rtl8192_proc_init_one(dev); 4717 rtl8192_proc_init_one(priv);
4734 4718
4735 4719
4736 RT_TRACE(COMP_INIT, "Driver probe completed\n"); 4720 RT_TRACE(COMP_INIT, "Driver probe completed\n");
@@ -4794,7 +4778,7 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev)
4794 4778
4795 priv = ieee80211_priv(dev); 4779 priv = ieee80211_priv(dev);
4796 4780
4797 rtl8192_proc_remove_one(dev); 4781 rtl8192_proc_remove_one(priv);
4798 4782
4799 rtl8192_down(dev); 4783 rtl8192_down(dev);
4800 if (priv->pFirmware) 4784 if (priv->pFirmware)
@@ -4805,9 +4789,9 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev)
4805 destroy_workqueue(priv->priv_wq); 4789 destroy_workqueue(priv->priv_wq);
4806 4790
4807 /* free tx/rx rings */ 4791 /* free tx/rx rings */
4808 rtl8192_free_rx_ring(dev); 4792 rtl8192_free_rx_ring(priv);
4809 for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) 4793 for (i = 0; i < MAX_TX_QUEUE_COUNT; i++)
4810 rtl8192_free_tx_ring(dev, i); 4794 rtl8192_free_tx_ring(priv, i);
4811 4795
4812 if (priv->irq) { 4796 if (priv->irq) {
4813 printk("Freeing irq %d\n",dev->irq); 4797 printk("Freeing irq %d\n",dev->irq);
@@ -4895,26 +4879,26 @@ static irqreturn_t rtl8192_interrupt(int irq, void *netdev)
4895 4879
4896 if (inta & IMR_TBDOK) { 4880 if (inta & IMR_TBDOK) {
4897 RT_TRACE(COMP_INTR, "beacon ok interrupt!\n"); 4881 RT_TRACE(COMP_INTR, "beacon ok interrupt!\n");
4898 rtl8192_tx_isr(dev, BEACON_QUEUE); 4882 rtl8192_tx_isr(priv, BEACON_QUEUE);
4899 priv->stats.txbeaconokint++; 4883 priv->stats.txbeaconokint++;
4900 } 4884 }
4901 4885
4902 if (inta & IMR_TBDER) { 4886 if (inta & IMR_TBDER) {
4903 RT_TRACE(COMP_INTR, "beacon ok interrupt!\n"); 4887 RT_TRACE(COMP_INTR, "beacon ok interrupt!\n");
4904 rtl8192_tx_isr(dev, BEACON_QUEUE); 4888 rtl8192_tx_isr(priv, BEACON_QUEUE);
4905 priv->stats.txbeaconerr++; 4889 priv->stats.txbeaconerr++;
4906 } 4890 }
4907 4891
4908 if (inta & IMR_MGNTDOK ) { 4892 if (inta & IMR_MGNTDOK ) {
4909 RT_TRACE(COMP_INTR, "Manage ok interrupt!\n"); 4893 RT_TRACE(COMP_INTR, "Manage ok interrupt!\n");
4910 priv->stats.txmanageokint++; 4894 priv->stats.txmanageokint++;
4911 rtl8192_tx_isr(dev,MGNT_QUEUE); 4895 rtl8192_tx_isr(priv, MGNT_QUEUE);
4912 } 4896 }
4913 4897
4914 if (inta & IMR_COMDOK) 4898 if (inta & IMR_COMDOK)
4915 { 4899 {
4916 priv->stats.txcmdpktokint++; 4900 priv->stats.txcmdpktokint++;
4917 rtl8192_tx_isr(dev, TXCMD_QUEUE); 4901 rtl8192_tx_isr(priv, TXCMD_QUEUE);
4918 } 4902 }
4919 4903
4920 if (inta & IMR_ROK) { 4904 if (inta & IMR_ROK) {
@@ -4948,27 +4932,27 @@ static irqreturn_t rtl8192_interrupt(int irq, void *netdev)
4948 RT_TRACE(COMP_INTR, "BK Tx OK interrupt!\n"); 4932 RT_TRACE(COMP_INTR, "BK Tx OK interrupt!\n");
4949 priv->stats.txbkokint++; 4933 priv->stats.txbkokint++;
4950 priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++; 4934 priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++;
4951 rtl8192_tx_isr(dev, BK_QUEUE); 4935 rtl8192_tx_isr(priv, BK_QUEUE);
4952 } 4936 }
4953 4937
4954 if (inta & IMR_BEDOK) { 4938 if (inta & IMR_BEDOK) {
4955 RT_TRACE(COMP_INTR, "BE TX OK interrupt!\n"); 4939 RT_TRACE(COMP_INTR, "BE TX OK interrupt!\n");
4956 priv->stats.txbeokint++; 4940 priv->stats.txbeokint++;
4957 priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++; 4941 priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++;
4958 rtl8192_tx_isr(dev, BE_QUEUE); 4942 rtl8192_tx_isr(priv, BE_QUEUE);
4959 } 4943 }
4960 4944
4961 if (inta & IMR_VIDOK) { 4945 if (inta & IMR_VIDOK) {
4962 RT_TRACE(COMP_INTR, "VI TX OK interrupt!\n"); 4946 RT_TRACE(COMP_INTR, "VI TX OK interrupt!\n");
4963 priv->stats.txviokint++; 4947 priv->stats.txviokint++;
4964 priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++; 4948 priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++;
4965 rtl8192_tx_isr(dev, VI_QUEUE); 4949 rtl8192_tx_isr(priv, VI_QUEUE);
4966 } 4950 }
4967 4951
4968 if (inta & IMR_VODOK) { 4952 if (inta & IMR_VODOK) {
4969 priv->stats.txvookint++; 4953 priv->stats.txvookint++;
4970 priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++; 4954 priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++;
4971 rtl8192_tx_isr(dev, VO_QUEUE); 4955 rtl8192_tx_isr(priv, VO_QUEUE);
4972 } 4956 }
4973 4957
4974out_unlock: 4958out_unlock:
@@ -5094,7 +5078,6 @@ void setKey( struct net_device *dev,
5094bool NicIFEnableNIC(struct r8192_priv *priv) 5078bool NicIFEnableNIC(struct r8192_priv *priv)
5095{ 5079{
5096 RT_STATUS init_status = RT_STATUS_SUCCESS; 5080 RT_STATUS init_status = RT_STATUS_SUCCESS;
5097 struct net_device *dev = priv->ieee80211->dev;
5098 PRT_POWER_SAVE_CONTROL pPSC = &priv->PowerSaveControl; 5081 PRT_POWER_SAVE_CONTROL pPSC = &priv->PowerSaveControl;
5099 5082
5100 //YJ,add,091109 5083 //YJ,add,091109
@@ -5108,7 +5091,7 @@ bool NicIFEnableNIC(struct r8192_priv *priv)
5108 5091
5109 // <2> Enable Adapter 5092 // <2> Enable Adapter
5110 //priv->bfirst_init = true; 5093 //priv->bfirst_init = true;
5111 init_status = rtl8192_adapter_start(dev); 5094 init_status = rtl8192_adapter_start(priv);
5112 if (init_status != RT_STATUS_SUCCESS) { 5095 if (init_status != RT_STATUS_SUCCESS) {
5113 RT_TRACE(COMP_ERR,"ERR!!! %s(): initialization is failed!\n",__FUNCTION__); 5096 RT_TRACE(COMP_ERR,"ERR!!! %s(): initialization is failed!\n",__FUNCTION__);
5114 priv->bdisable_nic = false; //YJ,add,091111 5097 priv->bdisable_nic = false; //YJ,add,091111
@@ -5127,7 +5110,6 @@ bool NicIFEnableNIC(struct r8192_priv *priv)
5127bool NicIFDisableNIC(struct r8192_priv *priv) 5110bool NicIFDisableNIC(struct r8192_priv *priv)
5128{ 5111{
5129 bool status = true; 5112 bool status = true;
5130 struct net_device *dev = priv->ieee80211->dev;
5131 u8 tmp_state = 0; 5113 u8 tmp_state = 0;
5132 // <1> Disable Interrupt 5114 // <1> Disable Interrupt
5133 5115
@@ -5138,11 +5120,11 @@ bool NicIFDisableNIC(struct r8192_priv *priv)
5138 5120
5139 priv->ieee80211->state = tmp_state; 5121 priv->ieee80211->state = tmp_state;
5140 rtl8192_cancel_deferred_work(priv); 5122 rtl8192_cancel_deferred_work(priv);
5141 rtl8192_irq_disable(dev); 5123 rtl8192_irq_disable(priv);
5142 // <2> Stop all timer 5124 // <2> Stop all timer
5143 5125
5144 // <3> Disable Adapter 5126 // <3> Disable Adapter
5145 rtl8192_halt_adapter(dev, false); 5127 rtl8192_halt_adapter(priv, false);
5146// priv->bdisable_nic = true; 5128// priv->bdisable_nic = true;
5147 5129
5148 return status; 5130 return status;
diff --git a/drivers/staging/rtl8192e/r8192E_wx.c b/drivers/staging/rtl8192e/r8192E_wx.c
index cf581c6e484..57d97adf125 100644
--- a/drivers/staging/rtl8192e/r8192E_wx.c
+++ b/drivers/staging/rtl8192e/r8192E_wx.c
@@ -770,7 +770,7 @@ static int r8192_wx_set_retry(struct net_device *dev,
770 * I'm unsure if whole reset is really needed 770 * I'm unsure if whole reset is really needed
771 */ 771 */
772 772
773 rtl8192_commit(dev); 773 rtl8192_commit(priv);
774 /* 774 /*
775 if(priv->up){ 775 if(priv->up){
776 rtl8180_rtx_disable(dev); 776 rtl8180_rtx_disable(dev);