Commit 2937a5d2 authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: MgntActSet_RF_State: remove ProtectOrNot parameter

It is set at the very beginning of function to a constant value.
Signed-off-by: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f2d4d4e1
...@@ -882,19 +882,17 @@ bool rtl92e_start_adapter(struct net_device *dev) ...@@ -882,19 +882,17 @@ bool rtl92e_start_adapter(struct net_device *dev)
RT_TRACE((COMP_INIT | COMP_RF | COMP_POWER), RT_TRACE((COMP_INIT | COMP_RF | COMP_POWER),
"%s(): Turn off RF for RegRfOff ----------\n", "%s(): Turn off RF for RegRfOff ----------\n",
__func__); __func__);
rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_SW, true); rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_SW);
} else if (priv->rtllib->RfOffReason > RF_CHANGE_BY_PS) { } else if (priv->rtllib->RfOffReason > RF_CHANGE_BY_PS) {
RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER),
"%s(): Turn off RF for RfOffReason(%d) ----------\n", "%s(): Turn off RF for RfOffReason(%d) ----------\n",
__func__, priv->rtllib->RfOffReason); __func__, priv->rtllib->RfOffReason);
rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason, rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason);
true);
} else if (priv->rtllib->RfOffReason >= RF_CHANGE_BY_IPS) { } else if (priv->rtllib->RfOffReason >= RF_CHANGE_BY_IPS) {
RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER),
"%s(): Turn off RF for RfOffReason(%d) ----------\n", "%s(): Turn off RF for RfOffReason(%d) ----------\n",
__func__, priv->rtllib->RfOffReason); __func__, priv->rtllib->RfOffReason);
rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason, rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason);
true);
} else { } else {
RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): RF-ON\n", RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): RF-ON\n",
__func__); __func__);
......
...@@ -149,8 +149,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y) ...@@ -149,8 +149,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y)
*****************************************************************************/ *****************************************************************************/
bool rtl92e_set_rf_state(struct net_device *dev, bool rtl92e_set_rf_state(struct net_device *dev,
enum rt_rf_power_state StateToSet, enum rt_rf_power_state StateToSet,
RT_RF_CHANGE_SOURCE ChangeSource, RT_RF_CHANGE_SOURCE ChangeSource)
bool ProtectOrNot)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device *ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
...@@ -163,37 +162,32 @@ bool rtl92e_set_rf_state(struct net_device *dev, ...@@ -163,37 +162,32 @@ bool rtl92e_set_rf_state(struct net_device *dev,
RT_TRACE((COMP_PS | COMP_RF), RT_TRACE((COMP_PS | COMP_RF),
"===>rtl92e_set_rf_state(): StateToSet(%d)\n", StateToSet); "===>rtl92e_set_rf_state(): StateToSet(%d)\n", StateToSet);
ProtectOrNot = false; while (true) {
spin_lock_irqsave(&priv->rf_ps_lock, flag);
if (priv->RFChangeInProgress) {
spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
RT_TRACE((COMP_PS | COMP_RF),
"rtl92e_set_rf_state(): RF Change in progress! Wait to set..StateToSet(%d).\n",
StateToSet);
if (!ProtectOrNot) { while (priv->RFChangeInProgress) {
while (true) { RFWaitCounter++;
spin_lock_irqsave(&priv->rf_ps_lock, flag);
if (priv->RFChangeInProgress) {
spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
RT_TRACE((COMP_PS | COMP_RF), RT_TRACE((COMP_PS | COMP_RF),
"rtl92e_set_rf_state(): RF Change in progress! Wait to set..StateToSet(%d).\n", "rtl92e_set_rf_state(): Wait 1 ms (%d times)...\n",
StateToSet); RFWaitCounter);
mdelay(1);
while (priv->RFChangeInProgress) {
RFWaitCounter++; if (RFWaitCounter > 100) {
RT_TRACE((COMP_PS | COMP_RF), netdev_warn(dev,
"rtl92e_set_rf_state(): Wait 1 ms (%d times)...\n", "%s(): Timeout waiting for RF change.\n",
RFWaitCounter); __func__);
mdelay(1); return false;
if (RFWaitCounter > 100) {
netdev_warn(dev,
"%s(): Timeout waiting for RF change.\n",
__func__);
return false;
}
} }
} else {
priv->RFChangeInProgress = true;
spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
break;
} }
} else {
priv->RFChangeInProgress = true;
spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
break;
} }
} }
...@@ -270,11 +264,9 @@ bool rtl92e_set_rf_state(struct net_device *dev, ...@@ -270,11 +264,9 @@ bool rtl92e_set_rf_state(struct net_device *dev,
StateToSet, ChangeSource, priv->rtllib->RfOffReason); StateToSet, ChangeSource, priv->rtllib->RfOffReason);
} }
if (!ProtectOrNot) { spin_lock_irqsave(&priv->rf_ps_lock, flag);
spin_lock_irqsave(&priv->rf_ps_lock, flag); priv->RFChangeInProgress = false;
priv->RFChangeInProgress = false; spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
}
RT_TRACE((COMP_PS | COMP_RF), "<===rtl92e_set_rf_state()\n"); RT_TRACE((COMP_PS | COMP_RF), "<===rtl92e_set_rf_state()\n");
return bActionAllowed; return bActionAllowed;
......
...@@ -617,6 +617,5 @@ bool rtl92e_disable_nic(struct net_device *dev); ...@@ -617,6 +617,5 @@ bool rtl92e_disable_nic(struct net_device *dev);
bool rtl92e_set_rf_state(struct net_device *dev, bool rtl92e_set_rf_state(struct net_device *dev,
enum rt_rf_power_state StateToSet, enum rt_rf_power_state StateToSet,
RT_RF_CHANGE_SOURCE ChangeSource, RT_RF_CHANGE_SOURCE ChangeSource);
bool ProtectOrNot);
#endif #endif
...@@ -1888,8 +1888,7 @@ static void dm_CheckRfCtrlGPIO(void *data) ...@@ -1888,8 +1888,7 @@ static void dm_CheckRfCtrlGPIO(void *data)
if (bActuallySet) { if (bActuallySet) {
mdelay(1000); mdelay(1000);
priv->bHwRfOffAction = 1; priv->bHwRfOffAction = 1;
rtl92e_set_rf_state(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW, rtl92e_set_rf_state(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW);
true);
if (priv->bHwRadioOff) if (priv->bHwRadioOff)
argv[1] = "RFOFF"; argv[1] = "RFOFF";
else else
......
...@@ -45,7 +45,7 @@ int rtl92e_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -45,7 +45,7 @@ int rtl92e_suspend(struct pci_dev *pdev, pm_message_t state)
netif_device_detach(dev); netif_device_detach(dev);
if (!priv->rtllib->bSupportRemoteWakeUp) { if (!priv->rtllib->bSupportRemoteWakeUp) {
rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_INIT, true); rtl92e_set_rf_state(dev, eRfOff, RF_CHANGE_BY_INIT);
ulRegRead = rtl92e_readl(dev, CPU_GEN); ulRegRead = rtl92e_readl(dev, CPU_GEN);
ulRegRead |= CPU_GEN_SYSTEM_RESET; ulRegRead |= CPU_GEN_SYSTEM_RESET;
rtl92e_writel(dev, CPU_GEN, ulRegRead); rtl92e_writel(dev, CPU_GEN, ulRegRead);
...@@ -108,7 +108,7 @@ int rtl92e_resume(struct pci_dev *pdev) ...@@ -108,7 +108,7 @@ int rtl92e_resume(struct pci_dev *pdev)
dev->netdev_ops->ndo_open(dev); dev->netdev_ops->ndo_open(dev);
if (!priv->rtllib->bSupportRemoteWakeUp) if (!priv->rtllib->bSupportRemoteWakeUp)
rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_INIT, true); rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_INIT);
out: out:
RT_TRACE(COMP_POWER, "<================r8192E resume call.\n"); RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
......
...@@ -45,7 +45,7 @@ static void rtl8192_hw_sleep_down(struct net_device *dev) ...@@ -45,7 +45,7 @@ static void rtl8192_hw_sleep_down(struct net_device *dev)
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__); RT_TRACE(COMP_DBG, "%s()============>come to sleep down\n", __func__);
rtl92e_set_rf_state(dev, eRfSleep, RF_CHANGE_BY_PS, false); rtl92e_set_rf_state(dev, eRfSleep, RF_CHANGE_BY_PS);
} }
void rtl92e_hw_sleep_wq(void *data) void rtl92e_hw_sleep_wq(void *data)
...@@ -74,7 +74,7 @@ void rtl92e_hw_wakeup(struct net_device *dev) ...@@ -74,7 +74,7 @@ void rtl92e_hw_wakeup(struct net_device *dev)
} }
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__); RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __func__);
rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_PS, false); rtl92e_set_rf_state(dev, eRfOn, RF_CHANGE_BY_PS);
} }
void rtl92e_hw_wakeup_wq(void *data) void rtl92e_hw_wakeup_wq(void *data)
...@@ -133,8 +133,7 @@ static void InactivePsWorkItemCallback(struct net_device *dev) ...@@ -133,8 +133,7 @@ static void InactivePsWorkItemCallback(struct net_device *dev)
RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n", RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n",
pPSC->eInactivePowerState == eRfOff ? "OFF" : "ON"); pPSC->eInactivePowerState == eRfOff ? "OFF" : "ON");
rtl92e_set_rf_state(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS, rtl92e_set_rf_state(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS);
false);
pPSC->bSwRfProcessing = false; pPSC->bSwRfProcessing = false;
RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <---------\n"); RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <---------\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment