[PATCH 693/961] staging: rtl8192e: Use single spinlock in MgntActSet_RF_State

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mike McCormack <mikem@xxxxxxxxxx>

Signed-off-by: Mike McCormack <mikem@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/staging/rtl8192e/r8190_rtl8256.c |   41 +----------------------------
 drivers/staging/rtl8192e/r8192E.h        |    1 -
 drivers/staging/rtl8192e/r8192E_core.c   |   24 -----------------
 3 files changed, 2 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/rtl8192e/r8190_rtl8256.c b/drivers/staging/rtl8192e/r8190_rtl8256.c
index 00eaecd..9513af9 100644
--- a/drivers/staging/rtl8192e/r8190_rtl8256.c
+++ b/drivers/staging/rtl8192e/r8190_rtl8256.c
@@ -638,45 +638,10 @@ MgntActSet_RF_State(
 	bool 			bActionAllowed = false;
 	bool 			bConnectBySSID = false;
 	RT_RF_POWER_STATE	rtState;
-	u16					RFWaitCounter = 0;
-	RT_TRACE(COMP_POWER, "===>MgntActSet_RF_State(): StateToSet(%d)\n",StateToSet);
-
-	//1//
-	//1//<1>Prevent the race condition of RF state change.
-	//1//
-	// Only one thread can change the RF state at one time, and others should wait to be executed. By Bruce, 2007-11-28.
-
-	while(true)
-	{
-		spin_lock(&priv->rf_ps_lock);
-		if(priv->RFChangeInProgress)
-		{
-			spin_unlock(&priv->rf_ps_lock);
-			RT_TRACE(COMP_POWER, "MgntActSet_RF_State(): RF Change in progress! Wait to set..StateToSet(%d).\n", StateToSet);
 
-			// Set RF after the previous action is done.
-			while(priv->RFChangeInProgress)
-			{
-				RFWaitCounter ++;
-				RT_TRACE(COMP_POWER, "MgntActSet_RF_State(): Wait 1 ms (%d times)...\n", RFWaitCounter);
-				udelay(1000); // 1 ms
+	RT_TRACE(COMP_POWER, "===>MgntActSet_RF_State(): StateToSet(%d)\n",StateToSet);
 
-				// Wait too long, return FALSE to avoid to be stuck here.
-				if(RFWaitCounter > 100)
-				{
-					RT_TRACE(COMP_ERR, "MgntActSet_RF_State(): Wait too logn to set RF\n");
-					// TODO: Reset RF state?
-					return false;
-				}
-			}
-		}
-		else
-		{
-			priv->RFChangeInProgress = true;
-			spin_unlock(&priv->rf_ps_lock);
-			break;
-		}
-	}
+	spin_lock(&priv->rf_ps_lock);
 
 	rtState = priv->ieee80211->eRFPowerState;
 
@@ -731,8 +696,6 @@ MgntActSet_RF_State(
 	}
 
 	// Release RF spinlock
-	spin_lock(&priv->rf_ps_lock);
-	priv->RFChangeInProgress = false;
 	spin_unlock(&priv->rf_ps_lock);
 
 	RT_TRACE(COMP_POWER, "<===MgntActSet_RF_State()\n");
diff --git a/drivers/staging/rtl8192e/r8192E.h b/drivers/staging/rtl8192e/r8192E.h
index 0c20fae..4278091 100644
--- a/drivers/staging/rtl8192e/r8192E.h
+++ b/drivers/staging/rtl8192e/r8192E.h
@@ -1010,7 +1010,6 @@ typedef struct r8192_priv
 	//by amy for gpio
 	bool bHwRadioOff;
 	//by amy for ps
-	bool RFChangeInProgress; // RF Chnage in progress, by Bruce, 2007-10-30
 	RT_OP_MODE OpMode;
 	//by amy for reset_count
 	u32 reset_count;
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index ec68f94..0c88a25 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -1849,17 +1849,6 @@ static short rtl8192_is_tx_queue_empty(struct net_device *dev)
 
 static void rtl8192_hw_sleep_down(struct net_device *dev)
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);
-
-	spin_lock(&priv->rf_ps_lock);
-	if (priv->RFChangeInProgress) {
-		spin_unlock(&priv->rf_ps_lock);
-		RT_TRACE(COMP_RF, "rtl8192_hw_sleep_down(): RF Change in progress!\n");
-		printk("rtl8192_hw_sleep_down(): RF Change in progress!\n");
-		return;
-	}
-	spin_unlock(&priv->rf_ps_lock);
-
 	MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS);
 }
 
@@ -1874,18 +1863,6 @@ static void rtl8192_hw_sleep_wq (struct work_struct *work)
 
 static void rtl8192_hw_wakeup(struct net_device* dev)
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);
-
-	spin_lock(&priv->rf_ps_lock);
-	if (priv->RFChangeInProgress) {
-		spin_unlock(&priv->rf_ps_lock);
-		RT_TRACE(COMP_RF, "rtl8192_hw_wakeup(): RF Change in progress!\n");
-		printk("rtl8192_hw_wakeup(): RF Change in progress! schedule wake up task again\n");
-		queue_delayed_work(priv->ieee80211->wq,&priv->ieee80211->hw_wakeup_wq,MSECS(10));//PowerSave is not supported if kernel version is below 2.6.20
-		return;
-	}
-	spin_unlock(&priv->rf_ps_lock);
-
 	MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS);
 }
 
@@ -1984,7 +1961,6 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 	priv->force_reset = false;
 	//added by amy for power save
 	priv->ieee80211->RfOffReason = 0;
-	priv->RFChangeInProgress = false;
 	priv->bHwRfOffAction = 0;
 	priv->ieee80211->PowerSaveControl.bInactivePs = true;
 	priv->ieee80211->PowerSaveControl.bIPSModeBackup = false;
-- 
1.7.4.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux