]> Pileus Git - ~andy/linux/blobdiff - drivers/staging/rtl8192e/r8192E_core.c
Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
[~andy/linux] / drivers / staging / rtl8192e / r8192E_core.c
index 1028d434dd3963f3a66ddd7556090eaef1b86741..58d800f1b5ee1878f66da3717677eb816cdc7e74 100644 (file)
@@ -96,13 +96,13 @@ static struct pci_driver rtl8192_pci_driver = {
 #endif
 };
 
-static void rtl8192_start_beacon(struct net_device *dev);
-static void rtl8192_stop_beacon(struct net_device *dev);
+static void rtl8192_start_beacon(struct ieee80211_device *ieee80211);
+static void rtl8192_stop_beacon(struct ieee80211_device *ieee80211);
 static void rtl819x_watchdog_wqcallback(struct work_struct *work);
 static void rtl8192_irq_rx_tasklet(unsigned long arg);
 static void rtl8192_irq_tx_tasklet(unsigned long arg);
 static void rtl8192_prepare_beacon(unsigned long arg);
-static irqreturn_t rtl8192_interrupt(int irq, void *netdev);
+static irqreturn_t rtl8192_interrupt(int irq, void *param);
 static void rtl819xE_tx_cmd(struct r8192_priv *priv, struct sk_buff *skb);
 static void rtl8192_update_ratr_table(struct r8192_priv *priv);
 static void rtl8192_restart(struct work_struct *work);
@@ -210,40 +210,34 @@ u32 read_cam(struct r8192_priv *priv, u8 addr)
 
 u8 read_nic_byte(struct r8192_priv *priv, int x)
 {
-       struct net_device *dev = priv->ieee80211->dev;
-        return 0xff&readb((u8*)dev->mem_start +x);
+        return 0xff & readb(priv->mem_start + x);
 }
 
 u32 read_nic_dword(struct r8192_priv *priv, int x)
 {
-       struct net_device *dev = priv->ieee80211->dev;
-        return readl((u8*)dev->mem_start +x);
+        return readl(priv->mem_start + x);
 }
 
 u16 read_nic_word(struct r8192_priv *priv, int x)
 {
-       struct net_device *dev = priv->ieee80211->dev;
-        return readw((u8*)dev->mem_start +x);
+        return readw(priv->mem_start + x);
 }
 
 void write_nic_byte(struct r8192_priv *priv, int x,u8 y)
 {
-       struct net_device *dev = priv->ieee80211->dev;
-        writeb(y,(u8*)dev->mem_start +x);
+        writeb(y, priv->mem_start + x);
        udelay(20);
 }
 
 void write_nic_dword(struct r8192_priv *priv, int x,u32 y)
 {
-       struct net_device *dev = priv->ieee80211->dev;
-        writel(y,(u8*)dev->mem_start +x);
+        writel(y, priv->mem_start + x);
        udelay(20);
 }
 
 void write_nic_word(struct r8192_priv *priv, int x,u16 y)
 {
-       struct net_device *dev = priv->ieee80211->dev;
-        writew(y,(u8*)dev->mem_start +x);
+        writew(y, priv->mem_start + x);
        udelay(20);
 }
 
@@ -277,10 +271,9 @@ u8 rtl8192e_ap_sec_type(struct ieee80211_device *ieee)
        }
 }
 
-void
-rtl8192e_SetHwReg(struct net_device *dev,u8 variable,u8* val)
+void rtl8192e_SetHwReg(struct ieee80211_device *ieee80211, u8 variable, u8 *val)
 {
-       struct r8192_priv* priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
 
        switch(variable)
        {
@@ -374,8 +367,7 @@ static int proc_get_stats_ap(char *page, char **start,
                          off_t offset, int count,
                          int *eof, void *data)
 {
-       struct net_device *dev = data;
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+       struct r8192_priv *priv = data;
        struct ieee80211_device *ieee = priv->ieee80211;
        struct ieee80211_network *target;
        int len = 0;
@@ -404,8 +396,7 @@ static int proc_get_registers(char *page, char **start,
                          off_t offset, int count,
                          int *eof, void *data)
 {
-       struct net_device *dev = data;
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = data;
        int len = 0;
        int i,n;
        int max=0xff;
@@ -457,8 +448,7 @@ static int proc_get_stats_tx(char *page, char **start,
                          off_t offset, int count,
                          int *eof, void *data)
 {
-       struct net_device *dev = data;
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+       struct r8192_priv *priv = data;
 
        int len = 0;
 
@@ -483,7 +473,7 @@ static int proc_get_stats_tx(char *page, char **start,
                priv->stats.txbeaconokint,
                priv->stats.txbeaconerr,
                priv->stats.txcmdpktokint,
-               netif_queue_stopped(dev),
+               netif_queue_stopped(priv->ieee80211->dev),
                priv->stats.txoverflow,
                priv->ieee80211->stats.tx_packets,
                priv->ieee80211->stats.tx_bytes);
@@ -498,9 +488,7 @@ static int proc_get_stats_rx(char *page, char **start,
                          off_t offset, int count,
                          int *eof, void *data)
 {
-       struct net_device *dev = data;
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-
+       struct r8192_priv *priv = data;
        int len = 0;
 
        len += snprintf(page + len, count - len,
@@ -559,7 +547,7 @@ static void rtl8192_proc_init_one(struct r8192_priv *priv)
                return;
        }
        e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
-                                  priv->dir_dev, proc_get_stats_rx, dev);
+                                  priv->dir_dev, proc_get_stats_rx, priv);
 
        if (!e) {
                RT_TRACE(COMP_ERR,"Unable to initialize "
@@ -569,7 +557,7 @@ static void rtl8192_proc_init_one(struct r8192_priv *priv)
 
 
        e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
-                                  priv->dir_dev, proc_get_stats_tx, dev);
+                                  priv->dir_dev, proc_get_stats_tx, priv);
 
        if (!e) {
                RT_TRACE(COMP_ERR, "Unable to initialize "
@@ -578,7 +566,7 @@ static void rtl8192_proc_init_one(struct r8192_priv *priv)
        }
 
        e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
-                                  priv->dir_dev, proc_get_stats_ap, dev);
+                                  priv->dir_dev, proc_get_stats_ap, priv);
 
        if (!e) {
                RT_TRACE(COMP_ERR, "Unable to initialize "
@@ -587,7 +575,7 @@ static void rtl8192_proc_init_one(struct r8192_priv *priv)
        }
 
        e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
-                                  priv->dir_dev, proc_get_registers, dev);
+                                  priv->dir_dev, proc_get_registers, priv);
        if (!e) {
                RT_TRACE(COMP_ERR, "Unable to initialize "
                      "/proc/net/rtl8192/%s/registers\n",
@@ -595,9 +583,9 @@ static void rtl8192_proc_init_one(struct r8192_priv *priv)
        }
 }
 
-static short check_nic_enough_desc(struct net_device *dev, int prio)
+static short check_nic_enough_desc(struct ieee80211_device *ieee, int prio)
 {
-    struct r8192_priv *priv = ieee80211_priv(dev);
+    struct r8192_priv *priv = ieee80211_priv(ieee->dev);
     struct rtl8192_tx_ring *ring = &priv->tx_ring[prio];
 
     /* for now we reserve two free descriptor as a safety boundary
@@ -659,16 +647,16 @@ static void rtl8192_update_msr(struct r8192_priv *priv)
        write_nic_byte(priv, MSR, msr);
 }
 
-static void rtl8192_set_chan(struct net_device *dev,short ch)
+static void rtl8192_set_chan(struct ieee80211_device *ieee80211, short ch)
 {
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
 
        priv->chan = ch;
 
        /* need to implement rf set channel here WB */
 
        if (priv->rf_set_chan)
-               priv->rf_set_chan(dev, priv->chan);
+               priv->rf_set_chan(ieee80211, priv->chan);
 }
 
 static void rtl8192_rx_enable(struct r8192_priv *priv)
@@ -759,13 +747,12 @@ void PHY_SetRtl8192eRfOff(struct r8192_priv *priv)
 
 static void rtl8192_halt_adapter(struct r8192_priv *priv, bool reset)
 {
-       struct net_device *dev = priv->ieee80211->dev;
        int i;
        u8 OpMode;
        u32 ulRegRead;
 
        OpMode = RT_OP_MODE_NO_LINK;
-       priv->ieee80211->SetHwRegHandler(dev, HW_VAR_MEDIA_STATUS, &OpMode);
+       priv->ieee80211->SetHwRegHandler(priv->ieee80211, HW_VAR_MEDIA_STATUS, &OpMode);
 
        if (!priv->ieee80211->bSupportRemoteWakeUp) {
                /*
@@ -814,11 +801,11 @@ static void rtl8192_halt_adapter(struct r8192_priv *priv, bool reset)
        skb_queue_purge(&priv->skb_queue);
 }
 
-static void rtl8192_data_hard_stop(struct net_device *dev)
+static void rtl8192_data_hard_stop(struct ieee80211_device *ieee80211)
 {
 }
 
-static void rtl8192_data_hard_resume(struct net_device *dev)
+static void rtl8192_data_hard_resume(struct ieee80211_device *ieee80211)
 {
 }
 
@@ -826,9 +813,10 @@ static void rtl8192_data_hard_resume(struct net_device *dev)
  * this function TX data frames when the ieee80211 stack requires this.
  * It checks also if we need to stop the ieee tx queue, eventually do it
  */
-static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
+static void rtl8192_hard_data_xmit(struct sk_buff *skb,
+                                  struct ieee80211_device *ieee80211, int rate)
 {
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
        int ret;
        cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
        u8 queue_index = tcb_desc->queue_index;
@@ -842,8 +830,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
                return;
        }
 
-       memcpy(skb->cb, &dev, sizeof(dev));
-
        skb_push(skb, priv->ieee80211->tx_headroom);
        ret = rtl8192_tx(priv, skb);
        if (ret != 0) {
@@ -862,9 +848,9 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
  * If the ring is full packet are dropped (for data frame the queue
  * is stopped before this can happen).
  */
-static int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
+static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct ieee80211_device *ieee80211)
 {
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
        int ret;
         cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
         u8 queue_index = tcb_desc->queue_index;
@@ -877,7 +863,6 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
                }
         }
 
-        memcpy(skb->cb, &dev, sizeof(dev));
        if (queue_index == TXCMD_QUEUE) {
                rtl819xE_tx_cmd(priv, skb);
                ret = 0;
@@ -887,7 +872,7 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
                tcb_desc->bTxDisableRateFallBack = 1;
                tcb_desc->bTxUseDriverAssingedRate = 1;
                tcb_desc->bTxEnableFwCalcDur = 1;
-               skb_push(skb, priv->ieee80211->tx_headroom);
+               skb_push(skb, ieee80211->tx_headroom);
                ret = rtl8192_tx(priv, skb);
                if (ret != 0) {
                        kfree_skb(skb);
@@ -929,7 +914,7 @@ static void rtl8192_tx_isr(struct r8192_priv *priv, int prio)
        }
 }
 
-static void rtl8192_stop_beacon(struct net_device *dev)
+static void rtl8192_stop_beacon(struct ieee80211_device *ieee80211)
 {
 }
 
@@ -1476,10 +1461,9 @@ static void rtl8192_pci_resetdescring(struct r8192_priv *priv)
     }
 }
 
-static void rtl8192_link_change(struct net_device *dev)
+static void rtl8192_link_change(struct ieee80211_device *ieee)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
-       struct ieee80211_device* ieee = priv->ieee80211;
+       struct r8192_priv *priv = ieee80211_priv(ieee->dev);
 
        if (ieee->state == IEEE80211_LINKED)
        {
@@ -1610,11 +1594,11 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
 }
 
 /* handle manage frame frame beacon and probe response */
-static int rtl8192_handle_beacon(struct net_device * dev,
+static int rtl8192_handle_beacon(struct ieee80211_device *ieee,
                               struct ieee80211_beacon * beacon,
                               struct ieee80211_network * network)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee->dev);
 
        rtl8192_qos_handle_probe_response(priv,1,network);
 
@@ -1676,11 +1660,11 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv,
 }
 
 
