From: Larry Finger Date: Fri, 12 Aug 2011 03:00:11 +0000 (-0500) Subject: staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part XVIII X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8bd890a41f66b4b3f8494a9c91bface5a0b8cbe3;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part XVIII Signed-off-by: Larry Finger --- diff --git a/drivers/staging/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl_pm.c index af1c8201e01d..92e2fde7f5f4 100644 --- a/drivers/staging/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl_pm.c @@ -23,42 +23,38 @@ #include "r8190P_rtl8256.h" #include "rtl_pm.h" -int rtl8192E_save_state (struct pci_dev *dev, pm_message_t state) +int rtl8192E_save_state(struct pci_dev *dev, pm_message_t state) { - printk(KERN_NOTICE "r8192E save state call (state %u).\n", state.event); - return(-EAGAIN); + printk(KERN_NOTICE "r8192E save state call (state %u).\n", state.event); + return -EAGAIN; } -int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state) +int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state) { struct net_device *dev = pci_get_drvdata(pdev); struct r8192_priv *priv = rtllib_priv(dev); u32 ulRegRead; - RT_TRACE(COMP_POWER, "============> r8192E suspend call.\n"); - printk("============> r8192E suspend call.\n"); + printk(KERN_INFO "============> r8192E suspend call.\n"); del_timer_sync(&priv->gpio_polling_timer); cancel_delayed_work(&priv->gpio_change_rf_wq); priv->polling_timer_on = 0; - if (!netif_running(dev)){ - printk("RTL819XE:UI is open out of suspend function\n"); - goto out_pci_suspend; - } + if (!netif_running(dev)) { + printk(KERN_INFO "RTL819XE:UI is open out of suspend " + "function\n"); + goto out_pci_suspend; + } -#ifdef HAVE_NET_DEVICE_OPS if (dev->netdev_ops->ndo_stop) dev->netdev_ops->ndo_stop(dev); -#else - dev->stop(dev); -#endif netif_device_detach(dev); if (!priv->rtllib->bSupportRemoteWakeUp) { - MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT,true); + MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT, true); ulRegRead = read_nic_dword(dev, CPU_GEN); - ulRegRead|=CPU_GEN_SYSTEM_RESET; + ulRegRead |= CPU_GEN_SYSTEM_RESET; write_nic_dword(dev, CPU_GEN, ulRegRead); } else { write_nic_dword(dev, WFCRC0, 0xffffffff); @@ -68,81 +64,73 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state) write_nic_byte(dev, MacBlkCtrl, 0xa); } out_pci_suspend: - RT_TRACE(COMP_POWER, "r8192E support WOL call??????????????????????\n"); printk("r8192E support WOL call??????????????????????\n"); - if (priv->rtllib->bSupportRemoteWakeUp) { - RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n"); - } + if (priv->rtllib->bSupportRemoteWakeUp) + RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!" + "!!!!!!!!!!!.\n"); pci_save_state(pdev); pci_disable_device(pdev); - pci_enable_wake(pdev, pci_choose_state(pdev,state),\ - priv->rtllib->bSupportRemoteWakeUp?1:0); - pci_set_power_state(pdev,pci_choose_state(pdev,state)); + pci_enable_wake(pdev, pci_choose_state(pdev, state), + priv->rtllib->bSupportRemoteWakeUp ? 1 : 0); + pci_set_power_state(pdev, pci_choose_state(pdev, state)); - mdelay(20); + mdelay(20); return 0; } -int rtl8192E_resume (struct pci_dev *pdev) +int rtl8192E_resume(struct pci_dev *pdev) { - struct net_device *dev = pci_get_drvdata(pdev); - struct r8192_priv *priv = rtllib_priv(dev); - int err; - u32 val; - - RT_TRACE(COMP_POWER, "================>r8192E resume call."); - printk("================>r8192E resume call.\n"); - - pci_set_power_state(pdev, PCI_D0); - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", - dev->name); - return err; - } - pci_restore_state(pdev); - - pci_read_config_dword(pdev, 0x40, &val); - if ((val & 0x0000ff00) != 0) { - pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); - } - - pci_enable_wake(pdev, PCI_D0, 0); - - if (priv->polling_timer_on == 0){ - check_rfctrl_gpio_timer((unsigned long)dev); - } - - if (!netif_running(dev)){ - printk("RTL819XE:UI is open out of resume function\n"); - goto out; - } - - netif_device_attach(dev); -#ifdef HAVE_NET_DEVICE_OPS - if (dev->netdev_ops->ndo_open) - dev->netdev_ops->ndo_open(dev); -#else - dev->open(dev); -#endif + struct net_device *dev = pci_get_drvdata(pdev); + struct r8192_priv *priv = rtllib_priv(dev); + int err; + u32 val; + + printk(KERN_INFO "================>r8192E resume call.\n"); - if (!priv->rtllib->bSupportRemoteWakeUp) { - MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT,true); - } + pci_set_power_state(pdev, PCI_D0); + + err = pci_enable_device(pdev); + if (err) { + printk(KERN_ERR "%s: pci_enable_device failed on resume\n", + dev->name); + return err; + } + pci_restore_state(pdev); + + pci_read_config_dword(pdev, 0x40, &val); + if ((val & 0x0000ff00) != 0) + pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); + + pci_enable_wake(pdev, PCI_D0, 0); + + if (priv->polling_timer_on == 0) + check_rfctrl_gpio_timer((unsigned long)dev); + + if (!netif_running(dev)) { + printk(KERN_INFO "RTL819XE:UI is open out of resume " + "function\n"); + goto out; + } + + netif_device_attach(dev); + if (dev->netdev_ops->ndo_open) + dev->netdev_ops->ndo_open(dev); + + if (!priv->rtllib->bSupportRemoteWakeUp) + MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT, true); out: - RT_TRACE(COMP_POWER, "<================r8192E resume call.\n"); - return 0; + RT_TRACE(COMP_POWER, "<================r8192E resume call.\n"); + return 0; } -int rtl8192E_enable_wake (struct pci_dev *dev, pm_message_t state, int enable) +int rtl8192E_enable_wake(struct pci_dev *dev, pm_message_t state, int enable) { - printk(KERN_NOTICE "r8192E enable wake call (state %u, enable %d).\n", + printk(KERN_NOTICE "r8192E enable wake call (state %u, enable %d).\n", state.event, enable); - return(-EAGAIN); + return -EAGAIN; } #endif diff --git a/drivers/staging/rtl8192e/rtl_pm.h b/drivers/staging/rtl8192e/rtl_pm.h index 22df29081817..4d7f4067cc78 100644 --- a/drivers/staging/rtl8192e/rtl_pm.h +++ b/drivers/staging/rtl8192e/rtl_pm.h @@ -25,10 +25,10 @@ #include #include -int rtl8192E_save_state (struct pci_dev *dev, pm_message_t state); -int rtl8192E_suspend (struct pci_dev *dev, pm_message_t state); -int rtl8192E_resume (struct pci_dev *dev); -int rtl8192E_enable_wake (struct pci_dev *dev, pm_message_t state, int enable); +int rtl8192E_save_state(struct pci_dev *dev, pm_message_t state); +int rtl8192E_suspend(struct pci_dev *dev, pm_message_t state); +int rtl8192E_resume(struct pci_dev *dev); +int rtl8192E_enable_wake(struct pci_dev *dev, pm_message_t state, int enable); #endif diff --git a/drivers/staging/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl_ps.c index ea9eac712530..f39f0d340e2d 100644 --- a/drivers/staging/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl_ps.c @@ -33,44 +33,49 @@ void rtl8192_hw_sleep_down(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); unsigned long flags = 0; - spin_lock_irqsave(&priv->rf_ps_lock,flags); + spin_lock_irqsave(&priv->rf_ps_lock, flags); if (priv->RFChangeInProgress) { - spin_unlock_irqrestore(&priv->rf_ps_lock,flags); - RT_TRACE(COMP_DBG, "rtl8192_hw_sleep_down(): RF Change in progress! \n"); + spin_unlock_irqrestore(&priv->rf_ps_lock, flags); + RT_TRACE(COMP_DBG, "rtl8192_hw_sleep_down(): RF Change in " + "progress!\n"); return; } - spin_unlock_irqrestore(&priv->rf_ps_lock,flags); + spin_unlock_irqrestore(&priv->rf_ps_lock, flags); RT_TRACE(COMP_DBG, "%s()============>come to sleep down\n", __func__); - MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS,false); + MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS, false); } void rtl8192_hw_sleep_wq(void *data) { - struct rtllib_device *ieee = container_of_dwork_rsl(data,struct rtllib_device,hw_sleep_wq); + struct rtllib_device *ieee = container_of_dwork_rsl(data, + struct rtllib_device, hw_sleep_wq); struct net_device *dev = ieee->dev; - rtl8192_hw_sleep_down(dev); + rtl8192_hw_sleep_down(dev); } -void rtl8192_hw_wakeup(struct net_device* dev) +void rtl8192_hw_wakeup(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); unsigned long flags = 0; - spin_lock_irqsave(&priv->rf_ps_lock,flags); + spin_lock_irqsave(&priv->rf_ps_lock, flags); if (priv->RFChangeInProgress) { - spin_unlock_irqrestore(&priv->rf_ps_lock,flags); - RT_TRACE(COMP_DBG, "rtl8192_hw_wakeup(): RF Change in progress! \n"); - queue_delayed_work_rsl(priv->rtllib->wq,&priv->rtllib->hw_wakeup_wq,MSECS(10)); + spin_unlock_irqrestore(&priv->rf_ps_lock, flags); + RT_TRACE(COMP_DBG, "rtl8192_hw_wakeup(): RF Change in " + "progress!\n"); + queue_delayed_work_rsl(priv->rtllib->wq, + &priv->rtllib->hw_wakeup_wq, MSECS(10)); return; } - spin_unlock_irqrestore(&priv->rf_ps_lock,flags); + spin_unlock_irqrestore(&priv->rf_ps_lock, flags); RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __func__); - MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS,false); + MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS, false); } void rtl8192_hw_wakeup_wq(void *data) { - struct rtllib_device *ieee = container_of_dwork_rsl(data,struct rtllib_device,hw_wakeup_wq); + struct rtllib_device *ieee = container_of_dwork_rsl(data, + struct rtllib_device, hw_wakeup_wq); struct net_device *dev = ieee->dev; rtl8192_hw_wakeup(dev); @@ -85,12 +90,12 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) u32 tmp; unsigned long flags; - spin_lock_irqsave(&priv->ps_lock,flags); + spin_lock_irqsave(&priv->ps_lock, flags); time -= MSECS(8+16+7); if ((time - jiffies) <= MSECS(MIN_SLEEP_TIME)) { - spin_unlock_irqrestore(&priv->ps_lock,flags); + spin_unlock_irqrestore(&priv->ps_lock, flags); printk(KERN_INFO "too short to sleep::%lld < %ld\n", time - jiffies, MSECS(MIN_SLEEP_TIME)); return; @@ -99,48 +104,48 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) if ((time - jiffies) > MSECS(MAX_SLEEP_TIME)) { printk(KERN_INFO "========>too long to sleep:%lld > %ld\n", time - jiffies, MSECS(MAX_SLEEP_TIME)); - spin_unlock_irqrestore(&priv->ps_lock,flags); + spin_unlock_irqrestore(&priv->ps_lock, flags); return; } tmp = time - jiffies; queue_delayed_work_rsl(priv->rtllib->wq, - &priv->rtllib->hw_wakeup_wq,tmp); + &priv->rtllib->hw_wakeup_wq, tmp); queue_delayed_work_rsl(priv->rtllib->wq, - (void *)&priv->rtllib->hw_sleep_wq,0); - spin_unlock_irqrestore(&priv->ps_lock,flags); + (void *)&priv->rtllib->hw_sleep_wq, 0); + spin_unlock_irqrestore(&priv->ps_lock, flags); } void InactivePsWorkItemCallback(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + &(priv->rtllib->PowerSaveControl); - RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() ---------> \n"); + RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() --------->\n"); pPSC->bSwRfProcessing = true; - RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n", \ - pPSC->eInactivePowerState == eRfOff?"OFF":"ON"); - MgntActSet_RF_State(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS,false); + RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n", + pPSC->eInactivePowerState == eRfOff ? "OFF" : "ON"); + MgntActSet_RF_State(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS, + false); pPSC->bSwRfProcessing = false; - RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <--------- \n"); + RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <---------\n"); } -void -IPSEnter(struct net_device *dev) +void IPSEnter(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + &(priv->rtllib->PowerSaveControl); enum rt_rf_power_state rtState; - if (pPSC->bInactivePs) - { + if (pPSC->bInactivePs) { rtState = priv->rtllib->eRFPowerState; - if (rtState == eRfOn && !pPSC->bSwRfProcessing &&\ - (priv->rtllib->state != RTLLIB_LINKED)&&\ - (priv->rtllib->iw_mode != IW_MODE_MASTER)) - { - RT_TRACE(COMP_PS,"IPSEnter(): Turn off RF.\n"); + if (rtState == eRfOn && !pPSC->bSwRfProcessing && + (priv->rtllib->state != RTLLIB_LINKED) && + (priv->rtllib->iw_mode != IW_MODE_MASTER)) { + RT_TRACE(COMP_PS, "IPSEnter(): Turn off RF.\n"); pPSC->eInactivePowerState = eRfOff; priv->isRFOff = true; priv->bInPowerSaveMode = true; @@ -149,18 +154,17 @@ IPSEnter(struct net_device *dev) } } -void -IPSLeave(struct net_device *dev) +void IPSLeave(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + &(priv->rtllib->PowerSaveControl); enum rt_rf_power_state rtState; - if (pPSC->bInactivePs) - { + if (pPSC->bInactivePs) { rtState = priv->rtllib->eRFPowerState; - if (rtState != eRfOn && !pPSC->bSwRfProcessing && priv->rtllib->RfOffReason <= RF_CHANGE_BY_IPS) - { + if (rtState != eRfOn && !pPSC->bSwRfProcessing && + priv->rtllib->RfOffReason <= RF_CHANGE_BY_IPS) { RT_TRACE(COMP_PS, "IPSLeave(): Turn on RF.\n"); pPSC->eInactivePowerState = eRfOn; priv->bInPowerSaveMode = false; @@ -168,9 +172,11 @@ IPSLeave(struct net_device *dev) } } } + void IPSLeave_wq(void *data) { - struct rtllib_device *ieee = container_of_work_rsl(data,struct rtllib_device,ips_leave_wq); + struct rtllib_device *ieee = container_of_work_rsl(data, + struct rtllib_device, ips_leave_wq); struct net_device *dev = ieee->dev; struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); down(&priv->rtllib->ips_sem); @@ -184,20 +190,22 @@ void rtllib_ips_leave_wq(struct net_device *dev) enum rt_rf_power_state rtState; rtState = priv->rtllib->eRFPowerState; - if (priv->rtllib->PowerSaveControl.bInactivePs){ - if (rtState == eRfOff){ - if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) - { - RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__func__); + if (priv->rtllib->PowerSaveControl.bInactivePs) { + if (rtState == eRfOff) { + if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) { + RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", + __func__); return; - } - else{ - printk("=========>%s(): IPSLeave\n",__func__); - queue_work_rsl(priv->rtllib->wq,&priv->rtllib->ips_leave_wq); + } else { + printk(KERN_INFO "=========>%s(): IPSLeave\n", + __func__); + queue_work_rsl(priv->rtllib->wq, + &priv->rtllib->ips_leave_wq); } } } } + void rtllib_ips_leave(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); @@ -213,38 +221,42 @@ bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, u8 rtPsMode) if (priv->rtllib->iw_mode == IW_MODE_ADHOC) return false; - RT_TRACE(COMP_LPS,"%s(): set ieee->ps = %x\n",__func__,rtPsMode); - if (!priv->ps_force) { + RT_TRACE(COMP_LPS, "%s(): set ieee->ps = %x\n", __func__, rtPsMode); + if (!priv->ps_force) priv->rtllib->ps = rtPsMode; - } - if (priv->rtllib->sta_sleep != LPS_IS_WAKE && rtPsMode == RTLLIB_PS_DISABLED) { - unsigned long flags; + if (priv->rtllib->sta_sleep != LPS_IS_WAKE && + rtPsMode == RTLLIB_PS_DISABLED) { + unsigned long flags; rtl8192_hw_wakeup(dev); priv->rtllib->sta_sleep = LPS_IS_WAKE; - spin_lock_irqsave(&(priv->rtllib->mgmt_tx_lock), flags); + spin_lock_irqsave(&(priv->rtllib->mgmt_tx_lock), flags); RT_TRACE(COMP_DBG, "LPS leave: notify AP we are awaked" " ++++++++++ SendNullFunctionData\n"); rtllib_sta_ps_send_null_frame(priv->rtllib, 0); - spin_unlock_irqrestore(&(priv->rtllib->mgmt_tx_lock), flags); + spin_unlock_irqrestore(&(priv->rtllib->mgmt_tx_lock), flags); } return true; } - void LeisurePSEnter(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + &(priv->rtllib->PowerSaveControl); RT_TRACE(COMP_PS, "LeisurePSEnter()...\n"); - RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdleCount is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n", - pPSC->bLeisurePs, priv->rtllib->ps,pPSC->LpsIdleCount,RT_CHECK_FOR_HANG_PERIOD); - - if (!((priv->rtllib->iw_mode == IW_MODE_INFRA) && (priv->rtllib->state == RTLLIB_LINKED)) - || (priv->rtllib->iw_mode == IW_MODE_ADHOC) || (priv->rtllib->iw_mode == IW_MODE_MASTER)) + RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdle" + "Count is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n", + pPSC->bLeisurePs, priv->rtllib->ps, pPSC->LpsIdleCount, + RT_CHECK_FOR_HANG_PERIOD); + + if (!((priv->rtllib->iw_mode == IW_MODE_INFRA) && + (priv->rtllib->state == RTLLIB_LINKED)) + || (priv->rtllib->iw_mode == IW_MODE_ADHOC) || + (priv->rtllib->iw_mode == IW_MODE_MASTER)) return; if (pPSC->bLeisurePs) { @@ -252,44 +264,46 @@ void LeisurePSEnter(struct net_device *dev) if (priv->rtllib->ps == RTLLIB_PS_DISABLED) { - RT_TRACE(COMP_LPS, "LeisurePSEnter(): Enter 802.11 power save mode...\n"); + RT_TRACE(COMP_LPS, "LeisurePSEnter(): Enter " + "802.11 power save mode...\n"); if (!pPSC->bFwCtrlLPS) { if (priv->rtllib->SetFwCmdHandler) - priv->rtllib->SetFwCmdHandler(dev, FW_CMD_LPS_ENTER); + priv->rtllib->SetFwCmdHandler( + dev, FW_CMD_LPS_ENTER); } - MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST); + MgntActSet_802_11_PowerSaveMode(dev, + RTLLIB_PS_MBCAST | + RTLLIB_PS_UNICAST); } } else pPSC->LpsIdleCount++; } } - void LeisurePSLeave(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + &(priv->rtllib->PowerSaveControl); RT_TRACE(COMP_PS, "LeisurePSLeave()...\n"); RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d\n", pPSC->bLeisurePs, priv->rtllib->ps); - if (pPSC->bLeisurePs) - { - if (priv->rtllib->ps != RTLLIB_PS_DISABLED) - { - RT_TRACE(COMP_LPS, "LeisurePSLeave(): Busy Traffic , Leave 802.11 power save..\n"); - MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_DISABLED); + if (pPSC->bLeisurePs) { + if (priv->rtllib->ps != RTLLIB_PS_DISABLED) { + RT_TRACE(COMP_LPS, "LeisurePSLeave(): Busy Traffic , " + "Leave 802.11 power save..\n"); + MgntActSet_802_11_PowerSaveMode(dev, + RTLLIB_PS_DISABLED); - if (!pPSC->bFwCtrlLPS) - { + if (!pPSC->bFwCtrlLPS) { if (priv->rtllib->SetFwCmdHandler) - { - priv->rtllib->SetFwCmdHandler(dev, FW_CMD_LPS_LEAVE); - } - } + priv->rtllib->SetFwCmdHandler(dev, + FW_CMD_LPS_LEAVE); + } } } } diff --git a/drivers/staging/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl_ps.h index 453df2cbb3d2..a9c2d799c08f 100644 --- a/drivers/staging/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl_ps.h @@ -36,7 +36,7 @@ void rtl8192_hw_wakeup(struct net_device *dev); void rtl8192_hw_to_sleep(struct net_device *dev, u64 time); void rtllib_ips_leave_wq(struct net_device *dev); void rtllib_ips_leave(struct net_device *dev); -void IPSLeave_wq (void *data); +void IPSLeave_wq(void *data); void IPSEnter(struct net_device *dev); void IPSLeave(struct net_device *dev); diff --git a/drivers/staging/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl_wx.c index bc096c096cf9..f869ce3dbec0 100644 --- a/drivers/staging/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl_wx.c @@ -22,14 +22,14 @@ #include "dot11d.h" #define RATE_COUNT 12 -u32 rtl8192_rates[] = {1000000,2000000,5500000,11000000, - 6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000}; - +u32 rtl8192_rates[] = { + 1000000, 2000000, 5500000, 11000000, 6000000, 9000000, 12000000, + 18000000, 24000000, 36000000, 48000000, 54000000 +}; #ifndef ENETDOWN #define ENETDOWN 1 #endif -extern int hwwep; static int r8192_wx_get_freq(struct net_device *dev, struct iw_request_info *a, @@ -37,16 +37,16 @@ static int r8192_wx_get_freq(struct net_device *dev, { struct r8192_priv *priv = rtllib_priv(dev); - return rtllib_wx_get_freq(priv->rtllib,a,wrqu,b); + return rtllib_wx_get_freq(priv->rtllib, a, wrqu, b); } static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { - struct r8192_priv *priv=rtllib_priv(dev); + struct r8192_priv *priv = rtllib_priv(dev); - return rtllib_wx_get_mode(priv->rtllib,a,wrqu,b); + return rtllib_wx_get_mode(priv->rtllib, a, wrqu, b); } static int r8192_wx_get_rate(struct net_device *dev, @@ -54,7 +54,7 @@ static int r8192_wx_get_rate(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); - return rtllib_wx_get_rate(priv->rtllib,info,wrqu,extra); + return rtllib_wx_get_rate(priv->rtllib, info, wrqu, extra); } @@ -71,7 +71,7 @@ static int r8192_wx_set_rate(struct net_device *dev, down(&priv->wx_sem); - ret = rtllib_wx_set_rate(priv->rtllib,info,wrqu,extra); + ret = rtllib_wx_set_rate(priv->rtllib, info, wrqu, extra); up(&priv->wx_sem); @@ -91,7 +91,7 @@ static int r8192_wx_set_rts(struct net_device *dev, down(&priv->wx_sem); - ret = rtllib_wx_set_rts(priv->rtllib,info,wrqu,extra); + ret = rtllib_wx_set_rts(priv->rtllib, info, wrqu, extra); up(&priv->wx_sem); @@ -103,7 +103,7 @@ static int r8192_wx_get_rts(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); - return rtllib_wx_get_rts(priv->rtllib,info,wrqu,extra); + return rtllib_wx_get_rts(priv->rtllib, info, wrqu, extra); } static int r8192_wx_set_power(struct net_device *dev, @@ -113,13 +113,14 @@ static int r8192_wx_set_power(struct net_device *dev, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->bHwRadioOff == true){ - RT_TRACE(COMP_ERR,"%s():Hw is Radio Off, we can't set Power,return\n",__func__); + if (priv->bHwRadioOff == true) { + RT_TRACE(COMP_ERR, "%s():Hw is Radio Off, we can't set " + "Power,return\n", __func__); return 0; } down(&priv->wx_sem); - ret = rtllib_wx_set_power(priv->rtllib,info,wrqu,extra); + ret = rtllib_wx_set_power(priv->rtllib, info, wrqu, extra); up(&priv->wx_sem); @@ -131,12 +132,12 @@ static int r8192_wx_get_power(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); - return rtllib_wx_get_power(priv->rtllib,info,wrqu,extra); + return rtllib_wx_get_power(priv->rtllib, info, wrqu, extra); } static int r8192_wx_set_rawtx(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); int ret; @@ -162,7 +163,8 @@ static int r8192_wx_force_reset(struct net_device *dev, down(&priv->wx_sem); - RT_TRACE(COMP_DBG, "%s(): force reset ! extra is %d\n", __func__, *extra); + RT_TRACE(COMP_DBG, "%s(): force reset ! extra is %d\n", + __func__, *extra); priv->force_reset = *extra; up(&priv->wx_sem); return 0; @@ -174,11 +176,11 @@ static int r8192_wx_force_mic_error(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_device* ieee = priv->rtllib; + struct rtllib_device *ieee = priv->rtllib; down(&priv->wx_sem); - RT_TRACE(COMP_DBG, "%s(): force mic error ! \n", __func__); + RT_TRACE(COMP_DBG, "%s(): force mic error !\n", __func__); ieee->force_mic_error = true; up(&priv->wx_sem); return 0; @@ -197,8 +199,8 @@ struct adhoc_peers_info { }; int r8192_wx_get_adhoc_peers(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { return 0; } @@ -216,12 +218,14 @@ static int r8192_wx_adapter_power_status(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); - struct rtllib_device* ieee = priv->rtllib; + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + (&(priv->rtllib->PowerSaveControl)); + struct rtllib_device *ieee = priv->rtllib; down(&priv->wx_sem); - RT_TRACE(COMP_POWER, "%s(): %s\n",__func__, (*extra == 6)?"DC power":"AC power"); + RT_TRACE(COMP_POWER, "%s(): %s\n", __func__, (*extra == 6) ? + "DC power" : "AC power"); if (*extra || priv->force_lps) { priv->ps_force = false; pPSC->bLeisurePs = true; @@ -240,40 +244,41 @@ static int r8192_wx_adapter_power_status(struct net_device *dev, } static int r8192se_wx_set_radio(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - struct r8192_priv *priv = rtllib_priv(dev); + struct r8192_priv *priv = rtllib_priv(dev); - down(&priv->wx_sem); + down(&priv->wx_sem); - printk("%s(): set radio ! extra is %d\n",__func__, *extra); - if ((*extra != 0) && (*extra != 1)) - { - RT_TRACE(COMP_ERR, "%s(): set radio an err value,must 0(radio off) or 1(radio on)\n",__func__); - return -1; - } - priv->sw_radio_on = *extra; - up(&priv->wx_sem); - return 0; + printk(KERN_INFO "%s(): set radio ! extra is %d\n", __func__, *extra); + if ((*extra != 0) && (*extra != 1)) { + RT_TRACE(COMP_ERR, "%s(): set radio an err value,must 0(radio " + "off) or 1(radio on)\n", __func__); + return -1; + } + priv->sw_radio_on = *extra; + up(&priv->wx_sem); + return 0; } static int r8192se_wx_set_lps_awake_interval(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - struct r8192_priv *priv = rtllib_priv(dev); - struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); - - down(&priv->wx_sem); + struct r8192_priv *priv = rtllib_priv(dev); + struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *) + (&(priv->rtllib->PowerSaveControl)); - printk("%s(): set lps awake interval ! extra is %d\n",__func__, *extra); + down(&priv->wx_sem); - pPSC->RegMaxLPSAwakeIntvl = *extra; - up(&priv->wx_sem); - return 0; + printk(KERN_INFO "%s(): set lps awake interval ! extra is %d\n", + __func__, *extra); + pPSC->RegMaxLPSAwakeIntvl = *extra; + up(&priv->wx_sem); + return 0; } static int r8192se_wx_set_force_lps(struct net_device *dev, @@ -284,7 +289,8 @@ static int r8192se_wx_set_force_lps(struct net_device *dev, down(&priv->wx_sem); - printk("%s(): force LPS ! extra is %d (1 is open 0 is close)\n",__func__, *extra); + printk(KERN_INFO "%s(): force LPS ! extra is %d (1 is open 0 is " + "close)\n", __func__, *extra); priv->force_lps = *extra; up(&priv->wx_sem); return 0; @@ -292,8 +298,8 @@ static int r8192se_wx_set_force_lps(struct net_device *dev, } static int r8192_wx_set_debugflag(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); u8 c = *extra; @@ -301,12 +307,12 @@ static int r8192_wx_set_debugflag(struct net_device *dev, if (priv->bHwRadioOff == true) return 0; - printk("=====>%s(), *extra:%x, debugflag:%x\n", __func__, *extra, rt_global_debug_component); - if (c > 0) { + printk(KERN_INFO "=====>%s(), *extra:%x, debugflag:%x\n", __func__, + *extra, rt_global_debug_component); + if (c > 0) rt_global_debug_component |= (1<rtllib->eRFPowerState; down(&priv->wx_sem); - if (wrqu->mode == IW_MODE_ADHOC || wrqu->mode == IW_MODE_MONITOR - || ieee->bNetPromiscuousMode ) - { - if (priv->rtllib->PowerSaveControl.bInactivePs){ - if (rtState == eRfOff){ - if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) - { - RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__func__); + if (wrqu->mode == IW_MODE_ADHOC || wrqu->mode == IW_MODE_MONITOR || + ieee->bNetPromiscuousMode) { + if (priv->rtllib->PowerSaveControl.bInactivePs) { + if (rtState == eRfOff) { + if (priv->rtllib->RfOffReason > + RF_CHANGE_BY_IPS) { + RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", + __func__); up(&priv->wx_sem); return -1; } else { - printk("=========>%s(): IPSLeave\n",__func__); + printk(KERN_INFO "=========>%s(): " + "IPSLeave\n", __func__); down(&priv->rtllib->ips_sem); IPSLeave(dev); up(&priv->rtllib->ips_sem); @@ -342,33 +349,32 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, } } } - ret = rtllib_wx_set_mode(priv->rtllib,a,wrqu,b); + ret = rtllib_wx_set_mode(priv->rtllib, a, wrqu, b); up(&priv->wx_sem); return ret; } -struct iw_range_with_scan_capa -{ - /* Informative stuff (to choose between different interface) */ - __u32 throughput; /* To give an idea... */ - /* In theory this value should be the maximum benchmarked - * TCP/IP throughput, because with most of these devices the - * bit rate is meaningless (overhead an co) to estimate how - * fast the connection will go and pick the fastest one. - * I suggest people to play with Netperf or any benchmark... - */ - - /* NWID (or domain id) */ - __u32 min_nwid; /* Minimal NWID we are able to set */ - __u32 max_nwid; /* Maximal NWID we are able to set */ - - /* Old Frequency (backward compat - moved lower ) */ - __u16 old_num_channels; - __u8 old_num_frequency; - - /* Scan capabilities */ - __u8 scan_capa; +struct iw_range_with_scan_capa { + /* Informative stuff (to choose between different interface) */ + __u32 throughput; /* To give an idea... */ + /* In theory this value should be the maximum benchmarked + * TCP/IP throughput, because with most of these devices the + * bit rate is meaningless (overhead an co) to estimate how + * fast the connection will go and pick the fastest one. + * I suggest people to play with Netperf or any benchmark... + */ + + /* NWID (or domain id) */ + __u32 min_nwid; /* Minimal NWID we are able to set */ + __u32 max_nwid; /* Maximal NWID we are able to set */ + + /* Old Frequency (backward compat - moved lower ) */ + __u16 old_num_channels; + __u8 old_num_frequency; + + /* Scan capabilities */ + __u8 scan_capa; }; static int rtl8192_wx_get_range(struct net_device *dev, @@ -386,8 +392,10 @@ static int rtl8192_wx_get_range(struct net_device *dev, /* ~130 Mb/s real (802.11n) */ range->throughput = 130 * 1000 * 1000; - if (priv->rf_set_sens != NULL) - range->sensitivity = priv->max_sens; /* signal level threshold range */ + if (priv->rf_set_sens != NULL) { + /* signal level threshold range */ + range->sensitivity = priv->max_sens; + } range->max_qual.qual = 100; range->max_qual.level = 0; @@ -401,9 +409,8 @@ static int rtl8192_wx_get_range(struct net_device *dev, range->num_bitrates = min(RATE_COUNT, IW_MAX_BITRATES); - for (i = 0; i < range->num_bitrates; i++) { + for (i = 0; i < range->num_bitrates; i++) range->bitrate[i] = rtl8192_rates[i]; - } range->max_rts = DEFAULT_RTS_THRESHOLD; range->min_frag = MIN_FRAG_THRESHOLD; @@ -421,15 +428,15 @@ static int rtl8192_wx_get_range(struct net_device *dev, for (i = 0, val = 0; i < 14; i++) { if ((priv->rtllib->active_channel_map)[i+1]) { - range->freq[val].i = i + 1; - range->freq[val].m = rtllib_wlan_frequencies[i] * 100000; + range->freq[val].i = i + 1; + range->freq[val].m = rtllib_wlan_frequencies[i] * + 100000; range->freq[val].e = 1; val++; - } else { } if (val == IW_MAX_FREQUENCIES) - break; + break; } range->num_frequency = val; range->num_channels = val; @@ -437,7 +444,7 @@ static int rtl8192_wx_get_range(struct net_device *dev, IW_ENC_CAPA_CIPHER_TKIP|IW_ENC_CAPA_CIPHER_CCMP; range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE; - /* Event capability (kernel + driver) */ + /* Event capability (kernel + driver) */ return 0; } @@ -446,35 +453,36 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_device* ieee = priv->rtllib; + struct rtllib_device *ieee = priv->rtllib; enum rt_rf_power_state rtState; int ret; - if (!(ieee->softmac_features & IEEE_SOFTMAC_SCAN)){ - if ((ieee->state >= RTLLIB_ASSOCIATING) && (ieee->state <= RTLLIB_ASSOCIATING_AUTHENTICATED)){ + if (!(ieee->softmac_features & IEEE_SOFTMAC_SCAN)) { + if ((ieee->state >= RTLLIB_ASSOCIATING) && + (ieee->state <= RTLLIB_ASSOCIATING_AUTHENTICATED)) return 0; - } - if ((priv->rtllib->state == RTLLIB_LINKED) && (priv->rtllib->CntAfterLink<2)){ + if ((priv->rtllib->state == RTLLIB_LINKED) && + (priv->rtllib->CntAfterLink < 2)) return 0; - } } - if (priv->bHwRadioOff == true){ - printk("================>%s(): hwradio off\n",__func__); + if (priv->bHwRadioOff == true) { + printk(KERN_INFO "================>%s(): hwradio off\n", + __func__); return 0; } rtState = priv->rtllib->eRFPowerState; - if (!priv->up) return -ENETDOWN; + if (!priv->up) + return -ENETDOWN; if (priv->rtllib->LinkDetectInfo.bBusyTraffic == true) return -EAGAIN; - if (wrqu->data.flags & IW_SCAN_THIS_ESSID) - { - struct iw_scan_req* req = (struct iw_scan_req*)b; - if (req->essid_len) - { + if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { + struct iw_scan_req *req = (struct iw_scan_req *)b; + if (req->essid_len) { ieee->current_network.ssid_len = req->essid_len; - memcpy(ieee->current_network.ssid, req->essid, req->essid_len); + memcpy(ieee->current_network.ssid, req->essid, + req->essid_len); } } @@ -482,15 +490,18 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, priv->rtllib->FirstIe_InScan = true; - if (priv->rtllib->state != RTLLIB_LINKED){ - if (priv->rtllib->PowerSaveControl.bInactivePs){ - if (rtState == eRfOff){ - if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS){ - RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__func__); + if (priv->rtllib->state != RTLLIB_LINKED) { + if (priv->rtllib->PowerSaveControl.bInactivePs) { + if (rtState == eRfOff) { + if (priv->rtllib->RfOffReason > + RF_CHANGE_BY_IPS) { + RT_TRACE(COMP_ERR, "%s(): RF is " + "OFF.\n", __func__); up(&priv->wx_sem); return -1; - }else{ - RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n",__func__); + } else { + RT_TRACE(COMP_PS, "=========>%s(): " + "IPSLeave\n", __func__); down(&priv->rtllib->ips_sem); IPSLeave(dev); up(&priv->rtllib->ips_sem); @@ -499,23 +510,26 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, } rtllib_stop_scan(priv->rtllib); if (priv->rtllib->LedControlHandler) - priv->rtllib->LedControlHandler(dev, LED_CTL_SITE_SURVEY); + priv->rtllib->LedControlHandler(dev, + LED_CTL_SITE_SURVEY); - if (priv->rtllib->eRFPowerState != eRfOff){ + if (priv->rtllib->eRFPowerState != eRfOff) { priv->rtllib->actscanning = true; if (ieee->ScanOperationBackupHandler) - ieee->ScanOperationBackupHandler(ieee->dev,SCAN_OPT_BACKUP); + ieee->ScanOperationBackupHandler(ieee->dev, + SCAN_OPT_BACKUP); rtllib_start_scan_syncro(priv->rtllib, 0); if (ieee->ScanOperationBackupHandler) - ieee->ScanOperationBackupHandler(ieee->dev,SCAN_OPT_RESTORE); - } + ieee->ScanOperationBackupHandler(ieee->dev, + SCAN_OPT_RESTORE); + } ret = 0; } else { priv->rtllib->actscanning = true; - ret = rtllib_wx_set_scan(priv->rtllib,a,wrqu,b); + ret = rtllib_wx_set_scan(priv->rtllib, a, wrqu, b); } up(&priv->wx_sem); @@ -530,7 +544,8 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a, int ret; struct r8192_priv *priv = rtllib_priv(dev); - if (!priv->up) return -ENETDOWN; + if (!priv->up) + return -ENETDOWN; if (priv->bHwRadioOff == true) return 0; @@ -538,7 +553,7 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a, down(&priv->wx_sem); - ret = rtllib_wx_get_scan(priv->rtllib,a,wrqu,b); + ret = rtllib_wx_get_scan(priv->rtllib, a, wrqu, b); up(&priv->wx_sem); @@ -552,15 +567,17 @@ static int r8192_wx_set_essid(struct net_device *dev, struct r8192_priv *priv = rtllib_priv(dev); int ret; - if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){ - ; + if ((rtllib_act_scanning(priv->rtllib, false)) && + !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) { + ; /* TODO - get rid of if */ } - if (priv->bHwRadioOff == true){ - printk("=========>%s():hw radio off,or Rf state is eRfOff, return\n",__func__); + if (priv->bHwRadioOff == true) { + printk(KERN_INFO "=========>%s():hw radio off,or Rf state is " + "eRfOff, return\n", __func__); return 0; } down(&priv->wx_sem); - ret = rtllib_wx_set_essid(priv->rtllib,a,wrqu,b); + ret = rtllib_wx_set_essid(priv->rtllib, a, wrqu, b); up(&priv->wx_sem); @@ -682,12 +699,12 @@ static int r8192_wx_set_wap(struct net_device *dev, union iwreq_data *awrq, char *extra) { - int ret; struct r8192_priv *priv = rtllib_priv(dev); - if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){ - ; + if ((rtllib_act_scanning(priv->rtllib, false)) && + !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) { + ; /* TODO - get rid of if */ } if (priv->bHwRadioOff == true) @@ -695,7 +712,7 @@ static int r8192_wx_set_wap(struct net_device *dev, down(&priv->wx_sem); - ret = rtllib_wx_set_wap(priv->rtllib,info,awrq,extra); + ret = rtllib_wx_set_wap(priv->rtllib, info, awrq, extra); up(&priv->wx_sem); @@ -710,7 +727,7 @@ static int r8192_wx_get_wap(struct net_device *dev, { struct r8192_priv *priv = rtllib_priv(dev); - return rtllib_wx_get_wap(priv->rtllib,info,wrqu,extra); + return rtllib_wx_get_wap(priv->rtllib, info, wrqu, extra); } @@ -731,87 +748,91 @@ static int r8192_wx_set_enc(struct net_device *dev, int ret; struct rtllib_device *ieee = priv->rtllib; - u32 hwkey[4]={0,0,0,0}; - u8 mask=0xff; - u32 key_idx=0; - u8 zero_addr[4][6] ={ {0x00,0x00,0x00,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x01}, - {0x00,0x00,0x00,0x00,0x00,0x02}, - {0x00,0x00,0x00,0x00,0x00,0x03} }; + u32 hwkey[4] = {0, 0, 0, 0}; + u8 mask = 0xff; + u32 key_idx = 0; + u8 zero_addr[4][6] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} }; int i; - if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){ - ; - } + if ((rtllib_act_scanning(priv->rtllib, false)) && + !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) + ; /* TODO - get rid of if */ if (priv->bHwRadioOff == true) return 0; - if (!priv->up) return -ENETDOWN; + if (!priv->up) + return -ENETDOWN; - priv->rtllib->wx_set_enc = 1; - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); + priv->rtllib->wx_set_enc = 1; + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); down(&priv->wx_sem); RT_TRACE(COMP_SEC, "Setting SW wep key"); - ret = rtllib_wx_set_encode(priv->rtllib,info,wrqu,key); + ret = rtllib_wx_set_encode(priv->rtllib, info, wrqu, key); up(&priv->wx_sem); if (wrqu->encoding.flags & IW_ENCODE_DISABLED) { ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA; CamResetAllEntry(dev); - memset(priv->rtllib->swcamtable,0,sizeof(struct sw_cam_table)*32); + memset(priv->rtllib->swcamtable, 0, + sizeof(struct sw_cam_table) * 32); goto end_hw_sec; } - if (wrqu->encoding.length!=0){ + if (wrqu->encoding.length != 0) { - for (i=0 ; i<4 ; i++){ + for (i = 0; i < 4; i++) { hwkey[i] |= key[4*i+0]&mask; - if (i==1&&(4*i+1)==wrqu->encoding.length) mask=0x00; - if (i==3&&(4*i+1)==wrqu->encoding.length) mask=0x00; - hwkey[i] |= (key[4*i+1]&mask)<<8; - hwkey[i] |= (key[4*i+2]&mask)<<16; - hwkey[i] |= (key[4*i+3]&mask)<<24; + if (i == 1 && (4 * i + 1) == wrqu->encoding.length) + mask = 0x00; + if (i == 3 && (4 * i + 1) == wrqu->encoding.length) + mask = 0x00; + hwkey[i] |= (key[4 * i + 1] & mask) << 8; + hwkey[i] |= (key[4 * i + 2] & mask) << 16; + hwkey[i] |= (key[4 * i + 3] & mask) << 24; } #define CONF_WEP40 0x4 #define CONF_WEP104 0x14 - switch (wrqu->encoding.flags & IW_ENCODE_INDEX){ - case 0: key_idx = ieee->tx_keyidx; break; - case 1: key_idx = 0; break; - case 2: key_idx = 1; break; - case 3: key_idx = 2; break; - case 4: key_idx = 3; break; - default: break; + switch (wrqu->encoding.flags & IW_ENCODE_INDEX) { + case 0: + key_idx = ieee->tx_keyidx; + break; + case 1: + key_idx = 0; + break; + case 2: + key_idx = 1; + break; + case 3: + key_idx = 2; + break; + case 4: + key_idx = 3; + break; + default: + break; } - if (wrqu->encoding.length==0x5){ + if (wrqu->encoding.length == 0x5) { ieee->pairwise_key_type = KEY_TYPE_WEP40; EnableHWSecurityConfig8192(dev); } - else if (wrqu->encoding.length==0xd){ + else if (wrqu->encoding.length == 0xd) { ieee->pairwise_key_type = KEY_TYPE_WEP104; EnableHWSecurityConfig8192(dev); - setKey( dev, - key_idx, - key_idx, - KEY_TYPE_WEP104, - zero_addr[key_idx], - 0, - hwkey); - set_swcam( dev, - key_idx, - key_idx, - KEY_TYPE_WEP104, - zero_addr[key_idx], - 0, - hwkey, - 0); + setKey(dev, key_idx, key_idx, KEY_TYPE_WEP104, + zero_addr[key_idx], 0, hwkey); + set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104, + zero_addr[key_idx], 0, hwkey, 0); } else { - printk("wrong type in WEP, not WEP40 and WEP104\n"); + printk(KERN_INFO "wrong type in WEP, not WEP40 and WEP104\n"); } } @@ -820,13 +841,13 @@ end_hw_sec: return ret; } - -static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union - iwreq_data *wrqu, char *p){ - +static int r8192_wx_set_scan_type(struct net_device *dev, + struct iw_request_info *aa, + union iwreq_data *wrqu, char *p) +{ struct r8192_priv *priv = rtllib_priv(dev); - int *parms=(int*)p; - int mode=parms[0]; + int *parms = (int *)p; + int mode = parms[0]; if (priv->bHwRadioOff == true) return 0; @@ -852,38 +873,32 @@ static int r8192_wx_set_retry(struct net_device *dev, down(&priv->wx_sem); if (wrqu->retry.flags & IW_RETRY_LIFETIME || - wrqu->retry.disabled){ + wrqu->retry.disabled) { err = -EINVAL; goto exit; } - if (!(wrqu->retry.flags & IW_RETRY_LIMIT)){ + if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) { err = -EINVAL; goto exit; } - if (wrqu->retry.value > R8192_MAX_RETRY){ - err= -EINVAL; + if (wrqu->retry.value > R8192_MAX_RETRY) { + err = -EINVAL; goto exit; } if (wrqu->retry.flags & IW_RETRY_MAX) { priv->retry_rts = wrqu->retry.value; - DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value); + DMESG("Setting retry for RTS/CTS data to %d", + wrqu->retry.value); - }else { + } else { priv->retry_data = wrqu->retry.value; - DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value); + DMESG("Setting retry for non RTS/CTS data to %d", + wrqu->retry.value); } rtl8192_commit(dev); - /* - if (priv->up){ - rtl8180_halt_adapter(dev); - rtl8180_rx_enable(dev); - rtl8180_tx_enable(dev); - - } - */ exit: up(&priv->wx_sem); @@ -910,14 +925,12 @@ static int r8192_wx_get_retry(struct net_device *dev, wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN; wrqu->retry.value = priv->retry_data; } - - return 0; } static int r8192_wx_get_sens(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); if (priv->rf_set_sens == NULL) @@ -941,13 +954,13 @@ static int r8192_wx_set_sens(struct net_device *dev, down(&priv->wx_sem); if (priv->rf_set_sens == NULL) { - err= -1; /* we have not this support for this radio */ + err = -1; /* we have not this support for this radio */ goto exit; } if (priv->rf_set_sens(dev, wrqu->sens.value) == 0) priv->sens = wrqu->sens.value; else - err= -EINVAL; + err = -EINVAL; exit: up(&priv->wx_sem); @@ -956,130 +969,90 @@ exit: } static int r8192_wx_set_enc_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret=0; + int ret = 0; struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_device* ieee = priv->rtllib; + struct rtllib_device *ieee = priv->rtllib; if (priv->bHwRadioOff == true) return 0; down(&priv->wx_sem); - priv->rtllib->wx_set_enc = 1; - down(&priv->rtllib->ips_sem); - IPSLeave(dev); - up(&priv->rtllib->ips_sem); + priv->rtllib->wx_set_enc = 1; + down(&priv->rtllib->ips_sem); + IPSLeave(dev); + up(&priv->rtllib->ips_sem); ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra); - { - u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff}; + u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 zero[6] = {0}; u32 key[4] = {0}; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_point *encoding = &wrqu->encoding; u8 idx = 0, alg = 0, group = 0; if ((encoding->flags & IW_ENCODE_DISABLED) || - ext->alg == IW_ENCODE_ALG_NONE) - { - ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA; + ext->alg == IW_ENCODE_ALG_NONE) { + ieee->pairwise_key_type = ieee->group_key_type + = KEY_TYPE_NA; CamResetAllEntry(dev); - memset(priv->rtllib->swcamtable,0,sizeof(struct sw_cam_table)*32); + memset(priv->rtllib->swcamtable, 0, + sizeof(struct sw_cam_table) * 32); goto end_hw_sec; } - alg = (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg; + alg = (ext->alg == IW_ENCODE_ALG_CCMP) ? KEY_TYPE_CCMP : + ext->alg; idx = encoding->flags & IW_ENCODE_INDEX; if (idx) - idx --; + idx--; group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY; - if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg == KEY_TYPE_WEP40)) - { - if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40) ) + if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || + (alg == KEY_TYPE_WEP40)) { + if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40)) alg = KEY_TYPE_WEP104; ieee->pairwise_key_type = alg; EnableHWSecurityConfig8192(dev); } - memcpy((u8*)key, ext->key, 16); + memcpy((u8 *)key, ext->key, 16); - if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode !=2) ) - { + if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) { if (ext->key_len == 13) ieee->pairwise_key_type = alg = KEY_TYPE_WEP104; - setKey( dev, - idx, - idx, - alg, - zero, - 0, - key); - set_swcam( dev, - idx, - idx, - alg, - zero, - 0, - key, - 0); - } - else if (group) - { + setKey(dev, idx, idx, alg, zero, 0, key); + set_swcam(dev, idx, idx, alg, zero, 0, key, 0); + } else if (group) { ieee->group_key_type = alg; - setKey( dev, - idx, - idx, - alg, - broadcast_addr, - 0, - key); - set_swcam( dev, - idx, - idx, - alg, - broadcast_addr, - 0, - key, - 0); - } - else - { - if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport){ - write_nic_byte(dev, 0x173, 1); - } - setKey( dev, - 4, - idx, - alg, - (u8*)ieee->ap_mac_addr, - 0, - key); - set_swcam( dev, - 4, - idx, - alg, - (u8*)ieee->ap_mac_addr, - 0, - key, - 0); + setKey(dev, idx, idx, alg, broadcast_addr, 0, key); + set_swcam(dev, idx, idx, alg, broadcast_addr, 0, + key, 0); + } else { + if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && + ieee->pHTInfo->bCurrentHTSupport) + write_nic_byte(dev, 0x173, 1); + setKey(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, + 0, key); + set_swcam(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr, + 0, key, 0); } } end_hw_sec: - priv->rtllib->wx_set_enc = 0; + priv->rtllib->wx_set_enc = 0; up(&priv->wx_sem); return ret; } static int r8192_wx_set_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *data, char *extra) + struct iw_request_info *info, + union iwreq_data *data, char *extra) { - int ret=0; + int ret = 0; struct r8192_priv *priv = rtllib_priv(dev); @@ -1093,11 +1066,11 @@ static int r8192_wx_set_auth(struct net_device *dev, } static int r8192_wx_set_mlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - int ret=0; + int ret = 0; struct r8192_priv *priv = rtllib_priv(dev); @@ -1111,71 +1084,69 @@ static int r8192_wx_set_mlme(struct net_device *dev, } static int r8192_wx_set_gen_ie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *data, char *extra) + struct iw_request_info *info, + union iwreq_data *data, char *extra) { int ret = 0; - struct r8192_priv *priv = rtllib_priv(dev); + struct r8192_priv *priv = rtllib_priv(dev); if (priv->bHwRadioOff == true) return 0; - down(&priv->wx_sem); - ret = rtllib_wx_set_gen_ie(priv->rtllib, extra, data->data.length); - up(&priv->wx_sem); - return ret; + down(&priv->wx_sem); + ret = rtllib_wx_set_gen_ie(priv->rtllib, extra, data->data.length); + up(&priv->wx_sem); + return ret; } static int r8192_wx_get_gen_ie(struct net_device *dev, - struct iw_request_info *info, + struct iw_request_info *info, union iwreq_data *data, char *extra) { int ret = 0; - struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_device* ieee = priv->rtllib; + struct r8192_priv *priv = rtllib_priv(dev); + struct rtllib_device *ieee = priv->rtllib; if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { data->data.length = 0; return 0; } - if (data->data.length < ieee->wpa_ie_len) { + if (data->data.length < ieee->wpa_ie_len) return -E2BIG; - } data->data.length = ieee->wpa_ie_len; memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); - return ret; + return ret; } #define OID_RT_INTEL_PROMISCUOUS_MODE 0xFF0101F6 static int r8192_wx_set_PromiscuousMode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_device* ieee = priv->rtllib; + struct rtllib_device *ieee = priv->rtllib; - u32 *info_buf = (u32*)(wrqu->data.pointer); + u32 *info_buf = (u32 *)(wrqu->data.pointer); u32 oid = info_buf[0]; u32 bPromiscuousOn = info_buf[1]; u32 bFilterSourceStationFrame = info_buf[2]; - if (OID_RT_INTEL_PROMISCUOUS_MODE == oid) - { + if (OID_RT_INTEL_PROMISCUOUS_MODE == oid) { ieee->IntelPromiscuousModeInfo.bPromiscuousOn = - (bPromiscuousOn)? (true) : (false); + (bPromiscuousOn) ? (true) : (false); ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame = - (bFilterSourceStationFrame)? (true) : (false); + (bFilterSourceStationFrame) ? (true) : (false); + (bPromiscuousOn) ? + (rtllib_EnableIntelPromiscuousMode(dev, false)) : + (rtllib_DisableIntelPromiscuousMode(dev, false)); - (bPromiscuousOn) ? (rtllib_EnableIntelPromiscuousMode(dev, false)) : - (rtllib_DisableIntelPromiscuousMode(dev, false)); - - printk("=======>%s(), on = %d, filter src sta = %d\n", __func__, - bPromiscuousOn, bFilterSourceStationFrame); + printk(KERN_INFO "=======>%s(), on = %d, filter src sta = %d\n", + __func__, bPromiscuousOn, bFilterSourceStationFrame); } else { return -1; } @@ -1185,56 +1156,55 @@ static int r8192_wx_set_PromiscuousMode(struct net_device *dev, static int r8192_wx_get_PromiscuousMode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_device* ieee = priv->rtllib; + struct rtllib_device *ieee = priv->rtllib; - down(&priv->wx_sem); + down(&priv->wx_sem); - snprintf(extra, 45, "PromiscuousMode:%d, FilterSrcSTAFrame:%d",\ - ieee->IntelPromiscuousModeInfo.bPromiscuousOn,\ - ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame); - wrqu->data.length = strlen(extra) + 1; + snprintf(extra, 45, "PromiscuousMode:%d, FilterSrcSTAFrame:%d", + ieee->IntelPromiscuousModeInfo.bPromiscuousOn, + ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame); + wrqu->data.length = strlen(extra) + 1; - up(&priv->wx_sem); + up(&priv->wx_sem); return 0; } #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] -static iw_handler r8192_wx_handlers[] = -{ - IW_IOCTL(SIOCGIWNAME) = r8192_wx_get_name, - IW_IOCTL(SIOCSIWFREQ) = r8192_wx_set_freq, - IW_IOCTL(SIOCGIWFREQ) = r8192_wx_get_freq, - IW_IOCTL(SIOCSIWMODE) = r8192_wx_set_mode, - IW_IOCTL(SIOCGIWMODE) = r8192_wx_get_mode, - IW_IOCTL(SIOCSIWSENS) = r8192_wx_set_sens, - IW_IOCTL(SIOCGIWSENS) = r8192_wx_get_sens, - IW_IOCTL(SIOCGIWRANGE) = rtl8192_wx_get_range, - IW_IOCTL(SIOCSIWAP) = r8192_wx_set_wap, - IW_IOCTL(SIOCGIWAP) = r8192_wx_get_wap, - IW_IOCTL(SIOCSIWSCAN) = r8192_wx_set_scan, - IW_IOCTL(SIOCGIWSCAN) = r8192_wx_get_scan, - IW_IOCTL(SIOCSIWESSID) = r8192_wx_set_essid, - IW_IOCTL(SIOCGIWESSID) = r8192_wx_get_essid, - IW_IOCTL(SIOCSIWNICKN) = r8192_wx_set_nick, +static iw_handler r8192_wx_handlers[] = { + IW_IOCTL(SIOCGIWNAME) = r8192_wx_get_name, + IW_IOCTL(SIOCSIWFREQ) = r8192_wx_set_freq, + IW_IOCTL(SIOCGIWFREQ) = r8192_wx_get_freq, + IW_IOCTL(SIOCSIWMODE) = r8192_wx_set_mode, + IW_IOCTL(SIOCGIWMODE) = r8192_wx_get_mode, + IW_IOCTL(SIOCSIWSENS) = r8192_wx_set_sens, + IW_IOCTL(SIOCGIWSENS) = r8192_wx_get_sens, + IW_IOCTL(SIOCGIWRANGE) = rtl8192_wx_get_range, + IW_IOCTL(SIOCSIWAP) = r8192_wx_set_wap, + IW_IOCTL(SIOCGIWAP) = r8192_wx_get_wap, + IW_IOCTL(SIOCSIWSCAN) = r8192_wx_set_scan, + IW_IOCTL(SIOCGIWSCAN) = r8192_wx_get_scan, + IW_IOCTL(SIOCSIWESSID) = r8192_wx_set_essid, + IW_IOCTL(SIOCGIWESSID) = r8192_wx_get_essid, + IW_IOCTL(SIOCSIWNICKN) = r8192_wx_set_nick, IW_IOCTL(SIOCGIWNICKN) = r8192_wx_get_nick, - IW_IOCTL(SIOCSIWRATE) = r8192_wx_set_rate, - IW_IOCTL(SIOCGIWRATE) = r8192_wx_get_rate, - IW_IOCTL(SIOCSIWRTS) = r8192_wx_set_rts, - IW_IOCTL(SIOCGIWRTS) = r8192_wx_get_rts, - IW_IOCTL(SIOCSIWFRAG) = r8192_wx_set_frag, - IW_IOCTL(SIOCGIWFRAG) = r8192_wx_get_frag, - IW_IOCTL(SIOCSIWRETRY) = r8192_wx_set_retry, - IW_IOCTL(SIOCGIWRETRY) = r8192_wx_get_retry, - IW_IOCTL(SIOCSIWENCODE) = r8192_wx_set_enc, - IW_IOCTL(SIOCGIWENCODE) = r8192_wx_get_enc, - IW_IOCTL(SIOCSIWPOWER) = r8192_wx_set_power, - IW_IOCTL(SIOCGIWPOWER) = r8192_wx_get_power, + IW_IOCTL(SIOCSIWRATE) = r8192_wx_set_rate, + IW_IOCTL(SIOCGIWRATE) = r8192_wx_get_rate, + IW_IOCTL(SIOCSIWRTS) = r8192_wx_set_rts, + IW_IOCTL(SIOCGIWRTS) = r8192_wx_get_rts, + IW_IOCTL(SIOCSIWFRAG) = r8192_wx_set_frag, + IW_IOCTL(SIOCGIWFRAG) = r8192_wx_get_frag, + IW_IOCTL(SIOCSIWRETRY) = r8192_wx_set_retry, + IW_IOCTL(SIOCGIWRETRY) = r8192_wx_get_retry, + IW_IOCTL(SIOCSIWENCODE) = r8192_wx_set_enc, + IW_IOCTL(SIOCGIWENCODE) = r8192_wx_get_enc, + IW_IOCTL(SIOCSIWPOWER) = r8192_wx_set_power, + IW_IOCTL(SIOCGIWPOWER) = r8192_wx_get_power, IW_IOCTL(SIOCSIWGENIE) = r8192_wx_set_gen_ie, IW_IOCTL(SIOCGIWGENIE) = r8192_wx_get_gen_ie, IW_IOCTL(SIOCSIWMLME) = r8192_wx_set_mlme, @@ -1251,69 +1221,47 @@ static const struct iw_priv_args r8192_private_args[] = { { SIOCIWFIRSTPRIV + 0x0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_debugflag" - }, - { + }, { SIOCIWFIRSTPRIV + 0x1, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" - }, - { + }, { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" - } - , - { + }, { SIOCIWFIRSTPRIV + 0x3, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" - } - , - { + }, { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "force_mic_error" - } - , - { + }, { SIOCIWFIRSTPRIV + 0x5, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT|IW_PRIV_SIZE_FIXED|1, "firm_ver" - } - , - { + }, { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, "set_power" - } - , - { + }, { SIOCIWFIRSTPRIV + 0x9, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, "radio" - } - , - { + }, { SIOCIWFIRSTPRIV + 0xa, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, "lps_interv" - } - , - { + }, { SIOCIWFIRSTPRIV + 0xb, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, "lps_force" - } - , - { + }, { SIOCIWFIRSTPRIV + 0xc, 0, IW_PRIV_TYPE_CHAR|2047, "adhoc_peer_list" - } - , - { + }, { SIOCIWFIRSTPRIV + 0x16, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "setpromisc" - } - , - { + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "setpromisc" + }, { SIOCIWFIRSTPRIV + 0x17, - 0,IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 45, "getpromisc" + 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 45, "getpromisc" } }; @@ -1347,14 +1295,13 @@ static iw_handler r8192_private_handler[] = { struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) { - struct r8192_priv *priv = rtllib_priv(dev); - struct rtllib_device* ieee = priv->rtllib; - struct iw_statistics* wstats = &priv->wstats; + struct r8192_priv *priv = rtllib_priv(dev); + struct rtllib_device *ieee = priv->rtllib; + struct iw_statistics *wstats = &priv->wstats; int tmp_level = 0; int tmp_qual = 0; int tmp_noise = 0; - if (ieee->state < RTLLIB_LINKED) - { + if (ieee->state < RTLLIB_LINKED) { wstats->qual.qual = 10; wstats->qual.level = 0; wstats->qual.noise = -100; @@ -1362,7 +1309,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) return wstats; } - tmp_level = (&ieee->current_network)->stats.rssi; + tmp_level = (&ieee->current_network)->stats.rssi; tmp_qual = (&ieee->current_network)->stats.signal; tmp_noise = (&ieee->current_network)->stats.noise; @@ -1373,12 +1320,13 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) return wstats; } -struct iw_handler_def r8192_wx_handlers_def={ +struct iw_handler_def r8192_wx_handlers_def = { .standard = r8192_wx_handlers, .num_standard = sizeof(r8192_wx_handlers) / sizeof(iw_handler), .private = r8192_private_handler, .num_private = sizeof(r8192_private_handler) / sizeof(iw_handler), - .num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args), + .num_private_args = sizeof(r8192_private_args) / + sizeof(struct iw_priv_args), .get_wireless_stats = r8192_get_wireless_stats, .private_args = (struct iw_priv_args *)r8192_private_args, }; diff --git a/drivers/staging/rtl8192e/rtl_wx.h b/drivers/staging/rtl8192e/rtl_wx.h index 94d42a822116..6a51a25ec87d 100644 --- a/drivers/staging/rtl8192e/rtl_wx.h +++ b/drivers/staging/rtl8192e/rtl_wx.h @@ -26,6 +26,6 @@ struct iw_statistics; extern struct iw_handler_def r8192_wx_handlers_def; struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev); -u16 rtl8192_11n_user_show_rates(struct net_device* dev); +u16 rtl8192_11n_user_show_rates(struct net_device *dev); #endif