From 2937a5d272031eb3e189d4383587bc9f62621c43 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:41 +0200 Subject: [PATCH] staging: rtl8192e: MgntActSet_RF_State: remove ProtectOrNot parameter It is set at the very beginning of function to a constant value. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 8 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 60 ++++++++----------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 3 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 3 +- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 7 +-- 6 files changed, 36 insertions(+), 49 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f8ad81e8fb1f..b2f307f3a442 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -882,19 +882,17 @@ start: RT_TRACE((COMP_INIT | COMP_RF | COMP_POWER), "%s(): Turn off RF for RegRfOff ----------\n", __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) { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for RfOffReason(%d) ----------\n", __func__, priv->rtllib->RfOffReason); - rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason, - true); + rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason); } else if (priv->rtllib->RfOffReason >= RF_CHANGE_BY_IPS) { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): Turn off RF for RfOffReason(%d) ----------\n", __func__, priv->rtllib->RfOffReason); - rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason, - true); + rtl92e_set_rf_state(dev, eRfOff, priv->rtllib->RfOffReason); } else { RT_TRACE((COMP_INIT|COMP_RF|COMP_POWER), "%s(): RF-ON\n", __func__); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 4157f8a58409..0033cfb21351 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -149,8 +149,7 @@ void rtl92e_writew(struct net_device *dev, int x, u16 y) *****************************************************************************/ bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state StateToSet, - RT_RF_CHANGE_SOURCE ChangeSource, - bool ProtectOrNot) + RT_RF_CHANGE_SOURCE ChangeSource) { struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; @@ -163,37 +162,32 @@ bool rtl92e_set_rf_state(struct net_device *dev, RT_TRACE((COMP_PS | COMP_RF), "===>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 (true) { - spin_lock_irqsave(&priv->rf_ps_lock, flag); - if (priv->RFChangeInProgress) { - spin_unlock_irqrestore(&priv->rf_ps_lock, flag); + while (priv->RFChangeInProgress) { + RFWaitCounter++; RT_TRACE((COMP_PS | COMP_RF), - "rtl92e_set_rf_state(): RF Change in progress! Wait to set..StateToSet(%d).\n", - StateToSet); - - while (priv->RFChangeInProgress) { - RFWaitCounter++; - RT_TRACE((COMP_PS | COMP_RF), - "rtl92e_set_rf_state(): Wait 1 ms (%d times)...\n", - RFWaitCounter); - mdelay(1); - - if (RFWaitCounter > 100) { - netdev_warn(dev, - "%s(): Timeout waiting for RF change.\n", - __func__); - return false; - } + "rtl92e_set_rf_state(): Wait 1 ms (%d times)...\n", + RFWaitCounter); + mdelay(1); + + 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, StateToSet, ChangeSource, priv->rtllib->RfOffReason); } - if (!ProtectOrNot) { - spin_lock_irqsave(&priv->rf_ps_lock, flag); - priv->RFChangeInProgress = false; - spin_unlock_irqrestore(&priv->rf_ps_lock, flag); - } + spin_lock_irqsave(&priv->rf_ps_lock, flag); + priv->RFChangeInProgress = false; + spin_unlock_irqrestore(&priv->rf_ps_lock, flag); RT_TRACE((COMP_PS | COMP_RF), "<===rtl92e_set_rf_state()\n"); return bActionAllowed; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index bdb50323f61b..cd948bb13840 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -617,6 +617,5 @@ bool rtl92e_disable_nic(struct net_device *dev); bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state StateToSet, - RT_RF_CHANGE_SOURCE ChangeSource, - bool ProtectOrNot); + RT_RF_CHANGE_SOURCE ChangeSource); #endif diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 458097ee09e7..1a0c690bfa07 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1888,8 +1888,7 @@ static void dm_CheckRfCtrlGPIO(void *data) if (bActuallySet) { mdelay(1000); priv->bHwRfOffAction = 1; - rtl92e_set_rf_state(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW, - true); + rtl92e_set_rf_state(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW); if (priv->bHwRadioOff) argv[1] = "RFOFF"; else diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index c224adedaf62..b0268fdc100f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -45,7 +45,7 @@ int rtl92e_suspend(struct pci_dev *pdev, pm_message_t state) netif_device_detach(dev); 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 |= CPU_GEN_SYSTEM_RESET; rtl92e_writel(dev, CPU_GEN, ulRegRead); @@ -108,7 +108,7 @@ int rtl92e_resume(struct pci_dev *pdev) dev->netdev_ops->ndo_open(dev); 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: RT_TRACE(COMP_POWER, "<================r8192E resume call.\n"); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 38addad24f18..f09560d60dc4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -45,7 +45,7 @@ static void rtl8192_hw_sleep_down(struct net_device *dev) spin_unlock_irqrestore(&priv->rf_ps_lock, flags); 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) @@ -74,7 +74,7 @@ void rtl92e_hw_wakeup(struct net_device *dev) } spin_unlock_irqrestore(&priv->rf_ps_lock, flags); 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) @@ -133,8 +133,7 @@ static void InactivePsWorkItemCallback(struct net_device *dev) RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n", pPSC->eInactivePowerState == eRfOff ? "OFF" : "ON"); - rtl92e_set_rf_state(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS, - false); + rtl92e_set_rf_state(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS); pPSC->bSwRfProcessing = false; RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <---------\n"); -- 2.20.1