-static int rtl8192_handle_assoc_response(struct net_device *dev,
+static int rtl8192_handle_assoc_response(struct ieee80211_device *ieee,
                                      struct ieee80211_assoc_response_frame *resp,
                                      struct ieee80211_network *network)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
+        struct r8192_priv *priv = ieee80211_priv(ieee->dev);
         rtl8192_qos_association_resp(priv, network);
         return 0;
 }
@@ -1732,11 +1716,8 @@ static void rtl8192_update_ratr_table(struct r8192_priv* priv)
        write_nic_byte(priv, UFWP, 1);
 }
 
-static bool GetNmodeSupportBySecCfg8190Pci(struct net_device*dev)
+static bool GetNmodeSupportBySecCfg8190Pci(struct ieee80211_device *ieee)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
-       struct ieee80211_device *ieee = priv->ieee80211;
-
        return !(ieee->rtllib_ap_sec_type &&
                 (ieee->rtllib_ap_sec_type(ieee)&(SEC_ALG_WEP|SEC_ALG_TKIP)));
 }
@@ -1758,9 +1739,9 @@ static u8 rtl8192_getSupportedWireleeMode(void)
        return (WIRELESS_MODE_N_24G|WIRELESS_MODE_G|WIRELESS_MODE_B);
 }
 
-static void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode)
+static void rtl8192_SetWirelessMode(struct ieee80211_device *ieee, u8 wireless_mode)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee->dev);
        u8 bSupportMode = rtl8192_getSupportedWireleeMode();
 
        if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode&bSupportMode)==0))
@@ -1800,18 +1781,16 @@ static void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode)
        rtl8192_refresh_supportrate(priv);
 }
 
-static bool GetHalfNmodeSupportByAPs819xPci(struct net_device* dev)
+static bool GetHalfNmodeSupportByAPs819xPci(struct ieee80211_device* ieee)
 {
-       struct r8192_priv* priv = ieee80211_priv(dev);
-       struct ieee80211_device* ieee = priv->ieee80211;
-
        return ieee->bHalfWirelessN24GMode;
 }
 
-static short rtl8192_is_tx_queue_empty(struct net_device *dev)
+static short rtl8192_is_tx_queue_empty(struct ieee80211_device *ieee)
 {
        int i=0;
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee->dev);
+
        for (i=0; i<=MGNT_QUEUE; i++)
        {
                if ((i== TXCMD_QUEUE) || (i == HCCA_QUEUE) )
@@ -1824,15 +1803,14 @@ static short rtl8192_is_tx_queue_empty(struct net_device *dev)
        return 1;
 }
 
-static void rtl8192_hw_sleep_down(struct net_device *dev)
+static void rtl8192_hw_sleep_down(struct r8192_priv *priv)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
        MgntActSet_RF_State(priv, eRfSleep, RF_CHANGE_BY_PS);
 }
 
-static void rtl8192_hw_wakeup(struct net_device* dev)
+static void rtl8192_hw_wakeup(struct ieee80211_device *ieee)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee->dev);
        MgntActSet_RF_State(priv, eRfOn, RF_CHANGE_BY_PS);
 }
 
@@ -1840,16 +1818,15 @@ static void rtl8192_hw_wakeup_wq (struct work_struct *work)
 {
        struct delayed_work *dwork = container_of(work,struct delayed_work,work);
        struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_wakeup_wq);
-       struct net_device *dev = ieee->dev;
-       rtl8192_hw_wakeup(dev);
 
+       rtl8192_hw_wakeup(ieee);
 }
 
 #define MIN_SLEEP_TIME 50
 #define MAX_SLEEP_TIME 10000
-static void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl)
+static void rtl8192_hw_to_sleep(struct ieee80211_device *ieee, u32 th, u32 tl)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee->dev);
        u32 tmp;
        u32 rb = jiffies;
 
@@ -1879,7 +1856,7 @@ static void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl)
        queue_delayed_work(priv->ieee80211->wq,
                           &priv->ieee80211->hw_wakeup_wq,tmp);
 
-        rtl8192_hw_sleep_down(dev);
+        rtl8192_hw_sleep_down(priv);
 }
 
 static void rtl8192_init_priv_variable(struct r8192_priv *priv)
@@ -1939,8 +1916,8 @@ static void rtl8192_init_priv_variable(struct r8192_priv *priv)
        priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
        priv->ieee80211->host_encrypt = 1;
        priv->ieee80211->host_decrypt = 1;
-       priv->ieee80211->start_send_beacons = rtl8192_start_beacon;//+by david 081107
-       priv->ieee80211->stop_send_beacons = rtl8192_stop_beacon;//+by david 081107
+       priv->ieee80211->start_send_beacons = rtl8192_start_beacon;
+       priv->ieee80211->stop_send_beacons = rtl8192_stop_beacon;
        priv->ieee80211->softmac_hard_start_xmit = rtl8192_hard_start_xmit;
        priv->ieee80211->set_chan = rtl8192_set_chan;
        priv->ieee80211->link_change = rtl8192_link_change;
@@ -2312,7 +2289,7 @@ static void rtl8192_read_eeprom_info(struct r8192_priv *priv)
 
        // 2008/01/16 MH We can only know RF type in the function. So we have to init
        // DIG RATR table again.
-       init_rate_adaptive(dev);
+       init_rate_adaptive(priv);
 
        //1 Make a copy for following variables and we can change them if we want
 
@@ -2417,9 +2394,10 @@ static short rtl8192_get_channel_map(struct r8192_priv *priv)
        return 0;
 }
 
-static short rtl8192_init(struct net_device *dev)
+static short rtl8192_init(struct r8192_priv *priv)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct net_device *dev = priv->ieee80211->dev;
+
        memset(&(priv->stats),0,sizeof(struct Stats));
        rtl8192_init_priv_variable(priv);
        rtl8192_init_priv_lock(priv);
@@ -2427,11 +2405,11 @@ static short rtl8192_init(struct net_device *dev)
        rtl8192_get_eeprom_size(priv);
        rtl8192_read_eeprom_info(priv);
        rtl8192_get_channel_map(priv);
-       init_hal_dm(dev);
+       init_hal_dm(priv);
        init_timer(&priv->watch_dog_timer);
-       priv->watch_dog_timer.data = (unsigned long)dev;
+       priv->watch_dog_timer.data = (unsigned long)priv;
        priv->watch_dog_timer.function = watch_dog_timer_callback;
-        if (request_irq(dev->irq, rtl8192_interrupt, IRQF_SHARED, dev->name, dev)) {
+        if (request_irq(dev->irq, rtl8192_interrupt, IRQF_SHARED, dev->name, priv)) {
                printk("Error allocating IRQ %d",dev->irq);
                return -1;
        }else{
@@ -2671,7 +2649,7 @@ static RT_STATUS rtl8192_adapter_start(struct r8192_priv *priv)
        write_nic_byte(priv, ACK_TIMEOUT, 0x30);
 
        if(priv->ResetProgress == RESET_TYPE_NORESET)
-       rtl8192_SetWirelessMode(dev, priv->ieee80211->mode);
+       rtl8192_SetWirelessMode(priv->ieee80211, priv->ieee80211->mode);
        //-----------------------------------------------------------------------------
        // Set up security related. 070106, by rcnjko:
        // 1. Clear all H/W keys.
@@ -2732,7 +2710,7 @@ static RT_STATUS rtl8192_adapter_start(struct r8192_priv *priv)
 
        //Firmware download
        RT_TRACE(COMP_INIT, "Load Firmware!\n");
-       bfirmwareok = init_firmware(dev);
+       bfirmwareok = init_firmware(priv);
        if(bfirmwareok != true) {
                rtStatus = RT_STATUS_FAILURE;
                return rtStatus;
@@ -2864,9 +2842,9 @@ static void rtl8192_prepare_beacon(unsigned long arg)
  * rtl8192_beacon_tx_enable(). rtl8192_beacon_tx_disable() might
  * be used to stop beacon transmission
  */
-static void rtl8192_start_beacon(struct net_device *dev)
+static void rtl8192_start_beacon(struct ieee80211_device *ieee80211)
 {
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
        struct ieee80211_network *net = &priv->ieee80211->current_network;
        u16 BcnTimeCfg = 0;
         u16 BcnCW = 6;
@@ -2982,38 +2960,31 @@ static RESET_TYPE RxCheckStuck(struct r8192_priv *priv)
        return RESET_TYPE_NORESET;
 }
 
-static RESET_TYPE
-rtl819x_ifcheck_resetornot(struct r8192_priv *priv)
+static RESET_TYPE rtl819x_check_reset(struct r8192_priv *priv)
 {
-       RESET_TYPE      TxResetType = RESET_TYPE_NORESET;
-       RESET_TYPE      RxResetType = RESET_TYPE_NORESET;
-       RT_RF_POWER_STATE       rfState;
+       RESET_TYPE RxResetType = RESET_TYPE_NORESET;
+       RT_RF_POWER_STATE rfState;
 
        rfState = priv->eRFPowerState;
 
-       if( rfState != eRfOff &&
-               /*ADAPTER_TEST_STATUS_FLAG(Adapter, ADAPTER_STATUS_FW_DOWNLOAD_FAILURE)) &&*/
-               (priv->ieee80211->iw_mode != IW_MODE_ADHOC))
-       {
-               // If driver is in the status of firmware download failure , driver skips RF initialization and RF is
-               // in turned off state. Driver should check whether Rx stuck and do silent reset. And
-               // if driver is in firmware download failure status, driver should initialize RF in the following
-               // silent reset procedure Emily, 2008.01.21
-
-               // Driver should not check RX stuck in IBSS mode because it is required to
-               // set Check BSSID in order to send beacon, however, if check BSSID is
-               // set, STA cannot hear any packet a all. Emily, 2008.04.12
+       if (rfState != eRfOff && (priv->ieee80211->iw_mode != IW_MODE_ADHOC)) {
+               /*
+                * If driver is in the status of firmware download failure,
+                * driver skips RF initialization and RF is in turned off state.
+                * Driver should check whether Rx stuck and do silent reset. And
+                * if driver is in firmware download failure status, driver
+                * should initialize RF in the following silent reset procedure
+                *
+                * Driver should not check RX stuck in IBSS mode because it is
+                * required to set Check BSSID in order to send beacon, however,
+                * if check BSSID is set, STA cannot hear any packet a all.
+                */
                RxResetType = RxCheckStuck(priv);
        }
 
-       RT_TRACE(COMP_RESET,"%s(): TxResetType is %d, RxResetType is %d\n",__FUNCTION__,TxResetType,RxResetType);
-       if(TxResetType==RESET_TYPE_NORMAL || RxResetType==RESET_TYPE_NORMAL)
-               return RESET_TYPE_NORMAL;
-       else if(TxResetType==RESET_TYPE_SILENT || RxResetType==RESET_TYPE_SILENT)
-               return RESET_TYPE_SILENT;
-       else
-               return RESET_TYPE_NORESET;
+       RT_TRACE(COMP_RESET, "%s():  RxResetType is %d\n", __FUNCTION__, RxResetType);
 
+       return RxResetType;
 }
 
 #ifdef ENABLE_IPS
@@ -3047,9 +3018,8 @@ static void InactivePsWorkItemCallback(struct r8192_priv *priv)
 
 #ifdef ENABLE_LPS
 /* Change current and default preamble mode. */
-bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev,   u8 rtPsMode)
+bool MgntActSet_802_11_PowerSaveMode(struct r8192_priv *priv, u8 rtPsMode)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
 
        // Currently, we do not change power save mode on IBSS mode.
        if(priv->ieee80211->iw_mode == IW_MODE_ADHOC)
@@ -3076,7 +3046,7 @@ bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev,      u8 rtPsMode)
        if(priv->ieee80211->sta_sleep != 0 && rtPsMode == IEEE80211_PS_DISABLED)
        {
                // Notify the AP we awke.
-               rtl8192_hw_wakeup(dev);
+               rtl8192_hw_wakeup(priv->ieee80211);
                priv->ieee80211->sta_sleep = 0;
 
                 spin_lock(&priv->ieee80211->mgmt_tx_lock);
@@ -3089,9 +3059,9 @@ bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev,      u8 rtPsMode)
 }
 
 /* Enter the leisure power save mode. */
-void LeisurePSEnter(struct net_device *dev)
+void LeisurePSEnter(struct ieee80211_device *ieee80211)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
        PRT_POWER_SAVE_CONTROL pPSC = &priv->PowerSaveControl;
 
        if(!((priv->ieee80211->iw_mode == IW_MODE_INFRA) &&
@@ -3108,7 +3078,7 @@ void LeisurePSEnter(struct net_device *dev)
 
                        if(priv->ieee80211->ps == IEEE80211_PS_DISABLED)
                        {
-                               MgntActSet_802_11_PowerSaveMode(dev, IEEE80211_PS_MBCAST|IEEE80211_PS_UNICAST);
+                               MgntActSet_802_11_PowerSaveMode(priv, IEEE80211_PS_MBCAST|IEEE80211_PS_UNICAST);
 
                        }
                }
@@ -3119,9 +3089,9 @@ void LeisurePSEnter(struct net_device *dev)
 
 
 /* Leave leisure power save mode. */
-void LeisurePSLeave(struct net_device *dev)
+void LeisurePSLeave(struct ieee80211_device *ieee80211)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
        PRT_POWER_SAVE_CONTROL pPSC = &priv->PowerSaveControl;
 
        if (pPSC->bLeisurePs)
@@ -3129,7 +3099,7 @@ void LeisurePSLeave(struct net_device *dev)
                if(priv->ieee80211->ps != IEEE80211_PS_DISABLED)
                {
                        // move to lps_wakecomplete()
-                       MgntActSet_802_11_PowerSaveMode(dev, IEEE80211_PS_DISABLED);
+                       MgntActSet_802_11_PowerSaveMode(priv, IEEE80211_PS_DISABLED);
 
                }
        }
@@ -3199,9 +3169,9 @@ void IPSLeave_wq(struct work_struct *work)
        up(&priv->ieee80211->ips_sem);
 }
 
-void ieee80211_ips_leave_wq(struct net_device *dev)
+void ieee80211_ips_leave_wq(struct ieee80211_device *ieee80211)
 {
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
        RT_RF_POWER_STATE       rtState;
        rtState = priv->eRFPowerState;
 
@@ -3220,12 +3190,12 @@ void ieee80211_ips_leave_wq(struct net_device *dev)
        }
 }
 //added by amy 090331 end
-void ieee80211_ips_leave(struct net_device *dev)
+void ieee80211_ips_leave(struct ieee80211_device *ieee80211)
 {
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-       down(&priv->ieee80211->ips_sem);
+       struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
+       down(&ieee80211->ips_sem);
        IPSLeave(priv);
-       up(&priv->ieee80211->ips_sem);
+       up(&ieee80211->ips_sem);
 }
 #endif
 
@@ -3255,7 +3225,6 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
 {
        struct delayed_work *dwork = container_of(work,struct delayed_work,work);
        struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq);
-       struct net_device *dev = priv->ieee80211->dev;
        struct ieee80211_device* ieee = priv->ieee80211;
        RESET_TYPE      ResetType = RESET_TYPE_NORESET;
        bool bBusyTraffic = false;
@@ -3266,7 +3235,7 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
 
        if(!priv->up)
                return;
-       hal_dm_watchdog(dev);
+       hal_dm_watchdog(priv);
 #ifdef ENABLE_IPS
        if(ieee->actscanning == false){
                if((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == IEEE80211_NOLINK) &&
@@ -3301,11 +3270,11 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
                        // LeisurePS only work in infra mode.
                        if(bEnterPS)
                        {
-                               LeisurePSEnter(dev);
+                               LeisurePSEnter(priv->ieee80211);
                        }
                        else
                        {
-                               LeisurePSLeave(dev);
+                               LeisurePSLeave(priv->ieee80211);
                        }
 #endif
 
@@ -3313,7 +3282,7 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
                else
                {
 #ifdef ENABLE_LPS
-                       LeisurePSLeave(dev);
+                       LeisurePSLeave(priv->ieee80211);
 #endif
                }
 
@@ -3342,7 +3311,7 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
                                RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid);
                                ieee->is_roaming = true;
                                ieee->is_set_key = false;
-                               ieee->link_change(dev);
+                               ieee->link_change(ieee);
                                queue_work(ieee->wq, &ieee->associate_procedure_wq);
                        }
                }
@@ -3353,7 +3322,7 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
        if (priv->watchdog_check_reset_cnt++ >= 3 && !ieee->is_roaming && 
            priv->watchdog_last_time != 1)
        {
-               ResetType = rtl819x_ifcheck_resetornot(priv);
+               ResetType = rtl819x_check_reset(priv);
                priv->watchdog_check_reset_cnt = 3;
        }
        if(!priv->bDisableNormalResetCheck && ResetType == RESET_TYPE_NORMAL)
@@ -3380,7 +3349,7 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
 
 void watch_dog_timer_callback(unsigned long data)
 {
-       struct r8192_priv *priv = ieee80211_priv((struct net_device *) data);
+       struct r8192_priv *priv = (struct r8192_priv *) data;
        queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq,0);
        mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME));
 
@@ -3410,7 +3379,7 @@ static int _rtl8192_up(struct r8192_priv *priv)
        if(priv->ieee80211->state != IEEE80211_LINKED)
        ieee80211_softmac_start_protocol(priv->ieee80211);
        ieee80211_reset_queue(priv->ieee80211);
-       watch_dog_timer_callback((unsigned long) dev);
+       watch_dog_timer_callback((unsigned long) priv);
        if(!netif_queue_stopped(dev))
                netif_start_queue(dev);
        else
@@ -3467,7 +3436,7 @@ int rtl8192_down(struct net_device *dev)
 #ifdef ENABLE_LPS
        //LZM for PS-Poll AID issue. 090429
        if(priv->ieee80211->state == IEEE80211_LINKED)
-               LeisurePSLeave(dev);
+               LeisurePSLeave(priv->ieee80211);
 #endif
 
        priv->up=0;
@@ -3479,7 +3448,7 @@ int rtl8192_down(struct net_device *dev)
 
        rtl8192_irq_disable(priv);
        rtl8192_cancel_deferred_work(priv);
-       deinit_hal_dm(dev);
+       deinit_hal_dm(priv);
        del_timer_sync(&priv->watch_dog_timer);
 
        ieee80211_softmac_stop_protocol(priv->ieee80211,true);
@@ -3542,7 +3511,6 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac)
 static void r8192e_set_hw_key(struct r8192_priv *priv, struct ieee_param *ipw)
 {
        struct ieee80211_device *ieee = priv->ieee80211;
-       struct net_device *dev = priv->ieee80211->dev;
        u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
        u32 key[4];
 
@@ -3567,13 +3535,13 @@ static void r8192e_set_hw_key(struct r8192_priv *priv, struct ieee_param *ipw)
                         * key as in IPW interface, adhoc will only get here,
                         * so we need index entry for its default key serching!
                         */
-                       setKey(dev, 4, ipw->u.crypt.idx,
+                       setKey(priv, 4, ipw->u.crypt.idx,
                               ieee->pairwise_key_type,
                               (u8*)ieee->ap_mac_addr, 0, key);
 
                        /* LEAP WEP will never set this. */
                        if (ieee->auth_mode != 2)
-                               setKey(dev, ipw->u.crypt.idx, ipw->u.crypt.idx,
+                               setKey(priv, ipw->u.crypt.idx, ipw->u.crypt.idx,
                                       ieee->pairwise_key_type,
                                       (u8*)ieee->ap_mac_addr, 0, key);
                }
@@ -3596,7 +3564,7 @@ static void r8192e_set_hw_key(struct r8192_priv *priv, struct ieee_param *ipw)
                        ieee->group_key_type = KEY_TYPE_NA;
 
                if (ieee->group_key_type) {
-                       setKey(dev, ipw->u.crypt.idx, ipw->u.crypt.idx,
+                       setKey(priv, ipw->u.crypt.idx, ipw->u.crypt.idx,
                               ieee->group_key_type, broadcast_addr, 0, key);
                }
        }
@@ -3704,9 +3672,8 @@ static u8 HwRateToMRate90(bool bIsHT, u8 rate)
 }
 
 /* Record the TSF time stamp when receiving a packet */
-static void UpdateRxPktTimeStamp8190 (struct net_device *dev, struct ieee80211_rx_stats *stats)
+static void UpdateRxPktTimeStamp8190(struct r8192_priv *priv, struct ieee80211_rx_stats *stats)
 {
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 
        if(stats->bIsAMPDU && !stats->bFirstMPDU) {
                stats->mac_time[0] = priv->LastRxDescTSFLow;
@@ -3751,8 +3718,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv * priv, u8* buffer,struct
        sc = le16_to_cpu(hdr->seq_ctl);
        frag = WLAN_GET_SEQ_FRAG(sc);
        seq = WLAN_GET_SEQ_SEQ(sc);
-       //cosa add 04292008 to record the sequence number
-       pcurrent_stats->Seq_Num = seq;
+
        //
        // Check whether we should take the previous packet into accounting
        //
@@ -4257,7 +4223,6 @@ rtl8192_record_rxdesc_forlateruse(
 {
        ptarget_stats->bIsAMPDU = psrc_stats->bIsAMPDU;
        ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU;
-       //ptarget_stats->Seq_Num = psrc_stats->Seq_Num;
 }
 
 
@@ -4316,20 +4281,19 @@ static void TranslateRxSignalStuff819xpci(struct r8192_priv *priv,
 }
 
 
-static void rtl8192_tx_resume(struct net_device *dev)
+static void rtl8192_tx_resume(struct r8192_priv *priv)
 {
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
        struct ieee80211_device *ieee = priv->ieee80211;
        struct sk_buff *skb;
-       int queue_index;
+       int i;
 
-       for(queue_index = BK_QUEUE; queue_index < TXCMD_QUEUE;queue_index++) {
-               while((!skb_queue_empty(&ieee->skb_waitQ[queue_index]))&&
-                               (priv->ieee80211->check_nic_enough_desc(dev,queue_index) > 0)) {
+       for (i = BK_QUEUE; i < TXCMD_QUEUE; i++) {
+               while ((!skb_queue_empty(&ieee->skb_waitQ[i])) &&
+                      (priv->ieee80211->check_nic_enough_desc(ieee, i) > 0)) {
                        /* 1. dequeue the packet from the wait queue */
-                       skb = skb_dequeue(&ieee->skb_waitQ[queue_index]);
+                       skb = skb_dequeue(&ieee->skb_waitQ[i]);
                        /* 2. tx the packet directly */
-                       ieee->softmac_data_hard_start_xmit(skb,dev,0/* rate useless now*/);
+                       ieee->softmac_data_hard_start_xmit(skb, ieee, 0);
                }
        }
 }
@@ -4338,7 +4302,6 @@ static void rtl8192_irq_tx_tasklet(unsigned long arg)
 {
        struct r8192_priv *priv = (struct r8192_priv*) arg;
        struct rtl8192_tx_ring *mgnt_ring = &priv->tx_ring[MGNT_QUEUE];
-       struct net_device *dev = priv->ieee80211->dev;
        unsigned long flags;
 
        /* check if we need to report that the management queue is drained */
@@ -4346,14 +4309,14 @@ static void rtl8192_irq_tx_tasklet(unsigned long arg)
 
        if (!skb_queue_len(&mgnt_ring->queue) &&
            priv->ieee80211->ack_tx_to_ieee &&
-           rtl8192_is_tx_queue_empty(dev)) {
+           rtl8192_is_tx_queue_empty(priv->ieee80211)) {
                priv->ieee80211->ack_tx_to_ieee = 0;
                ieee80211_ps_tx_ack(priv->ieee80211, 1);
        }
 
        spin_unlock_irqrestore(&priv->irq_th_lock, flags);
 
-       rtl8192_tx_resume(dev);
+       rtl8192_tx_resume(priv);
 }
 
 /* Record the received data rate */
@@ -4421,9 +4384,8 @@ static void UpdateReceivedRateHistogramStatistics8190(
        priv->stats.received_rate_histogram[rcvType][rateIndex]++;
 }
 
-static void rtl8192_rx(struct net_device *dev)
+static void rtl8192_rx(struct r8192_priv *priv)
 {
-    struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
     struct ieee80211_hdr_1addr *ieee80211_hdr = NULL;
     bool unicast_packet = false;
     struct ieee80211_rx_stats stats = {
@@ -4488,7 +4450,7 @@ static void rtl8192_rx(struct net_device *dev)
                 stats.TimeStampLow = pDrvInfo->TSFL;
                 stats.TimeStampHigh = read_nic_dword(priv, TSFR+4);
 
-                UpdateRxPktTimeStamp8190(dev, &stats);
+                UpdateRxPktTimeStamp8190(priv, &stats);
 
                 //
                 // Get Total offset of MPDU Frame Body
@@ -4496,8 +4458,6 @@ static void rtl8192_rx(struct net_device *dev)
                 if((stats.RxBufShift + stats.RxDrvInfoSize) > 0)
                     stats.bShift = 1;
 
-                stats.RxIs40MHzPacket = pDrvInfo->BW;
-
                 /* ???? */
                 TranslateRxSignalStuff819xpci(priv, skb, &stats, pdesc, pDrvInfo);
 
@@ -4519,11 +4479,6 @@ static void rtl8192_rx(struct net_device *dev)
                     unicast_packet = true;
                 }
 
-                stats.packetlength = stats.Length-4;
-                stats.fraglength = stats.packetlength;
-                stats.fragoffset = 0;
-                stats.ntotalfrag = 1;
-
                 if(!ieee80211_rtl_rx(priv->ieee80211, skb, &stats)){
                     dev_kfree_skb_any(skb);
                 } else {
@@ -4554,7 +4509,7 @@ done:
 static void rtl8192_irq_rx_tasklet(unsigned long arg)
 {
        struct r8192_priv *priv = (struct r8192_priv*) arg;
-       rtl8192_rx(priv->ieee80211->dev);
+       rtl8192_rx(priv);
        /* unmask RDU */
        write_nic_dword(priv, INTA_MASK, read_nic_dword(priv, INTA_MASK) | IMR_RDU);
 }
@@ -4572,7 +4527,6 @@ static const struct net_device_ops rtl8192_netdev_ops = {
 static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
                         const struct pci_device_id *id)
 {
-       unsigned long ioaddr = 0;
        struct net_device *dev = NULL;
        struct r8192_priv *priv= NULL;
        u8 unit = 0;
@@ -4623,16 +4577,15 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
                goto fail;
        }
 
-
-       ioaddr = (unsigned long)ioremap_nocache( pmem_start, pmem_len);
-       if( ioaddr == (unsigned long)NULL ){
+       priv->mem_start = ioremap_nocache(pmem_start, pmem_len);
+       if (!priv->mem_start) {
                RT_TRACE(COMP_ERR,"ioremap failed!\n");
-              // release_mem_region( pmem_start, pmem_len );
                goto fail1;
        }
 
-       dev->mem_start = ioaddr; // shared mem start
-       dev->mem_end = ioaddr + pci_resource_len(pdev, 0); // shared mem end
+       dev->mem_start = (unsigned long) priv->mem_start;
+       dev->mem_end = (unsigned long) (priv->mem_start +
+                                       pci_resource_len(pdev, 0));
 
         /* We disable the RETRY_TIMEOUT register (0x41) to keep
          * PCI Tx retries from interfering with C3 CPU state */
@@ -4659,7 +4612,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
         }
 
        RT_TRACE(COMP_INIT, "Driver probe completed1\n");
-       if(rtl8192_init(dev)!=0){
+       if (rtl8192_init(priv)!=0) {
                RT_TRACE(COMP_ERR, "Initialization failed\n");
                goto fail;
        }
@@ -4674,8 +4627,8 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 
 fail1:
 
-       if( dev->mem_start != (unsigned long)NULL ){
-               iounmap( (void *)dev->mem_start );
+       if (priv->mem_start) {
+               iounmap(priv->mem_start);
                release_mem_region( pci_resource_start(pdev, 1),
                                    pci_resource_len(pdev, 1) );
        }
@@ -4684,8 +4637,8 @@ fail:
        if(dev){
 
                if (priv->irq) {
-                       free_irq(dev->irq, dev);
-                       dev->irq=0;
+                       free_irq(priv->irq, priv);
+                       priv->irq = 0;
                }
                free_ieee80211(dev);
        }
@@ -4746,13 +4699,13 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev)
                        rtl8192_free_tx_ring(priv, i);
 
                if (priv->irq) {
-                       printk("Freeing irq %d\n",dev->irq);
-                       free_irq(dev->irq, dev);
-                       priv->irq=0;
+                       printk("Freeing irq %d\n", priv->irq);
+                       free_irq(priv->irq, priv);
+                       priv->irq = 0;
                }
 
-               if( dev->mem_start != (unsigned long)NULL ){
-                       iounmap( (void *)dev->mem_start );
+               if (priv->mem_start) {
+                       iounmap(priv->mem_start);
                        release_mem_region( pci_resource_start(pdev, 1),
                                            pci_resource_len(pdev, 1) );
                }
@@ -4798,10 +4751,10 @@ static void __exit rtl8192_pci_module_exit(void)
        ieee80211_rtl_exit();
 }
 
-static irqreturn_t rtl8192_interrupt(int irq, void *netdev)
+static irqreturn_t rtl8192_interrupt(int irq, void *param)
 {
-       struct net_device *dev = (struct net_device *) netdev;
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+       struct r8192_priv *priv = param;
+       struct net_device *dev = priv->ieee80211->dev;
        unsigned long flags;
        u32 inta;
        irqreturn_t ret = IRQ_HANDLED;
@@ -4950,21 +4903,16 @@ void EnableHWSecurityConfig8192(struct r8192_priv *priv)
 }
 #define TOTAL_CAM_ENTRY 32
 //#define CAM_CONTENT_COUNT 8
-void setKey(   struct net_device *dev,
-               u8 EntryNo,
-               u8 KeyIndex,
-               u16 KeyType,
-               const u8 *MacAddr,
-               u8 DefaultKey,
-               u32 *KeyContent )
+void setKey(struct r8192_priv *priv, u8 EntryNo, u8 KeyIndex, u16 KeyType,
+           const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent)
 {
        u32 TargetCommand = 0;
        u32 TargetContent = 0;
        u16 usConfig = 0;
        u8 i;
 #ifdef ENABLE_IPS
-       struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
        RT_RF_POWER_STATE       rtState;
+
        rtState = priv->eRFPowerState;
        if (priv->PowerSaveControl.bInactivePs){
                if(rtState == eRfOff){
@@ -4986,7 +4934,7 @@ void setKey(      struct net_device *dev,
        if (EntryNo >= TOTAL_CAM_ENTRY)
                RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n");
 
-       RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d, KeyType:%d, MacAddr%pM\n", dev,EntryNo, KeyIndex, KeyType, MacAddr);
+       RT_TRACE(COMP_SEC, "====>to setKey(), priv:%p, EntryNo:%d, KeyIndex:%d, KeyType:%d, MacAddr%pM\n", priv, EntryNo, KeyIndex, KeyType, MacAddr);
 
        if (DefaultKey)
                usConfig |= BIT15 | (KeyType<<2);