public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Staging: rtl8187se: r8180_dm.c: Fix Coding Style issues
@ 2012-03-15 19:05 Andrew Miller
  2012-03-15 19:05 ` [PATCH 1/5] Staging: rtl8187se: r8180_dm.c: Removed spaces before tab stop Andrew Miller
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Andrew Miller @ 2012-03-15 19:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, amiller

This patchset fixes many Coding Style issues in r8180_dm.c

This came out much larger then I thought it was going to,
If this is to much for one patchset, please let me know.

Andrew Miller (5):
  Staging: rtl8187se: r8180_dm.c: Removed spaces before tab stop
  Staging: rtl8187se: r8180_dm.c: Fix brackets
  Staging: rtl8187se: r8180_dm.c: Fixed indentation issues
  Staging: rtl8187se: r8180_dm.c: Fix spacing issues
  Staging: rtl8187se: r8180_dm.c: Fix comments

 drivers/staging/rtl8187se/r8180_dm.c | 2007 +++++++++++++++-------------------
 1 files changed, 892 insertions(+), 1115 deletions(-)

-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] Staging: rtl8187se: r8180_dm.c: Removed spaces before tab stop
  2012-03-15 19:05 [PATCH 0/5] Staging: rtl8187se: r8180_dm.c: Fix Coding Style issues Andrew Miller
@ 2012-03-15 19:05 ` Andrew Miller
  2012-03-15 19:05 ` [PATCH 2/5] Staging: rtl8187se: r8180_dm.c: Fix brackets Andrew Miller
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Andrew Miller @ 2012-03-15 19:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, amiller

Clean up spaces before tab stops and some trailing space to.

Signed-off-by: Andrew Miller <amiller@amilx.com>
---
 drivers/staging/rtl8187se/r8180_dm.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c
index 261085d..80fd71c 100644
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -180,7 +180,7 @@ DIG_Zebra(
 	u16			OfdmFA1, OfdmFA2;
 	int			InitialGainStep = 7; // The number of initial gain stages.
 	int			LowestGainStage = 4; // The capable lowest stage of performing dig workitem.
-	u32 			AwakePeriodIn2Sec=0;
+	u32			AwakePeriodIn2Sec=0;
 
 	//printk("---------> DIG_Zebra()\n");
 
@@ -502,7 +502,7 @@ MgntIsCckRate(
 //
 //	Description:
 //		Tx Power tracking mechanism routine on 87SE.
-// 	Created by Roger, 2007.12.11.
+//	Created by Roger, 2007.12.11.
 //
 void
 TxPwrTracking87SE(
@@ -567,11 +567,11 @@ StaRateAdaptive87SE(
 	)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	unsigned long 			CurrTxokCnt;
+	unsigned long			CurrTxokCnt;
 	u16			CurrRetryCnt;
 	u16			CurrRetryRate;
 	//u16			i,idx;
-	unsigned long       	CurrRxokCnt;
+	unsigned long		CurrRxokCnt;
 	bool			bTryUp = false;
 	bool			bTryDown = false;
 	u8			TryUpTh = 1;
@@ -579,7 +579,7 @@ StaRateAdaptive87SE(
 	u32			TxThroughput;
 	long		CurrSignalStrength;
 	bool		bUpdateInitialGain = false;
-    	u8			u1bOfdm=0, u1bCck = 0;
+	u8			u1bOfdm=0, u1bCck = 0;
 	char		OfdmTxPwrIdx, CckTxPwrIdx;
 
 	priv->RateAdaptivePeriod= RATE_ADAPTIVE_TIMER_PERIOD;
@@ -634,7 +634,7 @@ StaRateAdaptive87SE(
 		if (priv->TryupingCountNoData>30)
 		{
 			priv->TryupingCountNoData = 0;
-		 	priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate);
+			priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate);
 			// Reset Fail Record
 			priv->LastFailTxRate = 0;
 			priv->LastFailTxRateSS = -200;
@@ -687,9 +687,9 @@ StaRateAdaptive87SE(
 	{
 		//2 For Test Upgrading mechanism
 		// Note:
-		// 	Sometimes the throughput is upon on the capability bwtween the AP and NIC,
-		// 	thus the low data rate does not improve the performance.
-		// 	We randomly upgrade the data rate and check if the retry rate is improved.
+		//	Sometimes the throughput is upon on the capability bwtween the AP and NIC,
+		//	thus the low data rate does not improve the performance.
+		//	We randomly upgrade the data rate and check if the retry rate is improved.
 
 		// Upgrading rate did not improve the retry rate, fallback to the original rate.
 		if ( (CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput)
@@ -846,7 +846,7 @@ StaRateAdaptive87SE(
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
 		}
-  		else if ( (CurrRetryRate<20) && (priv->LastRetryRate<21)) //TO DO: need to consider (RSSI)
+		else if ( (CurrRetryRate<20) && (priv->LastRetryRate<21)) //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<40) && (priv->LastRetryRate<41))
 		{
 			bTryUp = true;
@@ -942,7 +942,7 @@ StaRateAdaptive87SE(
 	}
 
 	if(bTryUp && bTryDown)
-    	printk("StaRateAdaptive87B(): Tx Rate tried upping and downing simultaneously!\n");
+	printk("StaRateAdaptive87B(): Tx Rate tried upping and downing simultaneously!\n");
 
 	//1 Test Upgrading Tx Rate
 	// Sometimes the cause of the low throughput (high retry rate) is the compatibility between the AP and NIC.
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] Staging: rtl8187se: r8180_dm.c: Fix brackets
  2012-03-15 19:05 [PATCH 0/5] Staging: rtl8187se: r8180_dm.c: Fix Coding Style issues Andrew Miller
  2012-03-15 19:05 ` [PATCH 1/5] Staging: rtl8187se: r8180_dm.c: Removed spaces before tab stop Andrew Miller
@ 2012-03-15 19:05 ` Andrew Miller
  2012-03-15 19:05 ` [PATCH 3/5] Staging: rtl8187se: r8180_dm.c Fixed indentation issues Andrew Miller
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Andrew Miller @ 2012-03-15 19:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, amiller

Fix brackets that where out of place and removed
brackets that were not needed

Signed-off-by: Andrew Miller <amiller@amilx.com>
---
 drivers/staging/rtl8187se/r8180_dm.c |  531 +++++++++++-----------------------
 1 files changed, 166 insertions(+), 365 deletions(-)

diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c
index 80fd71c..97e4fef 100644
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -17,14 +17,10 @@ bool CheckHighPower(struct net_device *dev)
 	struct ieee80211_device *ieee = priv->ieee80211;
 
 	if(!priv->bRegHighPowerMechanism)
-	{
 		return false;
-	}
 
 	if(ieee->state == IEEE80211_LINKED_SCANNING)
-	{
 		return false;
-	}
 
 	return true;
 }
@@ -70,8 +66,7 @@ DoTxHighPower(
 	//	printk("DoTxHighPower() - UndecoratedSmoothedSS:%d, CurCCKRSSI = %d , bCurCCKPkt= %d \n", priv->UndecoratedSmoothedSS, priv->CurCCKRSSI, priv->bCurCCKPkt );
 
 	if((priv->UndecoratedSmoothedSS > HiPwrUpperTh) ||
-		(priv->bCurCCKPkt && (priv->CurCCKRSSI > RSSIHiPwrUpperTh)))
-	{
+		(priv->bCurCCKPkt && (priv->CurCCKRSSI > RSSIHiPwrUpperTh))) {
 		// Stevenl suggested that degrade 8dbm in high power sate. 2007-12-04 Isaiah
 
 	//	printk("=====>DoTxHighPower() - High Power - UndecoratedSmoothedSS:%d,  HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrUpperTh );
@@ -79,8 +74,7 @@ DoTxHighPower(
 		u1bTmp= read_nic_byte(dev, CCK_TXAGC);
 
 		// If it never enter High Power.
-		if( CckTxPwrIdx == u1bTmp)
-		{
+		if( CckTxPwrIdx == u1bTmp) {
 		u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  // 8dbm
 		write_nic_byte(dev, CCK_TXAGC, u1bTmp);
 
@@ -89,26 +83,21 @@ DoTxHighPower(
 		write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
 		}
 
-	}
-	else if((priv->UndecoratedSmoothedSS < HiPwrLowerTh) &&
-		(!priv->bCurCCKPkt || priv->CurCCKRSSI < RSSIHiPwrLowerTh))
-	{
+	} else if((priv->UndecoratedSmoothedSS < HiPwrLowerTh) &&
+		(!priv->bCurCCKPkt || priv->CurCCKRSSI < RSSIHiPwrLowerTh)) {
 	//	 printk("DoTxHighPower() - lower Power - UndecoratedSmoothedSS:%d,  HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrLowerTh );
-		if(priv->bToUpdateTxPwr)
-		{
+		if(priv->bToUpdateTxPwr) {
 			priv->bToUpdateTxPwr = false;
 			//SD3 required.
 			u1bTmp= read_nic_byte(dev, CCK_TXAGC);
-			if(u1bTmp < CckTxPwrIdx)
-			{
+			if(u1bTmp < CckTxPwrIdx) {
 			//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
 			//write_nic_byte(dev, CCK_TXAGC, u1bTmp);
 			write_nic_byte(dev, CCK_TXAGC, CckTxPwrIdx);
 			}
 
 			u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
-			if(u1bTmp < OfdmTxPwrIdx)
-			{
+			if(u1bTmp < OfdmTxPwrIdx) {
 			//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
 			//write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
 			write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
@@ -193,29 +182,25 @@ DIG_Zebra(
 //	printk("DIG**********OFDM False Alarm: %#X \n",OFDMFalseAlarm);
 
         // The number of initial gain steps is different, by Bruce, 2007-04-13.
-	if (priv->InitialGain == 0 ) //autoDIG
-	{ // Advised from SD3 DZ
+	if (priv->InitialGain == 0 ) { //autoDIG
+		// Advised from SD3 DZ
 		priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm)
 	}
-	{ // Advised from SD3 DZ
-		OfdmFA1 =  0x20;
-	}
+	// Advised from SD3 DZ
+	OfdmFA1 =  0x20;
 
 #if 1 //lzm reserved 080826
 	AwakePeriodIn2Sec = (2000-priv ->DozePeriodInPast2Sec);
 	//printk("&&& DozePeriod=%d AwakePeriod=%d\n", priv->DozePeriodInPast2Sec, AwakePeriodIn2Sec);
 	priv ->DozePeriodInPast2Sec=0;
 
-	if(AwakePeriodIn2Sec)
-	{
+	if(AwakePeriodIn2Sec) {
 		//RT_TRACE(COMP_DIG, DBG_TRACE, ("DIG: AwakePeriodIn2Sec(%d) - FATh(0x%X , 0x%X) ->",AwakePeriodIn2Sec, OfdmFA1, OfdmFA2));
 		// adjuest DIG threshold.
 		OfdmFA1 =  (u16)((OfdmFA1*AwakePeriodIn2Sec)  / 2000) ;
 		OfdmFA2 =  (u16)((OfdmFA2*AwakePeriodIn2Sec)  / 2000) ;
 		//RT_TRACE(COMP_DIG, DBG_TRACE, ("( 0x%X , 0x%X)\n", OfdmFA1, OfdmFA2));
-	}
-	else
-	{
+	} else {
 		;//RT_TRACE(COMP_DIG, DBG_WARNING, ("ERROR!!  AwakePeriodIn2Sec should not be ZERO!!\n"));
 	}
 #endif
@@ -223,16 +208,12 @@ DIG_Zebra(
 	InitialGainStep = 8;
 	LowestGainStage = priv->RegBModeGainStage; // Lowest gain stage.
 
-	if (OFDMFalseAlarm > OfdmFA1)
-	{
-		if (OFDMFalseAlarm > OfdmFA2)
-		{
+	if (OFDMFalseAlarm > OfdmFA1) {
+		if (OFDMFalseAlarm > OfdmFA2) {
 			priv->DIG_NumberFallbackVote++;
-			if (priv->DIG_NumberFallbackVote >1)
-			{
+			if (priv->DIG_NumberFallbackVote >1) {
 				//serious OFDM  False Alarm, need fallback
-				if (priv->InitialGain < InitialGainStep)
-				{
+				if (priv->InitialGain < InitialGainStep) {
 					priv->InitialGainBackUp= priv->InitialGain;
 
 					priv->InitialGain = (priv->InitialGain + 1);
@@ -243,24 +224,18 @@ DIG_Zebra(
 				priv->DIG_NumberFallbackVote = 0;
 				priv->DIG_NumberUpgradeVote=0;
 			}
-		}
-		else
-		{
+		} else {
 			if (priv->DIG_NumberFallbackVote)
 				priv->DIG_NumberFallbackVote--;
 		}
 		priv->DIG_NumberUpgradeVote=0;
-	}
-	else
-	{
+	} else {
 		if (priv->DIG_NumberFallbackVote)
 			priv->DIG_NumberFallbackVote--;
 		priv->DIG_NumberUpgradeVote++;
 
-		if (priv->DIG_NumberUpgradeVote>9)
-		{
-			if (priv->InitialGain > LowestGainStage) // In 87B, m78dBm means State 4 (m864dBm)
-			{
+		if (priv->DIG_NumberUpgradeVote>9) {
+			if (priv->InitialGain > LowestGainStage) { // In 87B, m78dBm means State 4 (m864dBm)
 				priv->InitialGainBackUp= priv->InitialGain;
 
 				priv->InitialGain = (priv->InitialGain - 1);
@@ -317,18 +292,14 @@ IncludedInSupportedRates(
 
     rate_len = priv->ieee80211->current_network.rates_len;
         rate_ex_len = priv->ieee80211->current_network.rates_ex_len;
-        for( idx=0; idx< rate_len; idx++ )
-        {
-                if( (priv->ieee80211->current_network.rates[idx] & RateMask) == NaiveTxRate )
-                {
+        for( idx=0; idx< rate_len; idx++ ) {
+                if( (priv->ieee80211->current_network.rates[idx] & RateMask) == NaiveTxRate ) {
                         Found = 1;
                         goto found_rate;
                 }
         }
-    for( idx=0; idx< rate_ex_len; idx++ )
-        {
-                if( (priv->ieee80211->current_network.rates_ex[idx] & RateMask) == NaiveTxRate )
-                {
+    for( idx=0; idx< rate_ex_len; idx++ ) {
+                if( (priv->ieee80211->current_network.rates_ex[idx] & RateMask) == NaiveTxRate ) {
                         Found = 1;
                         goto found_rate;
                 }
@@ -354,8 +325,7 @@ GetUpgradeTxRate(
         u8                      UpRate;
 
         // Upgrade 1 degree.
-        switch(rate)
-        {
+        switch(rate) {
         case 108: // Up to 54Mbps.
                 UpRate = 108;
                 break;
@@ -397,13 +367,10 @@ GetUpgradeTxRate(
                 return rate;
         }
         // Check if the rate is valid.
-        if(IncludedInSupportedRates(priv, UpRate))
-        {
+        if(IncludedInSupportedRates(priv, UpRate)) {
 //              printk("GetUpgradeTxRate(): GetUpgrade Tx rate(%d) from %d !\n", UpRate, priv->CurrentOperaRate);
                 return UpRate;
-        }
-        else
-        {
+        } else {
                 //printk("GetUpgradeTxRate(): Tx rate (%d) is not in supported rates\n", UpRate);
                 return rate;
         }
@@ -425,8 +392,7 @@ GetDegradeTxRate(
         u8                      DownRate;
 
         // Upgrade 1 degree.
-        switch(rate)
-        {
+        switch(rate) {
         case 108: // Down to 48Mbps.
                 DownRate = 96;
                 break;
@@ -468,13 +434,10 @@ GetDegradeTxRate(
                 return rate;
         }
         // Check if the rate is valid.
-        if(IncludedInSupportedRates(priv, DownRate))
-        {
+        if(IncludedInSupportedRates(priv, DownRate)) {
 //              printk("GetDegradeTxRate(): GetDegrade Tx rate(%d) from %d!\n", DownRate, priv->CurrentOperaRate);
                 return DownRate;
-        }
-        else
-        {
+        } else {
                 //printk("GetDegradeTxRate(): Tx rate (%d) is not in supported rates\n", DownRate);
                 return rate;
         }
@@ -492,8 +455,7 @@ MgntIsCckRate(
 {
         bool bReturn = false;
 
-        if((rate <= 22) && (rate != 12) && (rate != 18))
-        {
+        if((rate <= 22) && (rate != 12) && (rate != 18)) {
                 bReturn = true;
         }
 
@@ -520,18 +482,16 @@ TxPwrTracking87SE(
 
 	//printk("TxPwrTracking87SE(): CurrentThermal(%d)\n", CurrentThermal);
 
-	if( CurrentThermal != priv->ThermalMeter)
-	{
+	if( CurrentThermal != priv->ThermalMeter) {
 //		printk("TxPwrTracking87SE(): Thermal meter changed!!!\n");
 
 		// Update Tx Power level on each channel.
-		for(Idx = 1; Idx<15; Idx++)
-		{
+		for(Idx = 1; Idx<15; Idx++) {
 			CckTxPwrIdx = priv->chtxpwr[Idx];
 			OfdmTxPwrIdx = priv->chtxpwr_ofdm[Idx];
 
-			if( CurrentThermal > priv->ThermalMeter )
-			{ // higher thermal meter.
+			if( CurrentThermal > priv->ThermalMeter ) { 
+				// higher thermal meter.
 				CckTxPwrIdx += (CurrentThermal - priv->ThermalMeter)*2;
 				OfdmTxPwrIdx += (CurrentThermal - priv->ThermalMeter)*2;
 
@@ -539,9 +499,8 @@ TxPwrTracking87SE(
 					CckTxPwrIdx = 35; // Force TxPower to maximal index.
 				if(OfdmTxPwrIdx >35)
 					OfdmTxPwrIdx = 35;
-			}
-			else
-			{ // lower thermal meter.
+			} else {
+				// lower thermal meter.
 				CckTxPwrIdx -= (priv->ThermalMeter - CurrentThermal)*2;
 				OfdmTxPwrIdx -= (priv->ThermalMeter - CurrentThermal)*2;
 
@@ -594,12 +553,10 @@ StaRateAdaptive87SE(
 	priv->CurrentOperaRate = priv->ieee80211->rate/5;
 	//printk("priv->CurrentOperaRate is %d\n",priv->CurrentOperaRate);
 	//2 Compute retry ratio.
-	if (CurrTxokCnt>0)
-	{
+	if (CurrTxokCnt>0) {
 		CurrRetryRate = (u16)(CurrRetryCnt*100/CurrTxokCnt);
-	}
-	else
-	{ // It may be serious retry. To distinguish serious retry or no packets modified by Bruce
+	} else {
+	// It may be serious retry. To distinguish serious retry or no packets modified by Bruce
 		CurrRetryRate = (u16)(CurrRetryCnt*100/1);
 	}
 
@@ -622,8 +579,7 @@ StaRateAdaptive87SE(
 	priv->CurrRetryCnt = 0;
 
 	//2No Tx packets, return to init_rate or not?
-	if (CurrRetryRate==0 && CurrTxokCnt == 0)
-	{
+	if (CurrRetryRate==0 && CurrTxokCnt == 0) {
 		//
 		//After 9 (30*300ms) seconds in this condition, we try to raise rate.
 		//
@@ -631,8 +587,7 @@ StaRateAdaptive87SE(
 
 //		printk("No Tx packets, TryupingCountNoData(%d)\n", priv->TryupingCountNoData);
 		//[TRC Dell Lab] Extend raised period from 4.5sec to 9sec, Isaiah 2008-02-15 18:00
-		if (priv->TryupingCountNoData>30)
-		{
+		if (priv->TryupingCountNoData>30) {
 			priv->TryupingCountNoData = 0;
 			priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate);
 			// Reset Fail Record
@@ -641,9 +596,7 @@ StaRateAdaptive87SE(
 			priv->FailTxRateCount = 0;
 		}
 		goto SetInitialGain;
-	}
-        else
-	{
+	} else {
 		priv->TryupingCountNoData=0; //Reset trying up times.
 	}
 
@@ -671,20 +624,15 @@ StaRateAdaptive87SE(
 	// Check more times in these rate(key rates).
 	//
 	if(priv->CurrentOperaRate == 22 || priv->CurrentOperaRate == 72)
-	{
 		TryUpTh += 9;
-	}
 	//
 	// Let these rates down more difficult.
 	//
 	if(MgntIsCckRate(priv->CurrentOperaRate) || priv->CurrentOperaRate == 36)
-	{
 			TryDownTh += 1;
-	}
 
 	//1 Adjust Rate.
-	if (priv->bTryuping == true)
-	{
+	if (priv->bTryuping == true) {
 		//2 For Test Upgrading mechanism
 		// Note:
 		//	Sometimes the throughput is upon on the capability bwtween the AP and NIC,
@@ -692,21 +640,16 @@ StaRateAdaptive87SE(
 		//	We randomly upgrade the data rate and check if the retry rate is improved.
 
 		// Upgrading rate did not improve the retry rate, fallback to the original rate.
-		if ( (CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput)
-		{
+		if ( (CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput) {
 			//Not necessary raising rate, fall back rate.
 			bTryDown = true;
 			//printk("case1-1: Not necessary raising rate, fall back rate....\n");
 			//printk("case1-1: pMgntInfo->CurrentOperaRate =%d, TxThroughput = %d, LastThroughput = %d\n",
 			//		priv->CurrentOperaRate, TxThroughput, priv->LastTxThroughput);
-		}
-		else
-		{
+		} else {
 			priv->bTryuping = false;
 		}
-	}
-	else if (CurrSignalStrength > -47 && (CurrRetryRate < 50))
-	{
+	} else if (CurrSignalStrength > -47 && (CurrRetryRate < 50)) {
 		//2For High Power
 		//
 		// Added by Roger, 2007.04.09.
@@ -715,17 +658,14 @@ StaRateAdaptive87SE(
 		// Revise SignalStrength threshold to -51dbm.
 		//
 		// Also need to check retry rate for safety, by Bruce, 2007-06-05.
-		if(priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate )
-		{
+		if(priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate ) {
 			bTryUp = true;
 			// Upgrade Tx Rate directly.
 			priv->TryupingCount += TryUpTh;
 		}
 //		printk("case2: StaRateAdaptive87SE: Power(%d) is high enough!!. \n", CurrSignalStrength);
 
-	}
-	else if(CurrTxokCnt > 9 && CurrTxokCnt< 100 && CurrRetryRate >= 600)
-	{
+	} else if(CurrTxokCnt > 9 && CurrTxokCnt< 100 && CurrRetryRate >= 600) {
 		//2 For Serious Retry
 		//
 		// Traffic is not busy but our Tx retry is serious.
@@ -734,208 +674,147 @@ StaRateAdaptive87SE(
 		// Let Rate Mechanism to degrade tx rate directly.
 		priv->TryDownCountLowData += TryDownTh;
 //		printk("case3: RA: Tx Retry is serious. Degrade Tx Rate to %d directly...\n", priv->CurrentOperaRate);
-	}
-	else if ( priv->CurrentOperaRate == 108 )
-	{
+	} else if ( priv->CurrentOperaRate == 108 ) {
 		//2For 54Mbps
 		// Air Link
-		if ( (CurrRetryRate>26)&&(priv->LastRetryRate>25))
+		if ( (CurrRetryRate>26)&&(priv->LastRetryRate>25)) {
 //		if ( (CurrRetryRate>40)&&(priv->LastRetryRate>39))
-		{
 			//Down to rate 48Mbps.
 			bTryDown = true;
 		}
 		// Cable Link
-		else if ( (CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72))
+		else if ( (CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72)) {
 //		else if ( (CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72))
-		{
 			//Down to rate 48Mbps.
 			bTryDown = true;
 		}
 
 		if(bTryDown && (CurrSignalStrength < -75)) //cable link
-		{
 			priv->TryDownCountLowData += TryDownTh;
-		}
 		//printk("case4---54M \n");
 
 	}
-	else if ( priv->CurrentOperaRate == 96 )
-	{
+	else if ( priv->CurrentOperaRate == 96 ) {
 		//2For 48Mbps
 		//Air Link
-		if ( ((CurrRetryRate>48) && (priv->LastRetryRate>47)))
+		if ( ((CurrRetryRate>48) && (priv->LastRetryRate>47))) {
 //		if ( ((CurrRetryRate>65) && (priv->LastRetryRate>64)))
-
-		{
 			//Down to rate 36Mbps.
 			bTryDown = true;
-		}
-		//Cable Link
-		else if ( ((CurrRetryRate>21) && (priv->LastRetryRate>20)) && (CurrSignalStrength > -74))
-		{
+		} else if ( ((CurrRetryRate>21) && (priv->LastRetryRate>20)) && (CurrSignalStrength > -74)) { //Cable Link	
 			//Down to rate 36Mbps.
 			bTryDown = true;
-		}
-		else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 ))
+		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
-		{
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		}
-		else if ( (CurrRetryRate<8) && (priv->LastRetryRate<8) ) //TO DO: need to consider (RSSI)
+		} else if ( (CurrRetryRate<8) && (priv->LastRetryRate<8) ) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<28) && (priv->LastRetryRate<8) )
-		{
 			bTryUp = true;
 		}
 
-		if(bTryDown && (CurrSignalStrength < -75))
-		{
+		if(bTryDown && (CurrSignalStrength < -75)){
 			priv->TryDownCountLowData += TryDownTh;
 		}
 		//printk("case5---48M \n");
-	}
-	else if ( priv->CurrentOperaRate == 72 )
-	{
+	} else if ( priv->CurrentOperaRate == 72 ) {
 		//2For 36Mbps
-		if ( (CurrRetryRate>43) && (priv->LastRetryRate>41))
+		if ( (CurrRetryRate>43) && (priv->LastRetryRate>41)) {
 //		if ( (CurrRetryRate>60) && (priv->LastRetryRate>59))
-		{
 			//Down to rate 24Mbps.
 			bTryDown = true;
-		}
-		else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 ))
+		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
-		{
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		}
-		else if ( (CurrRetryRate<15) &&  (priv->LastRetryRate<16)) //TO DO: need to consider (RSSI)
+		} else if ( (CurrRetryRate<15) &&  (priv->LastRetryRate<16)) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<35) &&  (priv->LastRetryRate<36))
-		{
 			bTryUp = true;
 		}
 
 		if(bTryDown && (CurrSignalStrength < -80))
-		{
 			priv->TryDownCountLowData += TryDownTh;
-		}
+
 		//printk("case6---36M \n");
-	}
-	else if ( priv->CurrentOperaRate == 48 )
-	{
+	} else if ( priv->CurrentOperaRate == 48 ) {
 		//2For 24Mbps
 		// Air Link
-		if ( ((CurrRetryRate>63) && (priv->LastRetryRate>62)))
+		if ( ((CurrRetryRate>63) && (priv->LastRetryRate>62))) {
 //		if ( ((CurrRetryRate>83) && (priv->LastRetryRate>82)))
-		{
 			//Down to rate 18Mbps.
 			bTryDown = true;
-		}
-		//Cable Link
-		else if ( ((CurrRetryRate>33) && (priv->LastRetryRate>32)) && (CurrSignalStrength > -82) )
+		} else if ( ((CurrRetryRate>33) && (priv->LastRetryRate>32)) && (CurrSignalStrength > -82) ) { //Cable Link
 //		 else if ( ((CurrRetryRate>50) && (priv->LastRetryRate>49)) && (CurrSignalStrength > -82) )
-		{
 			//Down to rate 18Mbps.
 			bTryDown = true;
-		}
-		else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 ))
+		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
-
-		{
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		}
-		else if ( (CurrRetryRate<20) && (priv->LastRetryRate<21)) //TO DO: need to consider (RSSI)
+		} else if ( (CurrRetryRate<20) && (priv->LastRetryRate<21)) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<40) && (priv->LastRetryRate<41))
-		{
 			bTryUp = true;
 		}
 
 		if(bTryDown && (CurrSignalStrength < -82))
-		{
 			priv->TryDownCountLowData += TryDownTh;
-		}
+
 		//printk("case7---24M \n");
-	}
-	else if ( priv->CurrentOperaRate == 36 )
-	{
+	} else if ( priv->CurrentOperaRate == 36 ) {
 		//2For 18Mbps
 		// original (109, 109)
 		//[TRC Dell Lab] (90, 91), Isaiah 2008-02-18 23:24
 		//			     (85, 86), Isaiah 2008-02-18 24:00
-		if ( ((CurrRetryRate>85) && (priv->LastRetryRate>86)))
+		if ( ((CurrRetryRate>85) && (priv->LastRetryRate>86))) {
 //		if ( ((CurrRetryRate>115) && (priv->LastRetryRate>116)))
-		{
 			//Down to rate 11Mbps.
 			bTryDown = true;
-		}
-		//[TRC Dell Lab]  Isaiah 2008-02-18 23:24
-		else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 ))
+
+		  //[TRC Dell Lab]  Isaiah 2008-02-18 23:24
+		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) { 
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
-		{
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		}
-		else if ( (CurrRetryRate<22) && (priv->LastRetryRate<23)) //TO DO: need to consider (RSSI)
+		} else if ( (CurrRetryRate<22) && (priv->LastRetryRate<23)) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<42) && (priv->LastRetryRate<43))
-		{
 			bTryUp = true;
 		}
 		//printk("case8---18M \n");
-	}
-	else if ( priv->CurrentOperaRate == 22 )
-	{
+	} else if ( priv->CurrentOperaRate == 22 ) {
 		//2For 11Mbps
-		if (CurrRetryRate>95)
+		if (CurrRetryRate>95) {
 //		if (CurrRetryRate>155)
-		{
 			bTryDown = true;
 		}
-		else if ( (CurrRetryRate<29) && (priv->LastRetryRate <30) )//TO DO: need to consider (RSSI)
+		else if ( (CurrRetryRate<29) && (priv->LastRetryRate <30) ) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<49) && (priv->LastRetryRate <50) )
-			{
 			bTryUp = true;
-			}
-		//printk("case9---11M \n");
 		}
-	else if ( priv->CurrentOperaRate == 11 )
-	{
+		//printk("case9---11M \n");
+	} else if ( priv->CurrentOperaRate == 11 ) {
 		//2For 5.5Mbps
-		if (CurrRetryRate>149)
+		if (CurrRetryRate>149) {
 //		if (CurrRetryRate>189)
-		{
 			bTryDown = true;
-		}
-		else if ( (CurrRetryRate<60) && (priv->LastRetryRate < 65))
+		} else if ( (CurrRetryRate<60) && (priv->LastRetryRate < 65)) {
 //		else if ( (CurrRetryRate<80) && (priv->LastRetryRate < 85))
-
-			{
 			bTryUp = true;
-			}
-		//printk("case10---5.5M \n");
 		}
-	else if ( priv->CurrentOperaRate == 4 )
-	{
+		//printk("case10---5.5M \n");
+	} else if ( priv->CurrentOperaRate == 4 ) {
 		//2For 2 Mbps
-		if((CurrRetryRate>99) && (priv->LastRetryRate>99))
+		if((CurrRetryRate>99) && (priv->LastRetryRate>99)) {
 //		if((CurrRetryRate>199) && (priv->LastRetryRate>199))
-		{
 			bTryDown = true;
-		}
-		else if ( (CurrRetryRate < 65) && (priv->LastRetryRate < 70))
+		} else if ( (CurrRetryRate < 65) && (priv->LastRetryRate < 70)) {
 //		else if ( (CurrRetryRate < 85) && (priv->LastRetryRate < 90))
-		{
 			bTryUp = true;
 		}
 		//printk("case11---2M \n");
-	}
-	else if ( priv->CurrentOperaRate == 2 )
-	{
+	} else if ( priv->CurrentOperaRate == 2 ) {
 		//2For 1 Mbps
-		if( (CurrRetryRate<70) && (priv->LastRetryRate<75))
+		if( (CurrRetryRate<70) && (priv->LastRetryRate<75)) {
 //		if( (CurrRetryRate<90) && (priv->LastRetryRate<95))
-		{
 			bTryUp = true;
 		}
 		//printk("case12---1M \n");
@@ -948,10 +827,8 @@ StaRateAdaptive87SE(
 	// Sometimes the cause of the low throughput (high retry rate) is the compatibility between the AP and NIC.
 	// To test if the upper rate may cause lower retry rate, this mechanism randomly occurs to test upgrading tx rate.
 	if(!bTryUp && !bTryDown && (priv->TryupingCount == 0) && (priv->TryDownCountLowData == 0)
-		&& priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate && priv->FailTxRateCount < 2)
-	{
-		if(jiffies% (CurrRetryRate + 101) == 0)
-		{
+		&& priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate && priv->FailTxRateCount < 2) {
+		if(jiffies% (CurrRetryRate + 101) == 0) {
 			bTryUp = true;
 			priv->bTryuping = true;
 			//printk("StaRateAdaptive87SE(): Randomly try upgrading...\n");
@@ -959,18 +836,14 @@ StaRateAdaptive87SE(
 	}
 
 	//1 Rate Mechanism
-	if(bTryUp)
-	{
+	if(bTryUp) {
 		priv->TryupingCount++;
 		priv->TryDownCountLowData = 0;
 
-		{
 //			printk("UP: pHalData->TryupingCount = %d\n", priv->TryupingCount);
 //			printk("UP: TryUpTh(%d)+ (FailTxRateCount(%d))^2 =%d\n",
 //				TryUpTh, priv->FailTxRateCount, (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount) );
-//			printk("UP: pHalData->bTryuping=%d\n",  priv->bTryuping);
-
-		}
+//			printk("UP: pHalData->bTryuping=%d\n",  priv->bTryuping);}
 
 		//
 		// Check more times if we need to upgrade indeed.
@@ -980,8 +853,7 @@ StaRateAdaptive87SE(
 		//
 
 		if((priv->TryupingCount > (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount)) ||
-			(CurrSignalStrength > priv->LastFailTxRateSS) || priv->bTryuping)
-		{
+			(CurrSignalStrength > priv->LastFailTxRateSS) || priv->bTryuping) {
 			priv->TryupingCount = 0;
 			//
 			// When transferring from CCK to OFDM, DIG is an important issue.
@@ -1003,61 +875,48 @@ StaRateAdaptive87SE(
 //			printk("StaRateAdaptive87SE(): Upgrade Tx Rate to %d\n", priv->CurrentOperaRate);
 
 			//[TRC Dell Lab] Bypass 12/9/6, Isaiah 2008-02-18 20:00
-			if(priv->CurrentOperaRate ==36)
-			{
+			if(priv->CurrentOperaRate ==36) {
 				priv->bUpdateARFR=true;
 				write_nic_word(dev, ARFR, 0x0F8F); //bypass 12/9/6
 //				printk("UP: ARFR=0xF8F\n");
-			}
-			else if(priv->bUpdateARFR)
-			{
+			} else if(priv->bUpdateARFR) {
 				priv->bUpdateARFR=false;
 				write_nic_word(dev, ARFR, 0x0FFF); //set 1M ~ 54Mbps.
 //				printk("UP: ARFR=0xFFF\n");
 			}
 
 			// Update Fail Tx rate and count.
-			if(priv->LastFailTxRate != priv->CurrentOperaRate)
-			{
+			if(priv->LastFailTxRate != priv->CurrentOperaRate) {
 				priv->LastFailTxRate = priv->CurrentOperaRate;
 				priv->FailTxRateCount = 0;
 				priv->LastFailTxRateSS = -200; // Set lowest power.
 			}
 		}
-	}
-	else
-	{
+	} else {
 		if(priv->TryupingCount > 0)
 			priv->TryupingCount --;
 	}
 
-	if(bTryDown)
-	{
+	if(bTryDown) {
 		priv->TryDownCountLowData++;
 		priv->TryupingCount = 0;
-		{
+
 //			printk("DN: pHalData->TryDownCountLowData = %d\n",priv->TryDownCountLowData);
 //			printk("DN: TryDownTh =%d\n", TryDownTh);
 //			printk("DN: pHalData->bTryuping=%d\n",  priv->bTryuping);
-		}
+
 
 		//Check if Tx rate can be degraded or Test trying upgrading should fallback.
-		if(priv->TryDownCountLowData > TryDownTh || priv->bTryuping)
-		{
+		if(priv->TryDownCountLowData > TryDownTh || priv->bTryuping) {
 			priv->TryDownCountLowData = 0;
 			priv->bTryuping = false;
 			// Update fail information.
-			if(priv->LastFailTxRate == priv->CurrentOperaRate)
-			{
+			if(priv->LastFailTxRate == priv->CurrentOperaRate) {
 				priv->FailTxRateCount ++;
 				// Record the Tx fail rate signal strength.
 				if(CurrSignalStrength > priv->LastFailTxRateSS)
-				{
 					priv->LastFailTxRateSS = CurrSignalStrength;
-				}
-			}
-			else
-			{
+			} else {
 				priv->LastFailTxRate = priv->CurrentOperaRate;
 				priv->FailTxRateCount = 1;
 				priv->LastFailTxRateSS = CurrSignalStrength;
@@ -1066,21 +925,17 @@ StaRateAdaptive87SE(
 
 			// Reduce chariot training time at weak signal strength situation. SD3 ED demand.
 			//[TRC Dell Lab] Revise Signal Threshold from -75 to -80 , Isaiah 2008-02-18 20:00
-			if( (CurrSignalStrength < -80) && (priv->CurrentOperaRate > 72 ))
-			{
+			if( (CurrSignalStrength < -80) && (priv->CurrentOperaRate > 72 )) {
 				priv->CurrentOperaRate = 72;
 //				printk("DN: weak signal strength (%d), degrade to 36Mbps\n", CurrSignalStrength);
 			}
 
 			//[TRC Dell Lab] Bypass 12/9/6, Isaiah 2008-02-18 20:00
-			if(priv->CurrentOperaRate ==36)
-			{
+			if(priv->CurrentOperaRate ==36) {
 				priv->bUpdateARFR=true;
 				write_nic_word(dev, ARFR, 0x0F8F); //bypass 12/9/6
 //				printk("DN: ARFR=0xF8F\n");
-			}
-			else if(priv->bUpdateARFR)
-			{
+			} else if(priv->bUpdateARFR) {
 				priv->bUpdateARFR=false;
 				write_nic_word(dev, ARFR, 0x0FFF); //set 1M ~ 54Mbps.
 //				printk("DN: ARFR=0xFFF\n");
@@ -1089,15 +944,12 @@ StaRateAdaptive87SE(
 			//
 			// When it is CCK rate, it may need to update initial gain to receive lower power packets.
 			//
-			if(MgntIsCckRate(priv->CurrentOperaRate))
-			{
+			if(MgntIsCckRate(priv->CurrentOperaRate)) {
 				bUpdateInitialGain = true;
 			}
 //			printk("StaRateAdaptive87SE(): Degrade Tx Rate to %d\n", priv->CurrentOperaRate);
 		}
-	}
-	else
-	{
+	} else {
 		if(priv->TryDownCountLowData > 0)
 			priv->TryDownCountLowData --;
 	}
@@ -1105,8 +957,7 @@ StaRateAdaptive87SE(
 	// Keep the Tx fail rate count to equal to 0x15 at most.
 	// Reduce the fail count at least to 10 sec if tx rate is tending stable.
 	if(priv->FailTxRateCount >= 0x15 ||
-		(!bTryUp && !bTryDown && priv->TryDownCountLowData == 0 && priv->TryupingCount && priv->FailTxRateCount > 0x6))
-	{
+		(!bTryUp && !bTryDown && priv->TryDownCountLowData == 0 && priv->TryupingCount && priv->FailTxRateCount > 0x6)) {
 		priv->FailTxRateCount --;
 	}
 
@@ -1115,49 +966,39 @@ StaRateAdaptive87SE(
 	CckTxPwrIdx  = priv->chtxpwr[priv->ieee80211->current_network.channel];
 
 	//[TRC Dell Lab] Mac0x9e increase 2 level in 36M~18M situation, Isaiah 2008-02-18 24:00
-	if((priv->CurrentOperaRate < 96) &&(priv->CurrentOperaRate > 22))
-	{
+	if((priv->CurrentOperaRate < 96) &&(priv->CurrentOperaRate > 22)) {
 		u1bCck = read_nic_byte(dev, CCK_TXAGC);
 		u1bOfdm = read_nic_byte(dev, OFDM_TXAGC);
 
 		// case 1: Never enter High power
-		if(u1bCck == CckTxPwrIdx )
-		{
-			if(u1bOfdm != (OfdmTxPwrIdx+2) )
-			{
+		if(u1bCck == CckTxPwrIdx ) {
+			if(u1bOfdm != (OfdmTxPwrIdx+2) ) {
 			priv->bEnhanceTxPwr= true;
 			u1bOfdm = ((u1bOfdm+2) > 35) ? 35: (u1bOfdm+2);
 			write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
 //			printk("Enhance OFDM_TXAGC : +++++ u1bOfdm= 0x%x\n", u1bOfdm);
 			}
-		}
+		} else if(u1bCck < CckTxPwrIdx) {
 		// case 2: enter high power
-		else if(u1bCck < CckTxPwrIdx)
-		{
-			if(!priv->bEnhanceTxPwr)
-			{
+			if(!priv->bEnhanceTxPwr) {
 				priv->bEnhanceTxPwr= true;
 				u1bOfdm = ((u1bOfdm+2) > 35) ? 35: (u1bOfdm+2);
 				write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
 				//RT_TRACE(COMP_RATE, DBG_TRACE, ("Enhance OFDM_TXAGC(2) : +++++ u1bOfdm= 0x%x\n", u1bOfdm));
 			}
 		}
-	}
-	else if(priv->bEnhanceTxPwr)  //54/48/11/5.5/2/1
-	{
+	} else if(priv->bEnhanceTxPwr) {  //54/48/11/5.5/2/1
 		u1bCck = read_nic_byte(dev, CCK_TXAGC);
 		u1bOfdm = read_nic_byte(dev, OFDM_TXAGC);
 
 		// case 1: Never enter High power
-		if(u1bCck == CckTxPwrIdx )
-		{
+		if(u1bCck == CckTxPwrIdx ) {
 		priv->bEnhanceTxPwr= false;
 		write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
 		//printk("Recover OFDM_TXAGC : ===== u1bOfdm= 0x%x\n", OfdmTxPwrIdx);
 		}
 		// case 2: enter high power
-		else if(u1bCck < CckTxPwrIdx)
-		{
+		else if(u1bCck < CckTxPwrIdx) {
 			priv->bEnhanceTxPwr= false;
 			u1bOfdm = ((u1bOfdm-2) > 0) ? (u1bOfdm-2): 0;
 			write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
@@ -1171,35 +1012,26 @@ StaRateAdaptive87SE(
 	// "from CCK to OFDM".
 	//
 SetInitialGain:
-	if(bUpdateInitialGain)
-	{
-		if(MgntIsCckRate(priv->CurrentOperaRate)) // CCK
-		{
-			if(priv->InitialGain > priv->RegBModeGainStage)
-			{
+	if(bUpdateInitialGain) {
+		if(MgntIsCckRate(priv->CurrentOperaRate)) { // CCK
+			if(priv->InitialGain > priv->RegBModeGainStage) {
 				priv->InitialGainBackUp= priv->InitialGain;
 
 				if(CurrSignalStrength < -85) // Low power, OFDM [0x17] = 26.
-				{
 					//SD3 SYs suggest that CurrSignalStrength < -65, ofdm 0x17=26.
 					priv->InitialGain = priv->RegBModeGainStage;
-				}
+
 				else if(priv->InitialGain > priv->RegBModeGainStage + 1)
-				{
 					priv->InitialGain -= 2;
-				}
-				else
-				{
+
+				else 
 					priv->InitialGain --;
-				}
+
 				printk("StaRateAdaptive87SE(): update init_gain to index %d for date rate %d\n",priv->InitialGain, priv->CurrentOperaRate);
 				UpdateInitialGain(dev);
 			}
-		}
-		else // OFDM
-		{
-			if(priv->InitialGain < 4)
-			{
+		} else { // OFDM
+			if(priv->InitialGain < 4) {
 				priv->InitialGainBackUp= priv->InitialGain;
 
 				priv->InitialGain ++;
@@ -1229,15 +1061,13 @@ void timer_rate_adaptive(unsigned long data)
 {
 	struct r8180_priv* priv = ieee80211_priv((struct net_device *)data);
 	//DMESG("---->timer_rate_adaptive()\n");
-	if(!priv->up)
-	{
+	if(!priv->up) {
 //		DMESG("<----timer_rate_adaptive():driver is not up!\n");
 		return;
 	}
 	if((priv->ieee80211->iw_mode != IW_MODE_MASTER)
 			&& (priv->ieee80211->state == IEEE80211_LINKED) &&
-			(priv->ForcedDataRate == 0) )
-	{
+			(priv->ForcedDataRate == 0) ) {
 //	DMESG("timer_rate_adaptive():schedule rate_adapter_wq\n");
 		queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->rate_adapter_wq);
 //		StaRateAdaptive87SE((struct net_device *)data);
@@ -1259,12 +1089,9 @@ SwAntennaDiversityRxOk8185(
 
 	priv->AdRxOkCnt++;
 
-	if( priv->AdRxSignalStrength != -1)
-	{
+	if( priv->AdRxSignalStrength != -1) {
 		priv->AdRxSignalStrength = ((priv->AdRxSignalStrength*7) + (SignalStrength*3)) / 10;
-	}
-	else
-	{ // Initialization case.
+	} else { // Initialization case.
 		priv->AdRxSignalStrength = SignalStrength;
 	}
 //{+by amy 080312
@@ -1290,8 +1117,7 @@ SetAntenna8185(
 
 //	printk("+SetAntenna8185(): Antenna is switching to: %d \n", u1bAntennaIndex);
 
-	switch(u1bAntennaIndex)
-	{
+	switch(u1bAntennaIndex) {
 	case 0:
 		/* Mac register, main antenna */
 		write_nic_byte(dev, ANTSEL, 0x03);
@@ -1319,9 +1145,7 @@ SetAntenna8185(
 	}
 
 	if(bAntennaSwitched)
-	{
 		priv->CurrAntennaIndex = u1bAntennaIndex;
-	}
 
 //	printk("-SetAntenna8185(): return (%#X)\n", bAntennaSwitched);
 
@@ -1340,15 +1164,12 @@ SwitchAntenna(
 
 	bool		bResult;
 
-	if(priv->CurrAntennaIndex == 0)
-	{
+	if(priv->CurrAntennaIndex == 0) {
 			bResult = SetAntenna8185(dev, 1);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 1 ......\n");
 //		bResult = SetAntenna8185(dev, 1);//-by amy 080312
-	}
-	else
-	{
+	} else {
 			bResult = SetAntenna8185(dev, 0);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 0 ......\n");
@@ -1375,8 +1196,7 @@ SwAntennaDiversity(
 //	printk("+SwAntennaDiversity(): CurrAntennaIndex: %d\n", priv->CurrAntennaIndex);
 //	printk("AdTickCount is %d\n",priv->AdTickCount);
 //by amy 080312
-	if(bSwCheckSS)
-	{
+	if(bSwCheckSS) {
 		priv->AdTickCount++;
 
 		printk("(1) AdTickCount: %d, AdCheckPeriod: %d\n",
@@ -1387,25 +1207,22 @@ SwAntennaDiversity(
 //	priv->AdTickCount++;//-by amy 080312
 
 	// Case 1. No Link.
-	if(priv->ieee80211->state != IEEE80211_LINKED)
-	{
+	if(priv->ieee80211->state != IEEE80211_LINKED) {
 	//	printk("SwAntennaDiversity(): Case 1. No Link.\n");
 
 		priv->bAdSwitchedChecking = false;
 		// I switch antenna here to prevent any one of antenna is broken before link established, 2006.04.18, by rcnjko..
 		SwitchAntenna(dev);
-	}
-	// Case 2. Linked but no packet received.
-	else if(priv->AdRxOkCnt == 0)
-	{
+
+	  // Case 2. Linked but no packet receive.d
+	} else if(priv->AdRxOkCnt == 0) {
 	//	printk("SwAntennaDiversity(): Case 2. Linked but no packet received.\n");
 
 		priv->bAdSwitchedChecking = false;
 		SwitchAntenna(dev);
-	}
-	// Case 3. Evaluate last antenna switch action and undo it if necessary.
-	else if(priv->bAdSwitchedChecking == true)
-	{
+
+	  // Case 3. Evaluate last antenna switch action and undo it if necessary.
+	} else if(priv->bAdSwitchedChecking == true) {
 	//	printk("SwAntennaDiversity(): Case 3. Evaluate last antenna switch action.\n");
 
 		priv->bAdSwitchedChecking = false;
@@ -1415,8 +1232,8 @@ SwAntennaDiversity(
 
 		priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ?
 					priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold;
-		if(priv->AdRxSignalStrength < priv->AdRxSsBeforeSwitched)
-		{ // Rx signal strength is not improved after we swtiched antenna. => Swich back.
+		if(priv->AdRxSignalStrength < priv->AdRxSsBeforeSwitched) {
+		// Rx signal strength is not improved after we swtiched antenna. => Swich back.
 //			printk("SwAntennaDiversity(): Rx Signal Strength is not improved, CurrRxSs: %d, LastRxSs: %d\n",
 //				priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched);
 //by amy 080312
@@ -1429,9 +1246,8 @@ SwAntennaDiversity(
 
 			// Wrong deceision => switch back.
 			SwitchAntenna(dev);
-		}
-		else
-		{ // Rx Signal Strength is improved.
+		} else { 
+		// Rx Signal Strength is improved.
 //			printk("SwAntennaDiversity(): Rx Signal Strength is improved, CurrRxSs: %d, LastRxSs: %d\n",
 //				priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched);
 
@@ -1444,8 +1260,7 @@ SwAntennaDiversity(
 	}
 	// Case 4. Evaluate if we shall switch antenna now.
 	// Cause Table Speed is very fast in TRC Dell Lab, we check it every time.
-	else// if(priv->AdTickCount >= priv->AdCheckPeriod)//-by amy 080312
-	{
+	else { // if(priv->AdTickCount >= priv->AdCheckPeriod)//-by amy 080312
 //		printk("SwAntennaDiversity(): Case 4. Evaluate if we shall switch antenna now.\n");
 
 		priv->AdTickCount = 0;
@@ -1463,8 +1278,8 @@ SwAntennaDiversity(
 		// Added by Roger, 2008.02.21.
 //{by amy 080312
 		if((priv->AdMainAntennaRxOkCnt < priv->AdAuxAntennaRxOkCnt)
-			&& (priv->CurrAntennaIndex == 0))
-		{ // We set Main antenna as default but RxOk count was less than Aux ones.
+			&& (priv->CurrAntennaIndex == 0)) {
+		// We set Main antenna as default but RxOk count was less than Aux ones.
 
 	//		printk("SwAntennaDiversity(): Main antenna RxOK is poor, AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",
 	//			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt);
@@ -1472,10 +1287,9 @@ SwAntennaDiversity(
 			// Switch to Aux antenna.
 			SwitchAntenna(dev);
 			priv->bHWAdSwitched = true;
-		}
-		else if((priv->AdAuxAntennaRxOkCnt < priv->AdMainAntennaRxOkCnt)
-			&& (priv->CurrAntennaIndex == 1))
-		{ // We set Aux antenna as default but RxOk count was less than Main ones.
+		} else if((priv->AdAuxAntennaRxOkCnt < priv->AdMainAntennaRxOkCnt)
+			&& (priv->CurrAntennaIndex == 1)) {
+		// We set Aux antenna as default but RxOk count was less than Main ones.
 
 	//		printk("SwAntennaDiversity(): Aux antenna RxOK is poor, AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",
 	//			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt);
@@ -1483,9 +1297,8 @@ SwAntennaDiversity(
 			// Switch to Main antenna.
 			SwitchAntenna(dev);
 			priv->bHWAdSwitched = true;
-		}
-		else
-		{// Default antenna is better.
+		} else {
+		// Default antenna is better.
 
 	//		printk("SwAntennaDiversity(): Default antenna is better., AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",
 	//			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt);
@@ -1504,12 +1317,11 @@ SwAntennaDiversity(
 		// Our guess is that main antenna have lower throughput and get many change
 		// to receive more CCK packets(ex.Beacon) which have stronger SignalStrength.
 		//
-		if( (!priv->bHWAdSwitched) && (bSwCheckSS))
-		{
+		if( (!priv->bHWAdSwitched) && (bSwCheckSS)) {
 //by amy 080312}
 		// Evaluate Rx signal strength if we shall switch antenna now.
-		if(priv->AdRxSignalStrength < priv->AdRxSsThreshold)
-		{ // Rx signal strength is weak => Switch Antenna.
+		if(priv->AdRxSignalStrength < priv->AdRxSsThreshold) {
+		// Rx signal strength is weak => Switch Antenna.
 //			printk("SwAntennaDiversity(): Rx Signal Strength is weak, CurrRxSs: %d, RxSsThreshold: %d\n",
 //				priv->AdRxSignalStrength, priv->AdRxSsThreshold);
 
@@ -1517,17 +1329,16 @@ SwAntennaDiversity(
 			priv->bAdSwitchedChecking = true;
 
 			SwitchAntenna(dev);
-		}
-		else
-		{ // Rx signal strength is OK.
+		} else {
+		// Rx signal strength is OK.
 //			printk("SwAntennaDiversity(): Rx Signal Strength is OK, CurrRxSs: %d, RxSsThreshold: %d\n",
 //				priv->AdRxSignalStrength, priv->AdRxSsThreshold);
 
 			priv->bAdSwitchedChecking = false;
 			// Increase Rx signal strength threshold if necessary.
 			if(	(priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && // Signal is much stronger than current threshold
-				priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) // Current threhold is not yet reach upper limit.
-			{
+				priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) { // Current threhold is not yet reach upper limit.
+
 				priv->AdRxSsThreshold = (priv->AdRxSsThreshold + priv->AdRxSignalStrength) / 2;
 				priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ?
 												priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold;//+by amy 080312
@@ -1535,9 +1346,7 @@ SwAntennaDiversity(
 
 			// Reduce Antenna Diversity checking period if possible.
 			if( priv->AdCheckPeriod > priv->AdMinCheckPeriod )
-			{
 				priv->AdCheckPeriod /= 2;
-			}
 		}
 		}
 	}
@@ -1563,9 +1372,7 @@ CheckTxPwrTracking(	struct net_device *dev)
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
 	if(!priv->bTxPowerTrack)
-	{
 		return false;
-	}
 
 //lzm reserved 080826
 	//if(priv->bScanInProgress)
@@ -1575,9 +1382,7 @@ CheckTxPwrTracking(	struct net_device *dev)
 
 	//if 87SE is in High Power , don't do Tx Power Tracking. asked by SD3 ED. 2008-08-08 Isaiah
 	if(priv->bToUpdateTxPwr)
-	{
 		return false;
-	}
 
 	return true;
 }
@@ -1602,24 +1407,20 @@ SwAntennaDiversityTimerCallback(
 	// 2007.05.09, added by Roger.
 	//
 	rtState = priv->eRFPowerState;
-	do{
-		if (rtState == eRfOff)
-		{
+	do {
+		if (rtState == eRfOff) {
 //			printk("SwAntennaDiversityTimer - RF is OFF.\n");
 			break;
-		}
-		else if (rtState == eRfSleep)
-		{
+		} else if (rtState == eRfSleep) {
 			// Don't access BB/RF under Disable PLL situation.
 			//RT_TRACE((COMP_RF|COMP_ANTENNA), DBG_LOUD, ("SwAntennaDiversityTimerCallback(): RF is Sleep => skip it\n"));
 			break;
 		}
 		SwAntennaDiversity(dev);
 
-	}while(false);
+	} while(false);
 
-	if(priv->up)
-	{
+	if(priv->up) {
 		priv->SwAntennaDiversityTimer.expires = jiffies + MSECS(ANTENNA_DIVERSITY_TIMER_PERIOD);
 		add_timer(&priv->SwAntennaDiversityTimer);
 	}
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] Staging: rtl8187se: r8180_dm.c Fixed indentation issues
  2012-03-15 19:05 [PATCH 0/5] Staging: rtl8187se: r8180_dm.c: Fix Coding Style issues Andrew Miller
  2012-03-15 19:05 ` [PATCH 1/5] Staging: rtl8187se: r8180_dm.c: Removed spaces before tab stop Andrew Miller
  2012-03-15 19:05 ` [PATCH 2/5] Staging: rtl8187se: r8180_dm.c: Fix brackets Andrew Miller
@ 2012-03-15 19:05 ` Andrew Miller
  2012-03-15 19:05 ` [PATCH 4/5] Staging: rtl8187se: r8180_dm.c: Fix spacing issues Andrew Miller
  2012-03-15 19:05 ` [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments Andrew Miller
  4 siblings, 0 replies; 11+ messages in thread
From: Andrew Miller @ 2012-03-15 19:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, amiller

Fixed indentation issues and converted spaces,
that were being use for indentation, to tabs

Signed-off-by: Andrew Miller <amiller@amilx.com>
---
 drivers/staging/rtl8187se/r8180_dm.c |  418 +++++++++++++++++-----------------
 1 files changed, 209 insertions(+), 209 deletions(-)

diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c
index 97e4fef..bd2cf4a 100644
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -75,12 +75,12 @@ DoTxHighPower(
 
 		// If it never enter High Power.
 		if( CckTxPwrIdx == u1bTmp) {
-		u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  // 8dbm
-		write_nic_byte(dev, CCK_TXAGC, u1bTmp);
+			u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  // 8dbm
+			write_nic_byte(dev, CCK_TXAGC, u1bTmp);
 
-		u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
-		u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  // 8dbm
-		write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
+			u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
+			u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  // 8dbm
+			write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
 		}
 
 	} else if((priv->UndecoratedSmoothedSS < HiPwrLowerTh) &&
@@ -91,16 +91,16 @@ DoTxHighPower(
 			//SD3 required.
 			u1bTmp= read_nic_byte(dev, CCK_TXAGC);
 			if(u1bTmp < CckTxPwrIdx) {
-			//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
-			//write_nic_byte(dev, CCK_TXAGC, u1bTmp);
-			write_nic_byte(dev, CCK_TXAGC, CckTxPwrIdx);
+				//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
+				//write_nic_byte(dev, CCK_TXAGC, u1bTmp);
+				write_nic_byte(dev, CCK_TXAGC, CckTxPwrIdx);
 			}
 
 			u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
 			if(u1bTmp < OfdmTxPwrIdx) {
-			//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
-			//write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
-			write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
+				//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
+				//write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
+				write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
 			}
 		}
 	}
@@ -121,8 +121,8 @@ void rtl8180_tx_pw_wq (struct work_struct *work)
 //      struct ieee80211_device * ieee = (struct ieee80211_device*)
 //                                             container_of(work, struct ieee80211_device, watch_dog_wq);
 	struct delayed_work *dwork = to_delayed_work(work);
-        struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,tx_pw_wq);
-        struct net_device *dev = ieee->dev;
+	struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,tx_pw_wq);
+	struct net_device *dev = ieee->dev;
 
 //	printk("----> UpdateTxPowerWorkItemCallback()\n");
 
@@ -181,7 +181,7 @@ DIG_Zebra(
 //	printk("DIG**********CCK False Alarm: %#X \n",CCKFalseAlarm);
 //	printk("DIG**********OFDM False Alarm: %#X \n",OFDMFalseAlarm);
 
-        // The number of initial gain steps is different, by Bruce, 2007-04-13.
+	// The number of initial gain steps is different, by Bruce, 2007-04-13.
 	if (priv->InitialGain == 0 ) { //autoDIG
 		// Advised from SD3 DZ
 		priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm)
@@ -265,8 +265,8 @@ DynamicInitGain(struct net_device *dev)
 void rtl8180_hw_dig_wq (struct work_struct *work)
 {
 	struct delayed_work *dwork = to_delayed_work(work);
-        struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_dig_wq);
-        struct net_device *dev = ieee->dev;
+	struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_dig_wq);
+	struct net_device *dev = ieee->dev;
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
 	// Read CCK and OFDM False Alarm.
@@ -280,33 +280,33 @@ void rtl8180_hw_dig_wq (struct work_struct *work)
 
 int
 IncludedInSupportedRates(
-        struct r8180_priv       *priv,
-        u8              TxRate  )
+	struct r8180_priv       *priv,
+	u8              TxRate  )
 {
-    u8 rate_len;
-        u8 rate_ex_len;
-        u8                      RateMask = 0x7F;
-        u8                      idx;
-        unsigned short          Found = 0;
-        u8                      NaiveTxRate = TxRate&RateMask;
-
-    rate_len = priv->ieee80211->current_network.rates_len;
-        rate_ex_len = priv->ieee80211->current_network.rates_ex_len;
-        for( idx=0; idx< rate_len; idx++ ) {
-                if( (priv->ieee80211->current_network.rates[idx] & RateMask) == NaiveTxRate ) {
-                        Found = 1;
-                        goto found_rate;
-                }
-        }
-    for( idx=0; idx< rate_ex_len; idx++ ) {
-                if( (priv->ieee80211->current_network.rates_ex[idx] & RateMask) == NaiveTxRate ) {
-                        Found = 1;
-                        goto found_rate;
-                }
-        }
-        return Found;
-        found_rate:
-        return Found;
+	u8 rate_len;
+	u8 rate_ex_len;
+	u8                      RateMask = 0x7F;
+	u8                      idx;
+	unsigned short          Found = 0;
+	u8                      NaiveTxRate = TxRate&RateMask;
+
+	rate_len = priv->ieee80211->current_network.rates_len;
+	rate_ex_len = priv->ieee80211->current_network.rates_ex_len;
+	for( idx=0; idx< rate_len; idx++ ) {
+		if( (priv->ieee80211->current_network.rates[idx] & RateMask) == NaiveTxRate ) {
+			Found = 1;
+			goto found_rate;
+		}
+	}
+	for( idx=0; idx< rate_ex_len; idx++ ) {
+		if( (priv->ieee80211->current_network.rates_ex[idx] & RateMask) == NaiveTxRate ) {
+			Found = 1;
+			goto found_rate;
+		}
+	}
+	return Found;
+	found_rate:
+	return Found;
 }
 
 //
@@ -317,64 +317,64 @@ IncludedInSupportedRates(
 //
 u8
 GetUpgradeTxRate(
-        struct net_device *dev,
-        u8                              rate
-        )
+	struct net_device *dev,
+	u8                              rate
+	)
 {
-        struct r8180_priv *priv = ieee80211_priv(dev);
-        u8                      UpRate;
-
-        // Upgrade 1 degree.
-        switch(rate) {
-        case 108: // Up to 54Mbps.
-                UpRate = 108;
-                break;
-
-        case 96: // Up to 54Mbps.
-                UpRate = 108;
-                break;
-
-        case 72: // Up to 48Mbps.
-                UpRate = 96;
-                break;
-
-        case 48: // Up to 36Mbps.
-                UpRate = 72;
-                break;
-
-        case 36: // Up to 24Mbps.
-                UpRate = 48;
-                break;
-
-        case 22: // Up to 18Mbps.
-                UpRate = 36;
-                break;
-
-        case 11: // Up to 11Mbps.
-                UpRate = 22;
-                break;
-
-        case 4: // Up to 5.5Mbps.
-                UpRate = 11;
-                break;
-
-        case 2: // Up to 2Mbps.
-                UpRate = 4;
-                break;
-
-        default:
-                printk("GetUpgradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate);
-                return rate;
-        }
-        // Check if the rate is valid.
-        if(IncludedInSupportedRates(priv, UpRate)) {
+	struct r8180_priv *priv = ieee80211_priv(dev);
+	u8                      UpRate;
+
+	// Upgrade 1 degree.
+	switch(rate) {
+	case 108: // Up to 54Mbps.
+		UpRate = 108;
+		break;
+
+	case 96: // Up to 54Mbps.
+		UpRate = 108;
+		break;
+
+	case 72: // Up to 48Mbps.
+		UpRate = 96;
+		break;
+
+	case 48: // Up to 36Mbps.
+		UpRate = 72;
+		break;
+
+	case 36: // Up to 24Mbps.
+		UpRate = 48;
+		break;
+
+	case 22: // Up to 18Mbps.
+		UpRate = 36;
+		break;
+
+	case 11: // Up to 11Mbps.
+		UpRate = 22;
+		break;
+
+	case 4: // Up to 5.5Mbps.
+		UpRate = 11;
+		break;
+
+	case 2: // Up to 2Mbps.
+		UpRate = 4;
+		break;
+
+	default:
+		printk("GetUpgradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate);
+		return rate;
+	}
+	// Check if the rate is valid.
+	if(IncludedInSupportedRates(priv, UpRate)) {
 //              printk("GetUpgradeTxRate(): GetUpgrade Tx rate(%d) from %d !\n", UpRate, priv->CurrentOperaRate);
-                return UpRate;
-        } else {
-                //printk("GetUpgradeTxRate(): Tx rate (%d) is not in supported rates\n", UpRate);
-                return rate;
-        }
-        return rate;
+		return UpRate;
+	} else {
+		//printk("GetUpgradeTxRate(): Tx rate (%d) is not in supported rates\n", UpRate);
+		return rate;
+	}
+	return rate;
 }
 //
 //      Description:
@@ -384,64 +384,64 @@ GetUpgradeTxRate(
 //
 u8
 GetDegradeTxRate(
-        struct net_device *dev,
-        u8         rate
-        )
+	struct net_device *dev,
+	u8         rate
+	)
 {
-        struct r8180_priv *priv = ieee80211_priv(dev);
-        u8                      DownRate;
-
-        // Upgrade 1 degree.
-        switch(rate) {
-        case 108: // Down to 48Mbps.
-                DownRate = 96;
-                break;
-
-        case 96: // Down to 36Mbps.
-                DownRate = 72;
-                break;
-
-        case 72: // Down to 24Mbps.
-                DownRate = 48;
-                break;
-
-        case 48: // Down to 18Mbps.
-                DownRate = 36;
-                break;
-
-        case 36: // Down to 11Mbps.
-                DownRate = 22;
-                break;
-
-        case 22: // Down to 5.5Mbps.
-                DownRate = 11;
-                break;
-
-        case 11: // Down to 2Mbps.
-                DownRate = 4;
-                break;
-
-        case 4: // Down to 1Mbps.
-                DownRate = 2;
-                break;
-
-        case 2: // Down to 1Mbps.
-                DownRate = 2;
-                break;
-
-        default:
-                printk("GetDegradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate);
-                return rate;
-        }
-        // Check if the rate is valid.
-        if(IncludedInSupportedRates(priv, DownRate)) {
+	struct r8180_priv *priv = ieee80211_priv(dev);
+	u8                      DownRate;
+
+	// Upgrade 1 degree.
+	switch(rate) {
+	case 108: // Down to 48Mbps.
+		DownRate = 96;
+		break;
+
+	case 96: // Down to 36Mbps.
+		DownRate = 72;
+		break;
+
+	case 72: // Down to 24Mbps.
+		DownRate = 48;
+		break;
+
+	case 48: // Down to 18Mbps.
+		DownRate = 36;
+		break;
+
+	case 36: // Down to 11Mbps.
+		DownRate = 22;
+		break;
+
+	case 22: // Down to 5.5Mbps.
+		DownRate = 11;
+		break;
+
+	case 11: // Down to 2Mbps.
+		DownRate = 4;
+		break;
+
+	case 4: // Down to 1Mbps.
+		DownRate = 2;
+		break;
+
+	case 2: // Down to 1Mbps.
+		DownRate = 2;
+		break;
+
+	default:
+		printk("GetDegradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate);
+		return rate;
+	}
+	// Check if the rate is valid.
+	if(IncludedInSupportedRates(priv, DownRate)) {
 //              printk("GetDegradeTxRate(): GetDegrade Tx rate(%d) from %d!\n", DownRate, priv->CurrentOperaRate);
-                return DownRate;
-        } else {
-                //printk("GetDegradeTxRate(): Tx rate (%d) is not in supported rates\n", DownRate);
-                return rate;
-        }
-        return rate;
+		return DownRate;
+	} else {
+		//printk("GetDegradeTxRate(): Tx rate (%d) is not in supported rates\n", DownRate);
+		return rate;
+	}
+	return rate;
 }
 //
 //      Helper function to determine if specified data rate is
@@ -450,16 +450,16 @@ GetDegradeTxRate(
 //
 bool
 MgntIsCckRate(
-        u16     rate
-        )
+	u16     rate
+	)
 {
-        bool bReturn = false;
+	bool bReturn = false;
 
-        if((rate <= 22) && (rate != 12) && (rate != 18)) {
-                bReturn = true;
-        }
+	if((rate <= 22) && (rate != 12) && (rate != 18)) {
+		bReturn = true;
+	}
 
-        return bReturn;
+	return bReturn;
 }
 //
 //	Description:
@@ -490,7 +490,7 @@ TxPwrTracking87SE(
 			CckTxPwrIdx = priv->chtxpwr[Idx];
 			OfdmTxPwrIdx = priv->chtxpwr_ofdm[Idx];
 
-			if( CurrentThermal > priv->ThermalMeter ) { 
+			if( CurrentThermal > priv->ThermalMeter ) {
 				// higher thermal meter.
 				CckTxPwrIdx += (CurrentThermal - priv->ThermalMeter)*2;
 				OfdmTxPwrIdx += (CurrentThermal - priv->ThermalMeter)*2;
@@ -526,19 +526,19 @@ StaRateAdaptive87SE(
 	)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	unsigned long			CurrTxokCnt;
-	u16			CurrRetryCnt;
-	u16			CurrRetryRate;
-	//u16			i,idx;
-	unsigned long		CurrRxokCnt;
-	bool			bTryUp = false;
-	bool			bTryDown = false;
-	u8			TryUpTh = 1;
-	u8			TryDownTh = 2;
-	u32			TxThroughput;
+	unsigned long	CurrTxokCnt;
+	u16		CurrRetryCnt;
+	u16		CurrRetryRate;
+	//u16		i,idx;
+	unsigned long	CurrRxokCnt;
+	bool		bTryUp = false;
+	bool		bTryDown = false;
+	u8		TryUpTh = 1;
+	u8		TryDownTh = 2;
+	u32		TxThroughput;
 	long		CurrSignalStrength;
 	bool		bUpdateInitialGain = false;
-	u8			u1bOfdm=0, u1bCck = 0;
+	u8		u1bOfdm=0, u1bCck = 0;
 	char		OfdmTxPwrIdx, CckTxPwrIdx;
 
 	priv->RateAdaptivePeriod= RATE_ADAPTIVE_TIMER_PERIOD;
@@ -629,7 +629,7 @@ StaRateAdaptive87SE(
 	// Let these rates down more difficult.
 	//
 	if(MgntIsCckRate(priv->CurrentOperaRate) || priv->CurrentOperaRate == 36)
-			TryDownTh += 1;
+		TryDownTh += 1;
 
 	//1 Adjust Rate.
 	if (priv->bTryuping == true) {
@@ -701,7 +701,7 @@ StaRateAdaptive87SE(
 //		if ( ((CurrRetryRate>65) && (priv->LastRetryRate>64)))
 			//Down to rate 36Mbps.
 			bTryDown = true;
-		} else if ( ((CurrRetryRate>21) && (priv->LastRetryRate>20)) && (CurrSignalStrength > -74)) { //Cable Link	
+		} else if ( ((CurrRetryRate>21) && (priv->LastRetryRate>20)) && (CurrSignalStrength > -74)) { //Cable Link
 			//Down to rate 36Mbps.
 			bTryDown = true;
 		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
@@ -771,7 +771,7 @@ StaRateAdaptive87SE(
 			bTryDown = true;
 
 		  //[TRC Dell Lab]  Isaiah 2008-02-18 23:24
-		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) { 
+		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
@@ -993,9 +993,9 @@ StaRateAdaptive87SE(
 
 		// case 1: Never enter High power
 		if(u1bCck == CckTxPwrIdx ) {
-		priv->bEnhanceTxPwr= false;
-		write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
-		//printk("Recover OFDM_TXAGC : ===== u1bOfdm= 0x%x\n", OfdmTxPwrIdx);
+			priv->bEnhanceTxPwr= false;
+			write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
+			//printk("Recover OFDM_TXAGC : ===== u1bOfdm= 0x%x\n", OfdmTxPwrIdx);
 		}
 		// case 2: enter high power
 		else if(u1bCck < CckTxPwrIdx) {
@@ -1024,7 +1024,7 @@ SetInitialGain:
 				else if(priv->InitialGain > priv->RegBModeGainStage + 1)
 					priv->InitialGain -= 2;
 
-				else 
+				else
 					priv->InitialGain --;
 
 				printk("StaRateAdaptive87SE(): update init_gain to index %d for date rate %d\n",priv->InitialGain, priv->CurrentOperaRate);
@@ -1050,11 +1050,11 @@ SetInitialGain:
 void rtl8180_rate_adapter(struct work_struct * work)
 {
 	struct delayed_work *dwork = to_delayed_work(work);
-        struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,rate_adapter_wq);
-        struct net_device *dev = ieee->dev;
-        //struct r8180_priv *priv = ieee80211_priv(dev);
+	struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,rate_adapter_wq);
+	struct net_device *dev = ieee->dev;
+	//struct r8180_priv *priv = ieee80211_priv(dev);
 //    DMESG("---->rtl8180_rate_adapter");
-        StaRateAdaptive87SE(dev);
+	StaRateAdaptive87SE(dev);
 //   DMESG("<----rtl8180_rate_adapter");
 }
 void timer_rate_adaptive(unsigned long data)
@@ -1165,12 +1165,12 @@ SwitchAntenna(
 	bool		bResult;
 
 	if(priv->CurrAntennaIndex == 0) {
-			bResult = SetAntenna8185(dev, 1);
+		bResult = SetAntenna8185(dev, 1);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 1 ......\n");
 //		bResult = SetAntenna8185(dev, 1);//-by amy 080312
 	} else {
-			bResult = SetAntenna8185(dev, 0);
+		bResult = SetAntenna8185(dev, 0);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 0 ......\n");
 //		bResult = SetAntenna8185(dev, 0);//-by amy 080312
@@ -1246,7 +1246,7 @@ SwAntennaDiversity(
 
 			// Wrong deceision => switch back.
 			SwitchAntenna(dev);
-		} else { 
+		} else {
 		// Rx Signal Strength is improved.
 //			printk("SwAntennaDiversity(): Rx Signal Strength is improved, CurrRxSs: %d, LastRxSs: %d\n",
 //				priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched);
@@ -1319,35 +1319,35 @@ SwAntennaDiversity(
 		//
 		if( (!priv->bHWAdSwitched) && (bSwCheckSS)) {
 //by amy 080312}
-		// Evaluate Rx signal strength if we shall switch antenna now.
-		if(priv->AdRxSignalStrength < priv->AdRxSsThreshold) {
-		// Rx signal strength is weak => Switch Antenna.
-//			printk("SwAntennaDiversity(): Rx Signal Strength is weak, CurrRxSs: %d, RxSsThreshold: %d\n",
+			// Evaluate Rx signal strength if we shall switch antenna now.
+			if(priv->AdRxSignalStrength < priv->AdRxSsThreshold) {
+			// Rx signal strength is weak => Switch Antenna.
+//				printk("SwAntennaDiversity(): Rx Signal Strength is weak, CurrRxSs: %d, RxSsThreshold: %d\n",
 //				priv->AdRxSignalStrength, priv->AdRxSsThreshold);
 
-			priv->AdRxSsBeforeSwitched = priv->AdRxSignalStrength;
-			priv->bAdSwitchedChecking = true;
+				priv->AdRxSsBeforeSwitched = priv->AdRxSignalStrength;
+				priv->bAdSwitchedChecking = true;
 
-			SwitchAntenna(dev);
-		} else {
-		// Rx signal strength is OK.
-//			printk("SwAntennaDiversity(): Rx Signal Strength is OK, CurrRxSs: %d, RxSsThreshold: %d\n",
+				SwitchAntenna(dev);
+			} else {
+			// Rx signal strength is OK.
+//				printk("SwAntennaDiversity(): Rx Signal Strength is OK, CurrRxSs: %d, RxSsThreshold: %d\n",
 //				priv->AdRxSignalStrength, priv->AdRxSsThreshold);
 
-			priv->bAdSwitchedChecking = false;
-			// Increase Rx signal strength threshold if necessary.
-			if(	(priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && // Signal is much stronger than current threshold
-				priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) { // Current threhold is not yet reach upper limit.
+				priv->bAdSwitchedChecking = false;
+				// Increase Rx signal strength threshold if necessary.
+				if(	(priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && // Signal is much stronger than current threshold
+					priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) { // Current threhold is not yet reach upper limit.
 
-				priv->AdRxSsThreshold = (priv->AdRxSsThreshold + priv->AdRxSignalStrength) / 2;
-				priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ?
-												priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold;//+by amy 080312
-			}
+					priv->AdRxSsThreshold = (priv->AdRxSsThreshold + priv->AdRxSignalStrength) / 2;
+					priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ?
+								priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold;//+by amy 080312
+				}
 
-			// Reduce Antenna Diversity checking period if possible.
-			if( priv->AdCheckPeriod > priv->AdMinCheckPeriod )
-				priv->AdCheckPeriod /= 2;
-		}
+				// Reduce Antenna Diversity checking period if possible.
+				if( priv->AdCheckPeriod > priv->AdMinCheckPeriod )
+					priv->AdCheckPeriod /= 2;
+			}
 		}
 	}
 //by amy 080312
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] Staging: rtl8187se: r8180_dm.c: Fix spacing issues
  2012-03-15 19:05 [PATCH 0/5] Staging: rtl8187se: r8180_dm.c: Fix Coding Style issues Andrew Miller
                   ` (2 preceding siblings ...)
  2012-03-15 19:05 ` [PATCH 3/5] Staging: rtl8187se: r8180_dm.c Fixed indentation issues Andrew Miller
@ 2012-03-15 19:05 ` Andrew Miller
  2012-03-15 19:05 ` [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments Andrew Miller
  4 siblings, 0 replies; 11+ messages in thread
From: Andrew Miller @ 2012-03-15 19:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, amiller

Fix spacing around keywords, '*', binary and ternary
operators, and fix the format of statments and function
declaration.

Signed-off-by: Andrew Miller <amiller@amilx.com>
---
 drivers/staging/rtl8187se/r8180_dm.c |  442 +++++++++++++++-------------------
 1 files changed, 197 insertions(+), 245 deletions(-)

diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c
index bd2cf4a..02bffa9 100644
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -36,10 +36,7 @@ bool CheckHighPower(struct net_device *dev)
 //		and they are related to OFDM and MAC registers.
 //		So, we don't want to update it so frequently in per-Rx packet base.
 //
-void
-DoTxHighPower(
-	struct net_device *dev
-	)
+void DoTxHighPower(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u16			HiPwrUpperTh = 0;
@@ -65,7 +62,7 @@ DoTxHighPower(
 
 	//	printk("DoTxHighPower() - UndecoratedSmoothedSS:%d, CurCCKRSSI = %d , bCurCCKPkt= %d \n", priv->UndecoratedSmoothedSS, priv->CurCCKRSSI, priv->bCurCCKPkt );
 
-	if((priv->UndecoratedSmoothedSS > HiPwrUpperTh) ||
+	if ((priv->UndecoratedSmoothedSS > HiPwrUpperTh) ||
 		(priv->bCurCCKPkt && (priv->CurCCKRSSI > RSSIHiPwrUpperTh))) {
 		// Stevenl suggested that degrade 8dbm in high power sate. 2007-12-04 Isaiah
 
@@ -74,7 +71,7 @@ DoTxHighPower(
 		u1bTmp= read_nic_byte(dev, CCK_TXAGC);
 
 		// If it never enter High Power.
-		if( CckTxPwrIdx == u1bTmp) {
+		if (CckTxPwrIdx == u1bTmp) {
 			u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  // 8dbm
 			write_nic_byte(dev, CCK_TXAGC, u1bTmp);
 
@@ -83,21 +80,21 @@ DoTxHighPower(
 			write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
 		}
 
-	} else if((priv->UndecoratedSmoothedSS < HiPwrLowerTh) &&
+	} else if ((priv->UndecoratedSmoothedSS < HiPwrLowerTh) &&
 		(!priv->bCurCCKPkt || priv->CurCCKRSSI < RSSIHiPwrLowerTh)) {
 	//	 printk("DoTxHighPower() - lower Power - UndecoratedSmoothedSS:%d,  HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrLowerTh );
-		if(priv->bToUpdateTxPwr) {
+		if (priv->bToUpdateTxPwr) {
 			priv->bToUpdateTxPwr = false;
 			//SD3 required.
 			u1bTmp= read_nic_byte(dev, CCK_TXAGC);
-			if(u1bTmp < CckTxPwrIdx) {
+			if (u1bTmp < CckTxPwrIdx) {
 				//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
 				//write_nic_byte(dev, CCK_TXAGC, u1bTmp);
 				write_nic_byte(dev, CCK_TXAGC, CckTxPwrIdx);
 			}
 
 			u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
-			if(u1bTmp < OfdmTxPwrIdx) {
+			if (u1bTmp < OfdmTxPwrIdx) {
 				//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
 				//write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
 				write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
@@ -115,7 +112,7 @@ DoTxHighPower(
 //		Because of some event happened, e.g. CCX TPC, High Power Mechanism,
 //		We update Tx power of current channel again.
 //
-void rtl8180_tx_pw_wq (struct work_struct *work)
+void rtl8180_tx_pw_wq(struct work_struct *work)
 {
 //      struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
 //      struct ieee80211_device * ieee = (struct ieee80211_device*)
@@ -136,22 +133,19 @@ void rtl8180_tx_pw_wq (struct work_struct *work)
 //	Description:
 //		Return TRUE if we shall perform DIG Mecahnism, FALSE otherwise.
 //
-bool
-CheckDig(
-	struct net_device *dev
-	)
+bool CheckDig(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	struct ieee80211_device *ieee = priv->ieee80211;
 
-	if(!priv->bDigMechanism)
+	if (!priv->bDigMechanism)
 		return false;
 
-	if(ieee->state != IEEE80211_LINKED)
+	if (ieee->state != IEEE80211_LINKED)
 		return false;
 
 	//if(priv->CurrentOperaRate < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01.
-	if((priv->ieee80211->rate/5) < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01.
+	if ((priv->ieee80211->rate / 5) < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01.
 		return false;
 	return true;
 }
@@ -159,17 +153,14 @@ CheckDig(
 //	Description:
 //		Implementation of DIG for Zebra and Zebra2.
 //
-void
-DIG_Zebra(
-	struct net_device *dev
-	)
+void DIG_Zebra(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u16			CCKFalseAlarm, OFDMFalseAlarm;
 	u16			OfdmFA1, OfdmFA2;
 	int			InitialGainStep = 7; // The number of initial gain stages.
 	int			LowestGainStage = 4; // The capable lowest stage of performing dig workitem.
-	u32			AwakePeriodIn2Sec=0;
+	u32			AwakePeriodIn2Sec = 0;
 
 	//printk("---------> DIG_Zebra()\n");
 
@@ -182,23 +173,23 @@ DIG_Zebra(
 //	printk("DIG**********OFDM False Alarm: %#X \n",OFDMFalseAlarm);
 
 	// The number of initial gain steps is different, by Bruce, 2007-04-13.
-	if (priv->InitialGain == 0 ) { //autoDIG
+	if (priv->InitialGain == 0) { //autoDIG
 		// Advised from SD3 DZ
 		priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm)
 	}
 	// Advised from SD3 DZ
-	OfdmFA1 =  0x20;
+	OfdmFA1 = 0x20;
 
 #if 1 //lzm reserved 080826
-	AwakePeriodIn2Sec = (2000-priv ->DozePeriodInPast2Sec);
+	AwakePeriodIn2Sec = (2000 - priv->DozePeriodInPast2Sec);
 	//printk("&&& DozePeriod=%d AwakePeriod=%d\n", priv->DozePeriodInPast2Sec, AwakePeriodIn2Sec);
-	priv ->DozePeriodInPast2Sec=0;
+	priv ->DozePeriodInPast2Sec = 0;
 
-	if(AwakePeriodIn2Sec) {
+	if (AwakePeriodIn2Sec) {
 		//RT_TRACE(COMP_DIG, DBG_TRACE, ("DIG: AwakePeriodIn2Sec(%d) - FATh(0x%X , 0x%X) ->",AwakePeriodIn2Sec, OfdmFA1, OfdmFA2));
 		// adjuest DIG threshold.
-		OfdmFA1 =  (u16)((OfdmFA1*AwakePeriodIn2Sec)  / 2000) ;
-		OfdmFA2 =  (u16)((OfdmFA2*AwakePeriodIn2Sec)  / 2000) ;
+		OfdmFA1 = (u16)((OfdmFA1 * AwakePeriodIn2Sec) / 2000) ;
+		OfdmFA2 = (u16)((OfdmFA2 * AwakePeriodIn2Sec) / 2000) ;
 		//RT_TRACE(COMP_DIG, DBG_TRACE, ("( 0x%X , 0x%X)\n", OfdmFA1, OfdmFA2));
 	} else {
 		;//RT_TRACE(COMP_DIG, DBG_WARNING, ("ERROR!!  AwakePeriodIn2Sec should not be ZERO!!\n"));
@@ -211,10 +202,10 @@ DIG_Zebra(
 	if (OFDMFalseAlarm > OfdmFA1) {
 		if (OFDMFalseAlarm > OfdmFA2) {
 			priv->DIG_NumberFallbackVote++;
-			if (priv->DIG_NumberFallbackVote >1) {
+			if (priv->DIG_NumberFallbackVote > 1) {
 				//serious OFDM  False Alarm, need fallback
 				if (priv->InitialGain < InitialGainStep) {
-					priv->InitialGainBackUp= priv->InitialGain;
+					priv->InitialGainBackUp = priv->InitialGain;
 
 					priv->InitialGain = (priv->InitialGain + 1);
 //					printk("DIG**********OFDM False Alarm: %#X,  OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2);
@@ -222,21 +213,21 @@ DIG_Zebra(
 					UpdateInitialGain(dev);
 				}
 				priv->DIG_NumberFallbackVote = 0;
-				priv->DIG_NumberUpgradeVote=0;
+				priv->DIG_NumberUpgradeVote = 0;
 			}
 		} else {
 			if (priv->DIG_NumberFallbackVote)
 				priv->DIG_NumberFallbackVote--;
 		}
-		priv->DIG_NumberUpgradeVote=0;
+		priv->DIG_NumberUpgradeVote = 0;
 	} else {
 		if (priv->DIG_NumberFallbackVote)
 			priv->DIG_NumberFallbackVote--;
 		priv->DIG_NumberUpgradeVote++;
 
-		if (priv->DIG_NumberUpgradeVote>9) {
+		if (priv->DIG_NumberUpgradeVote > 9) {
 			if (priv->InitialGain > LowestGainStage) { // In 87B, m78dBm means State 4 (m864dBm)
-				priv->InitialGainBackUp= priv->InitialGain;
+				priv->InitialGainBackUp = priv->InitialGain;
 
 				priv->InitialGain = (priv->InitialGain - 1);
 //				printk("DIG**********OFDM False Alarm: %#X,  OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2);
@@ -244,7 +235,7 @@ DIG_Zebra(
 				UpdateInitialGain(dev);
 			}
 			priv->DIG_NumberFallbackVote = 0;
-			priv->DIG_NumberUpgradeVote=0;
+			priv->DIG_NumberUpgradeVote = 0;
 		}
 	}
 
@@ -256,13 +247,12 @@ DIG_Zebra(
 //	Description:
 //		Dispatch DIG implementation according to RF.
 //
-void
-DynamicInitGain(struct net_device *dev)
+void DynamicInitGain(struct net_device *dev)
 {
 	DIG_Zebra(dev);
 }
 
-void rtl8180_hw_dig_wq (struct work_struct *work)
+void rtl8180_hw_dig_wq(struct work_struct *work)
 {
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_dig_wq);
@@ -278,10 +268,7 @@ void rtl8180_hw_dig_wq (struct work_struct *work)
 
 }
 
-int
-IncludedInSupportedRates(
-	struct r8180_priv       *priv,
-	u8              TxRate  )
+int IncludedInSupportedRates(struct r8180_priv *priv, u8 TxRate)
 {
 	u8 rate_len;
 	u8 rate_ex_len;
@@ -292,14 +279,14 @@ IncludedInSupportedRates(
 
 	rate_len = priv->ieee80211->current_network.rates_len;
 	rate_ex_len = priv->ieee80211->current_network.rates_ex_len;
-	for( idx=0; idx< rate_len; idx++ ) {
-		if( (priv->ieee80211->current_network.rates[idx] & RateMask) == NaiveTxRate ) {
+	for (idx=0; idx < rate_len; idx++) {
+		if ((priv->ieee80211->current_network.rates[idx] & RateMask) == NaiveTxRate) {
 			Found = 1;
 			goto found_rate;
 		}
 	}
-	for( idx=0; idx< rate_ex_len; idx++ ) {
-		if( (priv->ieee80211->current_network.rates_ex[idx] & RateMask) == NaiveTxRate ) {
+	for (idx = 0; idx < rate_ex_len; idx++) {
+		if ((priv->ieee80211->current_network.rates_ex[idx] & RateMask) == NaiveTxRate) {
 			Found = 1;
 			goto found_rate;
 		}
@@ -315,17 +302,13 @@ IncludedInSupportedRates(
 //              Return the upgrade rate if it is successed, otherwise return the input rate.
 //      By Bruce, 2007-06-05.
 //
-u8
-GetUpgradeTxRate(
-	struct net_device *dev,
-	u8                              rate
-	)
+u8 GetUpgradeTxRate(struct net_device *dev, u8 rate)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u8                      UpRate;
 
 	// Upgrade 1 degree.
-	switch(rate) {
+	switch (rate) {
 	case 108: // Up to 54Mbps.
 		UpRate = 108;
 		break;
@@ -367,7 +350,7 @@ GetUpgradeTxRate(
 		return rate;
 	}
 	// Check if the rate is valid.
-	if(IncludedInSupportedRates(priv, UpRate)) {
+	if (IncludedInSupportedRates(priv, UpRate)) {
 //              printk("GetUpgradeTxRate(): GetUpgrade Tx rate(%d) from %d !\n", UpRate, priv->CurrentOperaRate);
 		return UpRate;
 	} else {
@@ -382,17 +365,13 @@ GetUpgradeTxRate(
 //              Return the degrade rate if it is successed, otherwise return the input rate.
 //      By Bruce, 2007-06-05.
 //
-u8
-GetDegradeTxRate(
-	struct net_device *dev,
-	u8         rate
-	)
+u8 GetDegradeTxRate(struct net_device *dev, u8 rate)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u8                      DownRate;
 
 	// Upgrade 1 degree.
-	switch(rate) {
+	switch (rate) {
 	case 108: // Down to 48Mbps.
 		DownRate = 96;
 		break;
@@ -434,7 +413,7 @@ GetDegradeTxRate(
 		return rate;
 	}
 	// Check if the rate is valid.
-	if(IncludedInSupportedRates(priv, DownRate)) {
+	if (IncludedInSupportedRates(priv, DownRate)) {
 //              printk("GetDegradeTxRate(): GetDegrade Tx rate(%d) from %d!\n", DownRate, priv->CurrentOperaRate);
 		return DownRate;
 	} else {
@@ -448,14 +427,11 @@ GetDegradeTxRate(
 //      CCK rate.
 //      2005.01.25, by rcnjko.
 //
-bool
-MgntIsCckRate(
-	u16     rate
-	)
+bool MgntIsCckRate(u16 rate)
 {
 	bool bReturn = false;
 
-	if((rate <= 22) && (rate != 12) && (rate != 18)) {
+	if ((rate <= 22) && (rate != 12) && (rate != 18)) {
 		bReturn = true;
 	}
 
@@ -466,10 +442,7 @@ MgntIsCckRate(
 //		Tx Power tracking mechanism routine on 87SE.
 //	Created by Roger, 2007.12.11.
 //
-void
-TxPwrTracking87SE(
-	struct net_device *dev
-)
+void TxPwrTracking87SE(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	u8	tmpu1Byte, CurrentThermal, Idx;
@@ -477,36 +450,36 @@ TxPwrTracking87SE(
 	//u32	u4bRfReg;
 
 	tmpu1Byte = read_nic_byte(dev, EN_LPF_CAL);
-	CurrentThermal = (tmpu1Byte & 0xf0)>>4; //[ 7:4]: thermal meter indication.
-	CurrentThermal = (CurrentThermal>0x0c)? 0x0c:CurrentThermal;//lzm add 080826
+	CurrentThermal = (tmpu1Byte & 0xf0) >> 4; //[ 7:4]: thermal meter indication.
+	CurrentThermal = (CurrentThermal > 0x0c) ? 0x0c:CurrentThermal;//lzm add 080826
 
 	//printk("TxPwrTracking87SE(): CurrentThermal(%d)\n", CurrentThermal);
 
-	if( CurrentThermal != priv->ThermalMeter) {
+	if (CurrentThermal != priv->ThermalMeter) {
 //		printk("TxPwrTracking87SE(): Thermal meter changed!!!\n");
 
 		// Update Tx Power level on each channel.
-		for(Idx = 1; Idx<15; Idx++) {
+		for (Idx = 1; Idx < 15; Idx++) {
 			CckTxPwrIdx = priv->chtxpwr[Idx];
 			OfdmTxPwrIdx = priv->chtxpwr_ofdm[Idx];
 
-			if( CurrentThermal > priv->ThermalMeter ) {
+			if (CurrentThermal > priv->ThermalMeter) {
 				// higher thermal meter.
-				CckTxPwrIdx += (CurrentThermal - priv->ThermalMeter)*2;
-				OfdmTxPwrIdx += (CurrentThermal - priv->ThermalMeter)*2;
+				CckTxPwrIdx += (CurrentThermal - priv->ThermalMeter) * 2;
+				OfdmTxPwrIdx += (CurrentThermal - priv->ThermalMeter) * 2;
 
-				if(CckTxPwrIdx >35)
+				if (CckTxPwrIdx > 35)
 					CckTxPwrIdx = 35; // Force TxPower to maximal index.
-				if(OfdmTxPwrIdx >35)
+				if (OfdmTxPwrIdx > 35)
 					OfdmTxPwrIdx = 35;
 			} else {
 				// lower thermal meter.
-				CckTxPwrIdx -= (priv->ThermalMeter - CurrentThermal)*2;
-				OfdmTxPwrIdx -= (priv->ThermalMeter - CurrentThermal)*2;
+				CckTxPwrIdx -= (priv->ThermalMeter - CurrentThermal) * 2;
+				OfdmTxPwrIdx -= (priv->ThermalMeter - CurrentThermal) * 2;
 
-				if(CckTxPwrIdx <0)
+				if (CckTxPwrIdx < 0)
 					CckTxPwrIdx = 0;
-				if(OfdmTxPwrIdx <0)
+				if (OfdmTxPwrIdx < 0)
 					OfdmTxPwrIdx = 0;
 			}
 
@@ -520,10 +493,7 @@ TxPwrTracking87SE(
 	}
 	priv->ThermalMeter = CurrentThermal;
 }
-void
-StaRateAdaptive87SE(
-	struct net_device *dev
-	)
+void StaRateAdaptive87SE(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	unsigned long	CurrTxokCnt;
@@ -538,10 +508,10 @@ StaRateAdaptive87SE(
 	u32		TxThroughput;
 	long		CurrSignalStrength;
 	bool		bUpdateInitialGain = false;
-	u8		u1bOfdm=0, u1bCck = 0;
+	u8		u1bOfdm = 0, u1bCck = 0;
 	char		OfdmTxPwrIdx, CckTxPwrIdx;
 
-	priv->RateAdaptivePeriod= RATE_ADAPTIVE_TIMER_PERIOD;
+	priv->RateAdaptivePeriod = RATE_ADAPTIVE_TIMER_PERIOD;
 
 
 	CurrRetryCnt	= priv->CurrRetryCnt;
@@ -550,14 +520,14 @@ StaRateAdaptive87SE(
 	CurrSignalStrength = priv->Stats_RecvSignalPower;
 	TxThroughput = (u32)(priv->NumTxOkBytesTotal - priv->LastTxOKBytes);
 	priv->LastTxOKBytes = priv->NumTxOkBytesTotal;
-	priv->CurrentOperaRate = priv->ieee80211->rate/5;
+	priv->CurrentOperaRate = priv->ieee80211->rate / 5;
 	//printk("priv->CurrentOperaRate is %d\n",priv->CurrentOperaRate);
 	//2 Compute retry ratio.
-	if (CurrTxokCnt>0) {
-		CurrRetryRate = (u16)(CurrRetryCnt*100/CurrTxokCnt);
+	if (CurrTxokCnt > 0) {
+		CurrRetryRate = (u16)(CurrRetryCnt * 100 / CurrTxokCnt);
 	} else {
 	// It may be serious retry. To distinguish serious retry or no packets modified by Bruce
-		CurrRetryRate = (u16)(CurrRetryCnt*100/1);
+		CurrRetryRate = (u16)(CurrRetryCnt * 100 / 1);
 	}
 
 
@@ -579,7 +549,7 @@ StaRateAdaptive87SE(
 	priv->CurrRetryCnt = 0;
 
 	//2No Tx packets, return to init_rate or not?
-	if (CurrRetryRate==0 && CurrTxokCnt == 0) {
+	if (CurrRetryRate == 0 && CurrTxokCnt == 0) {
 		//
 		//After 9 (30*300ms) seconds in this condition, we try to raise rate.
 		//
@@ -587,7 +557,7 @@ StaRateAdaptive87SE(
 
 //		printk("No Tx packets, TryupingCountNoData(%d)\n", priv->TryupingCountNoData);
 		//[TRC Dell Lab] Extend raised period from 4.5sec to 9sec, Isaiah 2008-02-15 18:00
-		if (priv->TryupingCountNoData>30) {
+		if (priv->TryupingCountNoData > 30) {
 			priv->TryupingCountNoData = 0;
 			priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate);
 			// Reset Fail Record
@@ -597,7 +567,7 @@ StaRateAdaptive87SE(
 		}
 		goto SetInitialGain;
 	} else {
-		priv->TryupingCountNoData=0; //Reset trying up times.
+		priv->TryupingCountNoData = 0; //Reset trying up times.
 	}
 
 
@@ -623,12 +593,12 @@ StaRateAdaptive87SE(
 	// 11Mbps or 36Mbps
 	// Check more times in these rate(key rates).
 	//
-	if(priv->CurrentOperaRate == 22 || priv->CurrentOperaRate == 72)
+	if (priv->CurrentOperaRate == 22 || priv->CurrentOperaRate == 72)
 		TryUpTh += 9;
 	//
 	// Let these rates down more difficult.
 	//
-	if(MgntIsCckRate(priv->CurrentOperaRate) || priv->CurrentOperaRate == 36)
+	if (MgntIsCckRate(priv->CurrentOperaRate) || priv->CurrentOperaRate == 36)
 		TryDownTh += 1;
 
 	//1 Adjust Rate.
@@ -640,7 +610,7 @@ StaRateAdaptive87SE(
 		//	We randomly upgrade the data rate and check if the retry rate is improved.
 
 		// Upgrading rate did not improve the retry rate, fallback to the original rate.
-		if ( (CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput) {
+		if ((CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput) {
 			//Not necessary raising rate, fall back rate.
 			bTryDown = true;
 			//printk("case1-1: Not necessary raising rate, fall back rate....\n");
@@ -658,14 +628,14 @@ StaRateAdaptive87SE(
 		// Revise SignalStrength threshold to -51dbm.
 		//
 		// Also need to check retry rate for safety, by Bruce, 2007-06-05.
-		if(priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate ) {
+		if (priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate) {
 			bTryUp = true;
 			// Upgrade Tx Rate directly.
 			priv->TryupingCount += TryUpTh;
 		}
 //		printk("case2: StaRateAdaptive87SE: Power(%d) is high enough!!. \n", CurrSignalStrength);
 
-	} else if(CurrTxokCnt > 9 && CurrTxokCnt< 100 && CurrRetryRate >= 600) {
+	} else if (CurrTxokCnt > 9 && CurrTxokCnt < 100 && CurrRetryRate >= 600) {
 		//2 For Serious Retry
 		//
 		// Traffic is not busy but our Tx retry is serious.
@@ -674,161 +644,161 @@ StaRateAdaptive87SE(
 		// Let Rate Mechanism to degrade tx rate directly.
 		priv->TryDownCountLowData += TryDownTh;
 //		printk("case3: RA: Tx Retry is serious. Degrade Tx Rate to %d directly...\n", priv->CurrentOperaRate);
-	} else if ( priv->CurrentOperaRate == 108 ) {
+	} else if (priv->CurrentOperaRate == 108) {
 		//2For 54Mbps
 		// Air Link
-		if ( (CurrRetryRate>26)&&(priv->LastRetryRate>25)) {
-//		if ( (CurrRetryRate>40)&&(priv->LastRetryRate>39))
+		if ((CurrRetryRate > 26) && (priv->LastRetryRate > 25)) {
+//		if ((CurrRetryRate>40)&&(priv->LastRetryRate>39))
 			//Down to rate 48Mbps.
 			bTryDown = true;
 		}
 		// Cable Link
-		else if ( (CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72)) {
-//		else if ( (CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72))
+		else if ((CurrRetryRate > 17) && (priv->LastRetryRate > 16) && (CurrSignalStrength > -72)) {
+//		else if ((CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72))
 			//Down to rate 48Mbps.
 			bTryDown = true;
 		}
 
-		if(bTryDown && (CurrSignalStrength < -75)) //cable link
+		if (bTryDown && (CurrSignalStrength < -75)) //cable link
 			priv->TryDownCountLowData += TryDownTh;
 		//printk("case4---54M \n");
 
 	}
-	else if ( priv->CurrentOperaRate == 96 ) {
+	else if (priv->CurrentOperaRate == 96) {
 		//2For 48Mbps
 		//Air Link
-		if ( ((CurrRetryRate>48) && (priv->LastRetryRate>47))) {
+		if (((CurrRetryRate > 48) && (priv->LastRetryRate > 47))) {
 //		if ( ((CurrRetryRate>65) && (priv->LastRetryRate>64)))
 			//Down to rate 36Mbps.
 			bTryDown = true;
-		} else if ( ((CurrRetryRate>21) && (priv->LastRetryRate>20)) && (CurrSignalStrength > -74)) { //Cable Link
+		} else if (((CurrRetryRate > 21) && (priv->LastRetryRate > 20)) && (CurrSignalStrength > -74)) { //Cable Link
 			//Down to rate 36Mbps.
 			bTryDown = true;
-		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
+		} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		} else if ( (CurrRetryRate<8) && (priv->LastRetryRate<8) ) { //TO DO: need to consider (RSSI)
+		} else if ((CurrRetryRate < 8) && (priv->LastRetryRate < 8)) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<28) && (priv->LastRetryRate<8) )
 			bTryUp = true;
 		}
 
-		if(bTryDown && (CurrSignalStrength < -75)){
+		if (bTryDown && (CurrSignalStrength < -75)){
 			priv->TryDownCountLowData += TryDownTh;
 		}
 		//printk("case5---48M \n");
-	} else if ( priv->CurrentOperaRate == 72 ) {
+	} else if (priv->CurrentOperaRate == 72) {
 		//2For 36Mbps
-		if ( (CurrRetryRate>43) && (priv->LastRetryRate>41)) {
+		if ((CurrRetryRate > 43) && (priv->LastRetryRate > 41)) {
 //		if ( (CurrRetryRate>60) && (priv->LastRetryRate>59))
 			//Down to rate 24Mbps.
 			bTryDown = true;
-		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
+		} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		} else if ( (CurrRetryRate<15) &&  (priv->LastRetryRate<16)) { //TO DO: need to consider (RSSI)
+		} else if ((CurrRetryRate < 15) &&  (priv->LastRetryRate < 16)) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<35) &&  (priv->LastRetryRate<36))
 			bTryUp = true;
 		}
 
-		if(bTryDown && (CurrSignalStrength < -80))
+		if (bTryDown && (CurrSignalStrength < -80))
 			priv->TryDownCountLowData += TryDownTh;
 
 		//printk("case6---36M \n");
-	} else if ( priv->CurrentOperaRate == 48 ) {
+	} else if (priv->CurrentOperaRate == 48) {
 		//2For 24Mbps
 		// Air Link
-		if ( ((CurrRetryRate>63) && (priv->LastRetryRate>62))) {
+		if (((CurrRetryRate > 63) && (priv->LastRetryRate > 62))) {
 //		if ( ((CurrRetryRate>83) && (priv->LastRetryRate>82)))
 			//Down to rate 18Mbps.
 			bTryDown = true;
-		} else if ( ((CurrRetryRate>33) && (priv->LastRetryRate>32)) && (CurrSignalStrength > -82) ) { //Cable Link
+		} else if (((CurrRetryRate > 33) && (priv->LastRetryRate > 32)) && (CurrSignalStrength > -82)) { //Cable Link
 //		 else if ( ((CurrRetryRate>50) && (priv->LastRetryRate>49)) && (CurrSignalStrength > -82) )
 			//Down to rate 18Mbps.
 			bTryDown = true;
-		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
+		} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2 )) {
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		} else if ( (CurrRetryRate<20) && (priv->LastRetryRate<21)) { //TO DO: need to consider (RSSI)
+		} else if ((CurrRetryRate < 20) && (priv->LastRetryRate < 21)) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<40) && (priv->LastRetryRate<41))
 			bTryUp = true;
 		}
 
-		if(bTryDown && (CurrSignalStrength < -82))
+		if (bTryDown && (CurrSignalStrength < -82))
 			priv->TryDownCountLowData += TryDownTh;
 
 		//printk("case7---24M \n");
-	} else if ( priv->CurrentOperaRate == 36 ) {
+	} else if (priv->CurrentOperaRate == 36) {
 		//2For 18Mbps
 		// original (109, 109)
 		//[TRC Dell Lab] (90, 91), Isaiah 2008-02-18 23:24
 		//			     (85, 86), Isaiah 2008-02-18 24:00
-		if ( ((CurrRetryRate>85) && (priv->LastRetryRate>86))) {
+		if (((CurrRetryRate > 85) && (priv->LastRetryRate > 86))) {
 //		if ( ((CurrRetryRate>115) && (priv->LastRetryRate>116)))
 			//Down to rate 11Mbps.
 			bTryDown = true;
 
 		  //[TRC Dell Lab]  Isaiah 2008-02-18 23:24
-		} else if((CurrRetryRate>  (priv->LastRetryRate + 50 )) && (priv->FailTxRateCount >2 )) {
+		} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
 //		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		} else if ( (CurrRetryRate<22) && (priv->LastRetryRate<23)) { //TO DO: need to consider (RSSI)
+		} else if ((CurrRetryRate < 22) && (priv->LastRetryRate < 23)) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<42) && (priv->LastRetryRate<43))
 			bTryUp = true;
 		}
 		//printk("case8---18M \n");
-	} else if ( priv->CurrentOperaRate == 22 ) {
+	} else if (priv->CurrentOperaRate == 22) {
 		//2For 11Mbps
-		if (CurrRetryRate>95) {
+		if (CurrRetryRate > 95) {
 //		if (CurrRetryRate>155)
 			bTryDown = true;
 		}
-		else if ( (CurrRetryRate<29) && (priv->LastRetryRate <30) ) { //TO DO: need to consider (RSSI)
+		else if ((CurrRetryRate < 29) && (priv->LastRetryRate < 30)) { //TO DO: need to consider (RSSI)
 //		else if ( (CurrRetryRate<49) && (priv->LastRetryRate <50) )
 			bTryUp = true;
 		}
 		//printk("case9---11M \n");
-	} else if ( priv->CurrentOperaRate == 11 ) {
+	} else if (priv->CurrentOperaRate == 11) {
 		//2For 5.5Mbps
-		if (CurrRetryRate>149) {
+		if (CurrRetryRate > 149) {
 //		if (CurrRetryRate>189)
 			bTryDown = true;
-		} else if ( (CurrRetryRate<60) && (priv->LastRetryRate < 65)) {
+		} else if ((CurrRetryRate < 60) && (priv->LastRetryRate < 65)) {
 //		else if ( (CurrRetryRate<80) && (priv->LastRetryRate < 85))
 			bTryUp = true;
 		}
 		//printk("case10---5.5M \n");
-	} else if ( priv->CurrentOperaRate == 4 ) {
+	} else if (priv->CurrentOperaRate == 4) {
 		//2For 2 Mbps
-		if((CurrRetryRate>99) && (priv->LastRetryRate>99)) {
+		if ((CurrRetryRate > 99) && (priv->LastRetryRate > 99)) {
 //		if((CurrRetryRate>199) && (priv->LastRetryRate>199))
 			bTryDown = true;
-		} else if ( (CurrRetryRate < 65) && (priv->LastRetryRate < 70)) {
+		} else if ((CurrRetryRate < 65) && (priv->LastRetryRate < 70)) {
 //		else if ( (CurrRetryRate < 85) && (priv->LastRetryRate < 90))
 			bTryUp = true;
 		}
 		//printk("case11---2M \n");
-	} else if ( priv->CurrentOperaRate == 2 ) {
+	} else if (priv->CurrentOperaRate == 2) {
 		//2For 1 Mbps
-		if( (CurrRetryRate<70) && (priv->LastRetryRate<75)) {
+		if ((CurrRetryRate < 70) && (priv->LastRetryRate < 75)) {
 //		if( (CurrRetryRate<90) && (priv->LastRetryRate<95))
 			bTryUp = true;
 		}
 		//printk("case12---1M \n");
 	}
 
-	if(bTryUp && bTryDown)
+	if (bTryUp && bTryDown)
 	printk("StaRateAdaptive87B(): Tx Rate tried upping and downing simultaneously!\n");
 
 	//1 Test Upgrading Tx Rate
 	// Sometimes the cause of the low throughput (high retry rate) is the compatibility between the AP and NIC.
 	// To test if the upper rate may cause lower retry rate, this mechanism randomly occurs to test upgrading tx rate.
-	if(!bTryUp && !bTryDown && (priv->TryupingCount == 0) && (priv->TryDownCountLowData == 0)
+	if (!bTryUp && !bTryDown && (priv->TryupingCount == 0) && (priv->TryDownCountLowData == 0)
 		&& priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate && priv->FailTxRateCount < 2) {
-		if(jiffies% (CurrRetryRate + 101) == 0) {
+		if (jiffies % (CurrRetryRate + 101) == 0) {
 			bTryUp = true;
 			priv->bTryuping = true;
 			//printk("StaRateAdaptive87SE(): Randomly try upgrading...\n");
@@ -836,7 +806,7 @@ StaRateAdaptive87SE(
 	}
 
 	//1 Rate Mechanism
-	if(bTryUp) {
+	if (bTryUp) {
 		priv->TryupingCount++;
 		priv->TryDownCountLowData = 0;
 
@@ -852,21 +822,21 @@ StaRateAdaptive87SE(
 		// this condition will be satisfied at most every 2 min.
 		//
 
-		if((priv->TryupingCount > (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount)) ||
+		if ((priv->TryupingCount > (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount)) ||
 			(CurrSignalStrength > priv->LastFailTxRateSS) || priv->bTryuping) {
 			priv->TryupingCount = 0;
 			//
 			// When transferring from CCK to OFDM, DIG is an important issue.
 			//
-			if(priv->CurrentOperaRate == 22)
+			if (priv->CurrentOperaRate == 22)
 				bUpdateInitialGain = true;
 
 			// The difference in throughput between 48Mbps and 36Mbps is 8M.
 			// So, we must be carefully in this rate scale. Isaiah 2008-02-15.
 			//
-			if(  ((priv->CurrentOperaRate == 72) || (priv->CurrentOperaRate == 48) || (priv->CurrentOperaRate == 36)) &&
-				(priv->FailTxRateCount > 2) )
-				priv->RateAdaptivePeriod= (RATE_ADAPTIVE_TIMER_PERIOD/2);
+			if (((priv->CurrentOperaRate == 72) || (priv->CurrentOperaRate == 48) || (priv->CurrentOperaRate == 36)) &&
+				(priv->FailTxRateCount > 2))
+				priv->RateAdaptivePeriod = (RATE_ADAPTIVE_TIMER_PERIOD / 2);
 
 			// (1)To avoid upgrade frequently to the fail tx rate, add the FailTxRateCount into the threshold.
 			// (2)If the signal strength is increased, it may be able to upgrade.
@@ -875,29 +845,29 @@ StaRateAdaptive87SE(
 //			printk("StaRateAdaptive87SE(): Upgrade Tx Rate to %d\n", priv->CurrentOperaRate);
 
 			//[TRC Dell Lab] Bypass 12/9/6, Isaiah 2008-02-18 20:00
-			if(priv->CurrentOperaRate ==36) {
-				priv->bUpdateARFR=true;
+			if (priv->CurrentOperaRate == 36) {
+				priv->bUpdateARFR = true;
 				write_nic_word(dev, ARFR, 0x0F8F); //bypass 12/9/6
 //				printk("UP: ARFR=0xF8F\n");
 			} else if(priv->bUpdateARFR) {
-				priv->bUpdateARFR=false;
+				priv->bUpdateARFR = false;
 				write_nic_word(dev, ARFR, 0x0FFF); //set 1M ~ 54Mbps.
 //				printk("UP: ARFR=0xFFF\n");
 			}
 
 			// Update Fail Tx rate and count.
-			if(priv->LastFailTxRate != priv->CurrentOperaRate) {
+			if (priv->LastFailTxRate != priv->CurrentOperaRate) {
 				priv->LastFailTxRate = priv->CurrentOperaRate;
 				priv->FailTxRateCount = 0;
 				priv->LastFailTxRateSS = -200; // Set lowest power.
 			}
 		}
 	} else {
-		if(priv->TryupingCount > 0)
+		if (priv->TryupingCount > 0)
 			priv->TryupingCount --;
 	}
 
-	if(bTryDown) {
+	if (bTryDown) {
 		priv->TryDownCountLowData++;
 		priv->TryupingCount = 0;
 
@@ -907,14 +877,14 @@ StaRateAdaptive87SE(
 
 
 		//Check if Tx rate can be degraded or Test trying upgrading should fallback.
-		if(priv->TryDownCountLowData > TryDownTh || priv->bTryuping) {
+		if (priv->TryDownCountLowData > TryDownTh || priv->bTryuping) {
 			priv->TryDownCountLowData = 0;
 			priv->bTryuping = false;
 			// Update fail information.
-			if(priv->LastFailTxRate == priv->CurrentOperaRate) {
-				priv->FailTxRateCount ++;
+			if (priv->LastFailTxRate == priv->CurrentOperaRate) {
+				priv->FailTxRateCount++;
 				// Record the Tx fail rate signal strength.
-				if(CurrSignalStrength > priv->LastFailTxRateSS)
+				if (CurrSignalStrength > priv->LastFailTxRateSS)
 					priv->LastFailTxRateSS = CurrSignalStrength;
 			} else {
 				priv->LastFailTxRate = priv->CurrentOperaRate;
@@ -925,18 +895,18 @@ StaRateAdaptive87SE(
 
 			// Reduce chariot training time at weak signal strength situation. SD3 ED demand.
 			//[TRC Dell Lab] Revise Signal Threshold from -75 to -80 , Isaiah 2008-02-18 20:00
-			if( (CurrSignalStrength < -80) && (priv->CurrentOperaRate > 72 )) {
+			if ((CurrSignalStrength < -80) && (priv->CurrentOperaRate > 72 )) {
 				priv->CurrentOperaRate = 72;
 //				printk("DN: weak signal strength (%d), degrade to 36Mbps\n", CurrSignalStrength);
 			}
 
 			//[TRC Dell Lab] Bypass 12/9/6, Isaiah 2008-02-18 20:00
-			if(priv->CurrentOperaRate ==36) {
-				priv->bUpdateARFR=true;
+			if (priv->CurrentOperaRate == 36) {
+				priv->bUpdateARFR = true;
 				write_nic_word(dev, ARFR, 0x0F8F); //bypass 12/9/6
 //				printk("DN: ARFR=0xF8F\n");
-			} else if(priv->bUpdateARFR) {
-				priv->bUpdateARFR=false;
+			} else if (priv->bUpdateARFR) {
+				priv->bUpdateARFR = false;
 				write_nic_word(dev, ARFR, 0x0FFF); //set 1M ~ 54Mbps.
 //				printk("DN: ARFR=0xFFF\n");
 			}
@@ -944,21 +914,21 @@ StaRateAdaptive87SE(
 			//
 			// When it is CCK rate, it may need to update initial gain to receive lower power packets.
 			//
-			if(MgntIsCckRate(priv->CurrentOperaRate)) {
+			if (MgntIsCckRate(priv->CurrentOperaRate)) {
 				bUpdateInitialGain = true;
 			}
 //			printk("StaRateAdaptive87SE(): Degrade Tx Rate to %d\n", priv->CurrentOperaRate);
 		}
 	} else {
-		if(priv->TryDownCountLowData > 0)
-			priv->TryDownCountLowData --;
+		if (priv->TryDownCountLowData > 0)
+			priv->TryDownCountLowData--;
 	}
 
 	// Keep the Tx fail rate count to equal to 0x15 at most.
 	// Reduce the fail count at least to 10 sec if tx rate is tending stable.
-	if(priv->FailTxRateCount >= 0x15 ||
+	if (priv->FailTxRateCount >= 0x15 ||
 		(!bTryUp && !bTryDown && priv->TryDownCountLowData == 0 && priv->TryupingCount && priv->FailTxRateCount > 0x6)) {
-		priv->FailTxRateCount --;
+		priv->FailTxRateCount--;
 	}
 
 
@@ -966,41 +936,41 @@ StaRateAdaptive87SE(
 	CckTxPwrIdx  = priv->chtxpwr[priv->ieee80211->current_network.channel];
 
 	//[TRC Dell Lab] Mac0x9e increase 2 level in 36M~18M situation, Isaiah 2008-02-18 24:00
-	if((priv->CurrentOperaRate < 96) &&(priv->CurrentOperaRate > 22)) {
+	if ((priv->CurrentOperaRate < 96) && (priv->CurrentOperaRate > 22)) {
 		u1bCck = read_nic_byte(dev, CCK_TXAGC);
 		u1bOfdm = read_nic_byte(dev, OFDM_TXAGC);
 
 		// case 1: Never enter High power
-		if(u1bCck == CckTxPwrIdx ) {
-			if(u1bOfdm != (OfdmTxPwrIdx+2) ) {
-			priv->bEnhanceTxPwr= true;
-			u1bOfdm = ((u1bOfdm+2) > 35) ? 35: (u1bOfdm+2);
+		if (u1bCck == CckTxPwrIdx) {
+			if (u1bOfdm != (OfdmTxPwrIdx + 2)) {
+			priv->bEnhanceTxPwr = true;
+			u1bOfdm = ((u1bOfdm + 2) > 35) ? 35: (u1bOfdm + 2);
 			write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
 //			printk("Enhance OFDM_TXAGC : +++++ u1bOfdm= 0x%x\n", u1bOfdm);
 			}
-		} else if(u1bCck < CckTxPwrIdx) {
+		} else if (u1bCck < CckTxPwrIdx) {
 		// case 2: enter high power
-			if(!priv->bEnhanceTxPwr) {
-				priv->bEnhanceTxPwr= true;
-				u1bOfdm = ((u1bOfdm+2) > 35) ? 35: (u1bOfdm+2);
+			if (!priv->bEnhanceTxPwr) {
+				priv->bEnhanceTxPwr = true;
+				u1bOfdm = ((u1bOfdm + 2) > 35) ? 35: (u1bOfdm + 2);
 				write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
 				//RT_TRACE(COMP_RATE, DBG_TRACE, ("Enhance OFDM_TXAGC(2) : +++++ u1bOfdm= 0x%x\n", u1bOfdm));
 			}
 		}
-	} else if(priv->bEnhanceTxPwr) {  //54/48/11/5.5/2/1
+	} else if (priv->bEnhanceTxPwr) {  //54/48/11/5.5/2/1
 		u1bCck = read_nic_byte(dev, CCK_TXAGC);
 		u1bOfdm = read_nic_byte(dev, OFDM_TXAGC);
 
 		// case 1: Never enter High power
-		if(u1bCck == CckTxPwrIdx ) {
-			priv->bEnhanceTxPwr= false;
+		if (u1bCck == CckTxPwrIdx) {
+			priv->bEnhanceTxPwr = false;
 			write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
 			//printk("Recover OFDM_TXAGC : ===== u1bOfdm= 0x%x\n", OfdmTxPwrIdx);
 		}
 		// case 2: enter high power
-		else if(u1bCck < CckTxPwrIdx) {
-			priv->bEnhanceTxPwr= false;
-			u1bOfdm = ((u1bOfdm-2) > 0) ? (u1bOfdm-2): 0;
+		else if (u1bCck < CckTxPwrIdx) {
+			priv->bEnhanceTxPwr = false;
+			u1bOfdm = ((u1bOfdm - 2) > 0) ? (u1bOfdm - 2): 0;
 			write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
 			//RT_TRACE(COMP_RATE, DBG_TRACE, ("Recover OFDM_TXAGC(2): ===== u1bOfdm= 0x%x\n", u1bOfdm));
 
@@ -1012,29 +982,29 @@ StaRateAdaptive87SE(
 	// "from CCK to OFDM".
 	//
 SetInitialGain:
-	if(bUpdateInitialGain) {
-		if(MgntIsCckRate(priv->CurrentOperaRate)) { // CCK
-			if(priv->InitialGain > priv->RegBModeGainStage) {
-				priv->InitialGainBackUp= priv->InitialGain;
+	if (bUpdateInitialGain) {
+		if (MgntIsCckRate(priv->CurrentOperaRate)) { // CCK
+			if (priv->InitialGain > priv->RegBModeGainStage) {
+				priv->InitialGainBackUp = priv->InitialGain;
 
-				if(CurrSignalStrength < -85) // Low power, OFDM [0x17] = 26.
+				if (CurrSignalStrength < -85) // Low power, OFDM [0x17] = 26.
 					//SD3 SYs suggest that CurrSignalStrength < -65, ofdm 0x17=26.
 					priv->InitialGain = priv->RegBModeGainStage;
 
-				else if(priv->InitialGain > priv->RegBModeGainStage + 1)
+				else if (priv->InitialGain > priv->RegBModeGainStage + 1)
 					priv->InitialGain -= 2;
 
 				else
-					priv->InitialGain --;
+					priv->InitialGain--;
 
 				printk("StaRateAdaptive87SE(): update init_gain to index %d for date rate %d\n",priv->InitialGain, priv->CurrentOperaRate);
 				UpdateInitialGain(dev);
 			}
 		} else { // OFDM
-			if(priv->InitialGain < 4) {
-				priv->InitialGainBackUp= priv->InitialGain;
+			if (priv->InitialGain < 4) {
+				priv->InitialGainBackUp = priv->InitialGain;
 
-				priv->InitialGain ++;
+				priv->InitialGain++;
 				printk("StaRateAdaptive87SE(): update init_gain to index %d for date rate %d\n",priv->InitialGain, priv->CurrentOperaRate);
 				UpdateInitialGain(dev);
 			}
@@ -1047,10 +1017,10 @@ SetInitialGain:
 	priv->ieee80211->rate = priv->CurrentOperaRate * 5;
 }
 
-void rtl8180_rate_adapter(struct work_struct * work)
+void rtl8180_rate_adapter(struct work_struct *work)
 {
 	struct delayed_work *dwork = to_delayed_work(work);
-	struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,rate_adapter_wq);
+	struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, rate_adapter_wq);
 	struct net_device *dev = ieee->dev;
 	//struct r8180_priv *priv = ieee80211_priv(dev);
 //    DMESG("---->rtl8180_rate_adapter");
@@ -1059,15 +1029,15 @@ void rtl8180_rate_adapter(struct work_struct * work)
 }
 void timer_rate_adaptive(unsigned long data)
 {
-	struct r8180_priv* priv = ieee80211_priv((struct net_device *)data);
+	struct r8180_priv *priv = ieee80211_priv((struct net_device *)data);
 	//DMESG("---->timer_rate_adaptive()\n");
-	if(!priv->up) {
+	if (!priv->up) {
 //		DMESG("<----timer_rate_adaptive():driver is not up!\n");
 		return;
 	}
-	if((priv->ieee80211->iw_mode != IW_MODE_MASTER)
+	if ((priv->ieee80211->iw_mode != IW_MODE_MASTER)
 			&& (priv->ieee80211->state == IEEE80211_LINKED) &&
-			(priv->ForcedDataRate == 0) ) {
+			(priv->ForcedDataRate == 0)) {
 //	DMESG("timer_rate_adaptive():schedule rate_adapter_wq\n");
 		queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->rate_adapter_wq);
 //		StaRateAdaptive87SE((struct net_device *)data);
@@ -1077,11 +1047,7 @@ void timer_rate_adaptive(unsigned long data)
 	//DMESG("<----timer_rate_adaptive()\n");
 }
 //by amy 080312}
-void
-SwAntennaDiversityRxOk8185(
-	struct net_device *dev,
-	u8 SignalStrength
-	)
+void SwAntennaDiversityRxOk8185(struct net_device *dev, u8 SignalStrength)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
@@ -1089,13 +1055,13 @@ SwAntennaDiversityRxOk8185(
 
 	priv->AdRxOkCnt++;
 
-	if( priv->AdRxSignalStrength != -1) {
-		priv->AdRxSignalStrength = ((priv->AdRxSignalStrength*7) + (SignalStrength*3)) / 10;
+	if (priv->AdRxSignalStrength != -1) {
+		priv->AdRxSignalStrength = ((priv->AdRxSignalStrength * 7) + (SignalStrength * 3)) / 10;
 	} else { // Initialization case.
 		priv->AdRxSignalStrength = SignalStrength;
 	}
 //{+by amy 080312
-	if( priv->LastRxPktAntenna ) //Main antenna.
+	if (priv->LastRxPktAntenna) //Main antenna.
 		priv->AdMainAntennaRxOkCnt++;
 	else	 // Aux antenna.
 		priv->AdAuxAntennaRxOkCnt++;
@@ -1106,18 +1072,14 @@ SwAntennaDiversityRxOk8185(
 //	Description:
 //		Change Antenna Switch.
 //
-bool
-SetAntenna8185(
-	struct net_device *dev,
-	u8		u1bAntennaIndex
-	)
+bool SetAntenna8185(struct net_device *dev, u8 u1bAntennaIndex)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	bool bAntennaSwitched = false;
 
 //	printk("+SetAntenna8185(): Antenna is switching to: %d \n", u1bAntennaIndex);
 
-	switch(u1bAntennaIndex) {
+	switch (u1bAntennaIndex) {
 	case 0:
 		/* Mac register, main antenna */
 		write_nic_byte(dev, ANTSEL, 0x03);
@@ -1155,16 +1117,13 @@ SetAntenna8185(
 //	Description:
 //		Toggle Antenna switch.
 //
-bool
-SwitchAntenna(
-	struct net_device *dev
-	)
+bool SwitchAntenna(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
 	bool		bResult;
 
-	if(priv->CurrAntennaIndex == 0) {
+	if (priv->CurrAntennaIndex == 0) {
 		bResult = SetAntenna8185(dev, 1);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 1 ......\n");
@@ -1186,17 +1145,14 @@ SwitchAntenna(
 //
 //	2006.04.17, by rcnjko.
 //
-void
-SwAntennaDiversity(
-	struct net_device *dev
-	)
+void SwAntennaDiversity(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	bool   bSwCheckSS=false;
+	bool   bSwCheckSS = false;
 //	printk("+SwAntennaDiversity(): CurrAntennaIndex: %d\n", priv->CurrAntennaIndex);
 //	printk("AdTickCount is %d\n",priv->AdTickCount);
 //by amy 080312
-	if(bSwCheckSS) {
+	if (bSwCheckSS) {
 		priv->AdTickCount++;
 
 		printk("(1) AdTickCount: %d, AdCheckPeriod: %d\n",
@@ -1207,7 +1163,7 @@ SwAntennaDiversity(
 //	priv->AdTickCount++;//-by amy 080312
 
 	// Case 1. No Link.
-	if(priv->ieee80211->state != IEEE80211_LINKED) {
+	if (priv->ieee80211->state != IEEE80211_LINKED) {
 	//	printk("SwAntennaDiversity(): Case 1. No Link.\n");
 
 		priv->bAdSwitchedChecking = false;
@@ -1215,14 +1171,14 @@ SwAntennaDiversity(
 		SwitchAntenna(dev);
 
 	  // Case 2. Linked but no packet receive.d
-	} else if(priv->AdRxOkCnt == 0) {
+	} else if (priv->AdRxOkCnt == 0) {
 	//	printk("SwAntennaDiversity(): Case 2. Linked but no packet received.\n");
 
 		priv->bAdSwitchedChecking = false;
 		SwitchAntenna(dev);
 
 	  // Case 3. Evaluate last antenna switch action and undo it if necessary.
-	} else if(priv->bAdSwitchedChecking == true) {
+	} else if (priv->bAdSwitchedChecking == true) {
 	//	printk("SwAntennaDiversity(): Case 3. Evaluate last antenna switch action.\n");
 
 		priv->bAdSwitchedChecking = false;
@@ -1241,7 +1197,7 @@ SwAntennaDiversity(
 			priv->AdCheckPeriod *= 2;
 //by amy 080312
 			// Increase Antenna Diversity checking period.
-			if(priv->AdCheckPeriod > priv->AdMaxCheckPeriod)
+			if (priv->AdCheckPeriod > priv->AdMaxCheckPeriod)
 				priv->AdCheckPeriod = priv->AdMaxCheckPeriod;
 
 			// Wrong deceision => switch back.
@@ -1277,7 +1233,7 @@ SwAntennaDiversity(
 		// Evaluate RxOk count from each antenna if we shall switch default antenna now.
 		// Added by Roger, 2008.02.21.
 //{by amy 080312
-		if((priv->AdMainAntennaRxOkCnt < priv->AdAuxAntennaRxOkCnt)
+		if ((priv->AdMainAntennaRxOkCnt < priv->AdAuxAntennaRxOkCnt)
 			&& (priv->CurrAntennaIndex == 0)) {
 		// We set Main antenna as default but RxOk count was less than Aux ones.
 
@@ -1287,7 +1243,7 @@ SwAntennaDiversity(
 			// Switch to Aux antenna.
 			SwitchAntenna(dev);
 			priv->bHWAdSwitched = true;
-		} else if((priv->AdAuxAntennaRxOkCnt < priv->AdMainAntennaRxOkCnt)
+		} else if ((priv->AdAuxAntennaRxOkCnt < priv->AdMainAntennaRxOkCnt)
 			&& (priv->CurrAntennaIndex == 1)) {
 		// We set Aux antenna as default but RxOk count was less than Main ones.
 
@@ -1317,10 +1273,10 @@ SwAntennaDiversity(
 		// Our guess is that main antenna have lower throughput and get many change
 		// to receive more CCK packets(ex.Beacon) which have stronger SignalStrength.
 		//
-		if( (!priv->bHWAdSwitched) && (bSwCheckSS)) {
+		if ((!priv->bHWAdSwitched) && (bSwCheckSS)) {
 //by amy 080312}
 			// Evaluate Rx signal strength if we shall switch antenna now.
-			if(priv->AdRxSignalStrength < priv->AdRxSsThreshold) {
+			if (priv->AdRxSignalStrength < priv->AdRxSsThreshold) {
 			// Rx signal strength is weak => Switch Antenna.
 //				printk("SwAntennaDiversity(): Rx Signal Strength is weak, CurrRxSs: %d, RxSsThreshold: %d\n",
 //				priv->AdRxSignalStrength, priv->AdRxSsThreshold);
@@ -1336,7 +1292,7 @@ SwAntennaDiversity(
 
 				priv->bAdSwitchedChecking = false;
 				// Increase Rx signal strength threshold if necessary.
-				if(	(priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && // Signal is much stronger than current threshold
+				if ((priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && // Signal is much stronger than current threshold
 					priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) { // Current threhold is not yet reach upper limit.
 
 					priv->AdRxSsThreshold = (priv->AdRxSsThreshold + priv->AdRxSignalStrength) / 2;
@@ -1345,7 +1301,7 @@ SwAntennaDiversity(
 				}
 
 				// Reduce Antenna Diversity checking period if possible.
-				if( priv->AdCheckPeriod > priv->AdMinCheckPeriod )
+				if (priv->AdCheckPeriod > priv->AdMinCheckPeriod)
 					priv->AdCheckPeriod /= 2;
 			}
 		}
@@ -1366,12 +1322,11 @@ SwAntennaDiversity(
 //	Description:
 //		Return TRUE if we shall perform Tx Power Tracking Mecahnism, FALSE otherwise.
 //
-bool
-CheckTxPwrTracking(	struct net_device *dev)
+bool CheckTxPwrTracking(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
-	if(!priv->bTxPowerTrack)
+	if (!priv->bTxPowerTrack)
 		return false;
 
 //lzm reserved 080826
@@ -1381,7 +1336,7 @@ CheckTxPwrTracking(	struct net_device *dev)
 	//}
 
 	//if 87SE is in High Power , don't do Tx Power Tracking. asked by SD3 ED. 2008-08-08 Isaiah
-	if(priv->bToUpdateTxPwr)
+	if (priv->bToUpdateTxPwr)
 		return false;
 
 	return true;
@@ -1392,10 +1347,7 @@ CheckTxPwrTracking(	struct net_device *dev)
 //	Description:
 //		Timer callback function of SW Antenna Diversity.
 //
-void
-SwAntennaDiversityTimerCallback(
-	struct net_device *dev
-	)
+void SwAntennaDiversityTimerCallback(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	RT_RF_POWER_STATE rtState;
@@ -1418,9 +1370,9 @@ SwAntennaDiversityTimerCallback(
 		}
 		SwAntennaDiversity(dev);
 
-	} while(false);
+	} while (false);
 
-	if(priv->up) {
+	if (priv->up) {
 		priv->SwAntennaDiversityTimer.expires = jiffies + MSECS(ANTENNA_DIVERSITY_TIMER_PERIOD);
 		add_timer(&priv->SwAntennaDiversityTimer);
 	}
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments
  2012-03-15 19:05 [PATCH 0/5] Staging: rtl8187se: r8180_dm.c: Fix Coding Style issues Andrew Miller
                   ` (3 preceding siblings ...)
  2012-03-15 19:05 ` [PATCH 4/5] Staging: rtl8187se: r8180_dm.c: Fix spacing issues Andrew Miller
@ 2012-03-15 19:05 ` Andrew Miller
  2012-03-15 19:34   ` Dan Carpenter
  4 siblings, 1 reply; 11+ messages in thread
From: Andrew Miller @ 2012-03-15 19:05 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, amiller

Change c++ style comments to c style

Signed-off-by: Andrew Miller <amiller@amilx.com>
---
 drivers/staging/rtl8187se/r8180_dm.c | 1026 +++++++++++++++++-----------------
 1 files changed, 525 insertions(+), 501 deletions(-)

diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c
index 02bffa9..54b676f 100644
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -1,14 +1,15 @@
-//#include "r8180.h"
+/*#include "r8180.h" */
 #include "r8180_dm.h"
 #include "r8180_hw.h"
 #include "r8180_93cx6.h"
-//{by amy 080312
-
-//
-//	Description:
-//		Return TRUE if we shall perform High Power Mecahnism, FALSE otherwise.
-//
-//+by amy 080312
+/*{by amy 080312 */
+
+/*
+ *	Description:
+ *		Return TRUE if we shall perform High Power Mecahnism, FALSE otherwise.
+ *
+ *+by amy 080312
+ */
 #define RATE_ADAPTIVE_TIMER_PERIOD      300
 
 bool CheckHighPower(struct net_device *dev)
@@ -25,17 +26,17 @@ bool CheckHighPower(struct net_device *dev)
 	return true;
 }
 
-//
-//	Description:
-//		Update Tx power level if necessary.
-//		See also DoRxHighPower() and SetTxPowerLevel8185() for reference.
-//
-//	Note:
-//		The reason why we udpate Tx power level here instead of DoRxHighPower()
-//		is the number of IO to change Tx power is much more than channel TR switch
-//		and they are related to OFDM and MAC registers.
-//		So, we don't want to update it so frequently in per-Rx packet base.
-//
+/*
+ *	Description:
+ *		Update Tx power level if necessary.
+ *		See also DoRxHighPower() and SetTxPowerLevel8185() for reference.
+ *
+ *	Note:
+ *		The reason why we udpate Tx power level here instead of DoRxHighPower()
+ *		is the number of IO to change Tx power is much more than channel TR switch
+ *		and they are related to OFDM and MAC registers.
+ *		So, we don't want to update it so frequently in per-Rx packet base.
+ */
 void DoTxHighPower(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -46,7 +47,7 @@ void DoTxHighPower(struct net_device *dev)
 	u8			u1bTmp;
 	char			OfdmTxPwrIdx, CckTxPwrIdx;
 
-	//printk("----> DoTxHighPower()\n");
+	/* printk("----> DoTxHighPower()\n"); */
 
 	HiPwrUpperTh = priv->RegHiPwrUpperTh;
 	HiPwrLowerTh = priv->RegHiPwrLowerTh;
@@ -56,83 +57,87 @@ void DoTxHighPower(struct net_device *dev)
 	RSSIHiPwrUpperTh = priv->RegRSSIHiPwrUpperTh;
 	RSSIHiPwrLowerTh = priv->RegRSSIHiPwrLowerTh;
 
-	//lzm add 080826
+	/* lzm add 080826 */
 	OfdmTxPwrIdx  = priv->chtxpwr_ofdm[priv->ieee80211->current_network.channel];
 	CckTxPwrIdx  = priv->chtxpwr[priv->ieee80211->current_network.channel];
 
-	//	printk("DoTxHighPower() - UndecoratedSmoothedSS:%d, CurCCKRSSI = %d , bCurCCKPkt= %d \n", priv->UndecoratedSmoothedSS, priv->CurCCKRSSI, priv->bCurCCKPkt );
+		 /* 
+		  * printk("DoTxHighPower() - UndecoratedSmoothedSS:%d, CurCCKRSSI = %d , bCurCCKPkt= %d \n", 
+ 		  * priv->UndecoratedSmoothedSS, priv->CurCCKRSSI, priv->bCurCCKPkt ); 
+ 		  */
 
 	if ((priv->UndecoratedSmoothedSS > HiPwrUpperTh) ||
 		(priv->bCurCCKPkt && (priv->CurCCKRSSI > RSSIHiPwrUpperTh))) {
-		// Stevenl suggested that degrade 8dbm in high power sate. 2007-12-04 Isaiah
+		/* Stevenl suggested that degrade 8dbm in high power sate. 2007-12-04 Isaiah */
 
-	//	printk("=====>DoTxHighPower() - High Power - UndecoratedSmoothedSS:%d,  HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrUpperTh );
+	/*	printk("=====>DoTxHighPower() - High Power - UndecoratedSmoothedSS:%d,  HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrUpperTh ); */
 		priv->bToUpdateTxPwr = true;
 		u1bTmp= read_nic_byte(dev, CCK_TXAGC);
 
-		// If it never enter High Power.
+		/* If it never enter High Power. */
 		if (CckTxPwrIdx == u1bTmp) {
-			u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  // 8dbm
+			u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  /* 8dbm */
 			write_nic_byte(dev, CCK_TXAGC, u1bTmp);
 
 			u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
-			u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  // 8dbm
+			u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0;  /* 8dbm */
 			write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
 		}
 
 	} else if ((priv->UndecoratedSmoothedSS < HiPwrLowerTh) &&
 		(!priv->bCurCCKPkt || priv->CurCCKRSSI < RSSIHiPwrLowerTh)) {
-	//	 printk("DoTxHighPower() - lower Power - UndecoratedSmoothedSS:%d,  HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrLowerTh );
+	/*	 printk("DoTxHighPower() - lower Power - UndecoratedSmoothedSS:%d,  HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrLowerTh ); */
 		if (priv->bToUpdateTxPwr) {
 			priv->bToUpdateTxPwr = false;
-			//SD3 required.
+			/* SD3 required. */
 			u1bTmp= read_nic_byte(dev, CCK_TXAGC);
 			if (u1bTmp < CckTxPwrIdx) {
-				//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
-				//write_nic_byte(dev, CCK_TXAGC, u1bTmp);
+				/* u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);   8dbm  */
+				/* write_nic_byte(dev, CCK_TXAGC, u1bTmp); */
 				write_nic_byte(dev, CCK_TXAGC, CckTxPwrIdx);
 			}
 
 			u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
 			if (u1bTmp < OfdmTxPwrIdx) {
-				//u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);  // 8dbm
-				//write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
+				/* u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16);   8dbm  */
+				/* write_nic_byte(dev, OFDM_TXAGC, u1bTmp); */
 				write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
 			}
 		}
 	}
 
-	//printk("<---- DoTxHighPower()\n");
+	/* printk("<---- DoTxHighPower()\n"); */
 }
 
 
-//
-//	Description:
-//		Callback function of UpdateTxPowerWorkItem.
-//		Because of some event happened, e.g. CCX TPC, High Power Mechanism,
-//		We update Tx power of current channel again.
-//
+/*
+ *	Description:
+ *		Callback function of UpdateTxPowerWorkItem.
+ *		Because of some event happened, e.g. CCX TPC, High Power Mechanism,
+ *		We update Tx power of current channel again.
+ */
 void rtl8180_tx_pw_wq(struct work_struct *work)
 {
-//      struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
-//      struct ieee80211_device * ieee = (struct ieee80211_device*)
-//                                             container_of(work, struct ieee80211_device, watch_dog_wq);
+/*      struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
+ *      struct ieee80211_device * ieee = (struct ieee80211_device*)
+ *      container_of(work, struct ieee80211_device, watch_dog_wq);
+ */
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,tx_pw_wq);
 	struct net_device *dev = ieee->dev;
 
-//	printk("----> UpdateTxPowerWorkItemCallback()\n");
+/*	printk("----> UpdateTxPowerWorkItemCallback()\n"); */
 
 	DoTxHighPower(dev);
 
-//	printk("<---- UpdateTxPowerWorkItemCallback()\n");
+/*	printk("<---- UpdateTxPowerWorkItemCallback()\n"); */
 }
 
 
-//
-//	Description:
-//		Return TRUE if we shall perform DIG Mecahnism, FALSE otherwise.
-//
+/*
+ *	Description:
+ *		Return TRUE if we shall perform DIG Mecahnism, FALSE otherwise.
+ */
 bool CheckDig(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -144,72 +149,72 @@ bool CheckDig(struct net_device *dev)
 	if (ieee->state != IEEE80211_LINKED)
 		return false;
 
-	//if(priv->CurrentOperaRate < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01.
-	if ((priv->ieee80211->rate / 5) < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01.
+	/* if(priv->CurrentOperaRate < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01. */
+	if ((priv->ieee80211->rate / 5) < 36) /* Schedule Dig under all OFDM rates. By Bruce, 2007-06-01. */
 		return false;
 	return true;
 }
-//
-//	Description:
-//		Implementation of DIG for Zebra and Zebra2.
-//
+/*
+ *	Description:
+ *		Implementation of DIG for Zebra and Zebra2.
+ */
 void DIG_Zebra(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u16			CCKFalseAlarm, OFDMFalseAlarm;
 	u16			OfdmFA1, OfdmFA2;
-	int			InitialGainStep = 7; // The number of initial gain stages.
-	int			LowestGainStage = 4; // The capable lowest stage of performing dig workitem.
+	int			InitialGainStep = 7; /* The number of initial gain stages. */
+	int			LowestGainStage = 4; /* The capable lowest stage of performing dig workitem. */
 	u32			AwakePeriodIn2Sec = 0;
 
-	//printk("---------> DIG_Zebra()\n");
+	/* printk("---------> DIG_Zebra()\n"); */
 
 	CCKFalseAlarm = (u16)(priv->FalseAlarmRegValue & 0x0000ffff);
 	OFDMFalseAlarm = (u16)((priv->FalseAlarmRegValue >> 16) & 0x0000ffff);
 	OfdmFA1 =  0x15;
 	OfdmFA2 = ((u16)(priv->RegDigOfdmFaUpTh)) << 8;
 
-//	printk("DIG**********CCK False Alarm: %#X \n",CCKFalseAlarm);
-//	printk("DIG**********OFDM False Alarm: %#X \n",OFDMFalseAlarm);
+/*	printk("DIG**********CCK False Alarm: %#X \n",CCKFalseAlarm); */
+/*	printk("DIG**********OFDM False Alarm: %#X \n",OFDMFalseAlarm); */
 
-	// The number of initial gain steps is different, by Bruce, 2007-04-13.
-	if (priv->InitialGain == 0) { //autoDIG
-		// Advised from SD3 DZ
-		priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm)
+	/* The number of initial gain steps is different, by Bruce, 2007-04-13. */
+	if (priv->InitialGain == 0) { /* autoDIG */
+		/* Advised from SD3 DZ */
+		priv->InitialGain = 4; /* In 87B, m74dBm means State 4 (m82dBm) */
 	}
-	// Advised from SD3 DZ
+	/* Advised from SD3 DZ */
 	OfdmFA1 = 0x20;
 
-#if 1 //lzm reserved 080826
+#if 1 /* lzm reserved 080826 */
 	AwakePeriodIn2Sec = (2000 - priv->DozePeriodInPast2Sec);
-	//printk("&&& DozePeriod=%d AwakePeriod=%d\n", priv->DozePeriodInPast2Sec, AwakePeriodIn2Sec);
+	/* printk("&&& DozePeriod=%d AwakePeriod=%d\n", priv->DozePeriodInPast2Sec, AwakePeriodIn2Sec); */
 	priv ->DozePeriodInPast2Sec = 0;
 
 	if (AwakePeriodIn2Sec) {
-		//RT_TRACE(COMP_DIG, DBG_TRACE, ("DIG: AwakePeriodIn2Sec(%d) - FATh(0x%X , 0x%X) ->",AwakePeriodIn2Sec, OfdmFA1, OfdmFA2));
-		// adjuest DIG threshold.
+		/* RT_TRACE(COMP_DIG, DBG_TRACE, ("DIG: AwakePeriodIn2Sec(%d) - FATh(0x%X , 0x%X) ->",AwakePeriodIn2Sec, OfdmFA1, OfdmFA2)); */
+		/* adjuest DIG threshold. */
 		OfdmFA1 = (u16)((OfdmFA1 * AwakePeriodIn2Sec) / 2000) ;
 		OfdmFA2 = (u16)((OfdmFA2 * AwakePeriodIn2Sec) / 2000) ;
-		//RT_TRACE(COMP_DIG, DBG_TRACE, ("( 0x%X , 0x%X)\n", OfdmFA1, OfdmFA2));
+		/* RT_TRACE(COMP_DIG, DBG_TRACE, ("( 0x%X , 0x%X)\n", OfdmFA1, OfdmFA2)); */
 	} else {
-		;//RT_TRACE(COMP_DIG, DBG_WARNING, ("ERROR!!  AwakePeriodIn2Sec should not be ZERO!!\n"));
+		;/* RT_TRACE(COMP_DIG, DBG_WARNING, ("ERROR!!  AwakePeriodIn2Sec should not be ZERO!!\n")); */
 	}
 #endif
 
 	InitialGainStep = 8;
-	LowestGainStage = priv->RegBModeGainStage; // Lowest gain stage.
+	LowestGainStage = priv->RegBModeGainStage; /* Lowest gain stage. */
 
 	if (OFDMFalseAlarm > OfdmFA1) {
 		if (OFDMFalseAlarm > OfdmFA2) {
 			priv->DIG_NumberFallbackVote++;
 			if (priv->DIG_NumberFallbackVote > 1) {
-				//serious OFDM  False Alarm, need fallback
+				/* serious OFDM  False Alarm, need fallback */
 				if (priv->InitialGain < InitialGainStep) {
 					priv->InitialGainBackUp = priv->InitialGain;
 
 					priv->InitialGain = (priv->InitialGain + 1);
-//					printk("DIG**********OFDM False Alarm: %#X,  OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2);
-//					printk("DIG+++++++ fallback OFDM:%d \n", priv->InitialGain);
+/*					printk("DIG**********OFDM False Alarm: %#X,  OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2); */
+/*					printk("DIG+++++++ fallback OFDM:%d \n", priv->InitialGain); */
 					UpdateInitialGain(dev);
 				}
 				priv->DIG_NumberFallbackVote = 0;
@@ -226,12 +231,12 @@ void DIG_Zebra(struct net_device *dev)
 		priv->DIG_NumberUpgradeVote++;
 
 		if (priv->DIG_NumberUpgradeVote > 9) {
-			if (priv->InitialGain > LowestGainStage) { // In 87B, m78dBm means State 4 (m864dBm)
+			if (priv->InitialGain > LowestGainStage) { /* In 87B, m78dBm means State 4 (m864dBm) */
 				priv->InitialGainBackUp = priv->InitialGain;
 
 				priv->InitialGain = (priv->InitialGain - 1);
-//				printk("DIG**********OFDM False Alarm: %#X,  OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2);
-//				printk("DIG--------- Upgrade OFDM:%d \n", priv->InitialGain);
+/*				printk("DIG**********OFDM False Alarm: %#X,  OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2); */
+/*				printk("DIG--------- Upgrade OFDM:%d \n", priv->InitialGain); */
 				UpdateInitialGain(dev);
 			}
 			priv->DIG_NumberFallbackVote = 0;
@@ -239,14 +244,14 @@ void DIG_Zebra(struct net_device *dev)
 		}
 	}
 
-//	printk("DIG+++++++ OFDM:%d\n", priv->InitialGain);
-	//printk("<--------- DIG_Zebra()\n");
+/*	printk("DIG+++++++ OFDM:%d\n", priv->InitialGain); */
+/* 	printk("<--------- DIG_Zebra()\n"); */
 }
 
-//
-//	Description:
-//		Dispatch DIG implementation according to RF.
-//
+/*
+ *	Description:
+ *		Dispatch DIG implementation according to RF.
+ */
 void DynamicInitGain(struct net_device *dev)
 {
 	DIG_Zebra(dev);
@@ -259,11 +264,11 @@ void rtl8180_hw_dig_wq(struct work_struct *work)
 	struct net_device *dev = ieee->dev;
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
-	// Read CCK and OFDM False Alarm.
+	/* Read CCK and OFDM False Alarm. */
 	priv->FalseAlarmRegValue = read_nic_dword(dev, CCK_FALSE_ALARM);
 
 
-	// Adjust Initial Gain dynamically.
+	/* Adjust Initial Gain dynamically. */
 	DynamicInitGain(dev);
 
 }
@@ -296,52 +301,52 @@ int IncludedInSupportedRates(struct r8180_priv *priv, u8 TxRate)
 	return Found;
 }
 
-//
-//      Description:
-//              Get the Tx rate one degree up form the input rate in the supported rates.
-//              Return the upgrade rate if it is successed, otherwise return the input rate.
-//      By Bruce, 2007-06-05.
-//
+/*
+ *      Description:
+ *              Get the Tx rate one degree up form the input rate in the supported rates.
+ *              Return the upgrade rate if it is successed, otherwise return the input rate.
+ *      By Bruce, 2007-06-05.
+ */
 u8 GetUpgradeTxRate(struct net_device *dev, u8 rate)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u8                      UpRate;
 
-	// Upgrade 1 degree.
+	/* Upgrade 1 degree. */
 	switch (rate) {
-	case 108: // Up to 54Mbps.
+	case 108: /* Up to 54Mbps. */
 		UpRate = 108;
 		break;
 
-	case 96: // Up to 54Mbps.
+	case 96: /* Up to 54Mbps. */
 		UpRate = 108;
 		break;
 
-	case 72: // Up to 48Mbps.
+	case 72: /* Up to 48Mbps. */
 		UpRate = 96;
 		break;
 
-	case 48: // Up to 36Mbps.
+	case 48: /* Up to 36Mbps. */
 		UpRate = 72;
 		break;
 
-	case 36: // Up to 24Mbps.
+	case 36: /* Up to 24Mbps. */
 		UpRate = 48;
 		break;
 
-	case 22: // Up to 18Mbps.
+	case 22: /* Up to 18Mbps. */
 		UpRate = 36;
 		break;
 
-	case 11: // Up to 11Mbps.
+	case 11: /* Up to 11Mbps. */
 		UpRate = 22;
 		break;
 
-	case 4: // Up to 5.5Mbps.
+	case 4: /* Up to 5.5Mbps. */
 		UpRate = 11;
 		break;
 
-	case 2: // Up to 2Mbps.
+	case 2: /* Up to 2Mbps. */
 		UpRate = 4;
 		break;
 
@@ -349,62 +354,63 @@ u8 GetUpgradeTxRate(struct net_device *dev, u8 rate)
 		printk("GetUpgradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate);
 		return rate;
 	}
-	// Check if the rate is valid.
+	/* Check if the rate is valid. */
 	if (IncludedInSupportedRates(priv, UpRate)) {
-//              printk("GetUpgradeTxRate(): GetUpgrade Tx rate(%d) from %d !\n", UpRate, priv->CurrentOperaRate);
+/*              printk("GetUpgradeTxRate(): GetUpgrade Tx rate(%d) from %d !\n", UpRate, priv->CurrentOperaRate); */
 		return UpRate;
 	} else {
-		//printk("GetUpgradeTxRate(): Tx rate (%d) is not in supported rates\n", UpRate);
+		/* printk("GetUpgradeTxRate(): Tx rate (%d) is not in supported rates\n", UpRate); */
 		return rate;
 	}
 	return rate;
 }
-//
-//      Description:
-//              Get the Tx rate one degree down form the input rate in the supported rates.
-//              Return the degrade rate if it is successed, otherwise return the input rate.
-//      By Bruce, 2007-06-05.
-//
+/*
+ *      Description:
+ *              Get the Tx rate one degree down form the input rate in the supported rates.
+ *              Return the degrade rate if it is successed, otherwise return the input rate.
+ *      By Bruce, 2007-06-05.
+ */
+
 u8 GetDegradeTxRate(struct net_device *dev, u8 rate)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u8                      DownRate;
 
-	// Upgrade 1 degree.
+	/* Upgrade 1 degree. */
 	switch (rate) {
-	case 108: // Down to 48Mbps.
+	case 108: /* Down to 48Mbps. */
 		DownRate = 96;
 		break;
 
-	case 96: // Down to 36Mbps.
+	case 96: /* Down to 36Mbps. */
 		DownRate = 72;
 		break;
 
-	case 72: // Down to 24Mbps.
+	case 72: /* Down to 24Mbps. */
 		DownRate = 48;
 		break;
 
-	case 48: // Down to 18Mbps.
+	case 48: /* Down to 18Mbps. */
 		DownRate = 36;
 		break;
 
-	case 36: // Down to 11Mbps.
+	case 36: /* Down to 11Mbps. */
 		DownRate = 22;
 		break;
 
-	case 22: // Down to 5.5Mbps.
+	case 22: /* Down to 5.5Mbps. */
 		DownRate = 11;
 		break;
 
-	case 11: // Down to 2Mbps.
+	case 11: /* Down to 2Mbps. */
 		DownRate = 4;
 		break;
 
-	case 4: // Down to 1Mbps.
+	case 4: /* Down to 1Mbps. */
 		DownRate = 2;
 		break;
 
-	case 2: // Down to 1Mbps.
+	case 2: /* Down to 1Mbps. */
 		DownRate = 2;
 		break;
 
@@ -412,21 +418,22 @@ u8 GetDegradeTxRate(struct net_device *dev, u8 rate)
 		printk("GetDegradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate);
 		return rate;
 	}
-	// Check if the rate is valid.
+	/* Check if the rate is valid. */
 	if (IncludedInSupportedRates(priv, DownRate)) {
-//              printk("GetDegradeTxRate(): GetDegrade Tx rate(%d) from %d!\n", DownRate, priv->CurrentOperaRate);
+/*              printk("GetDegradeTxRate(): GetDegrade Tx rate(%d) from %d!\n", DownRate, priv->CurrentOperaRate); */
 		return DownRate;
 	} else {
-		//printk("GetDegradeTxRate(): Tx rate (%d) is not in supported rates\n", DownRate);
+		/* printk("GetDegradeTxRate(): Tx rate (%d) is not in supported rates\n", DownRate); */
 		return rate;
 	}
 	return rate;
 }
-//
-//      Helper function to determine if specified data rate is
-//      CCK rate.
-//      2005.01.25, by rcnjko.
-//
+/*
+ *      Helper function to determine if specified data rate is
+ *      CCK rate.
+ *      2005.01.25, by rcnjko.
+ */
+
 bool MgntIsCckRate(u16 rate)
 {
 	bool bReturn = false;
@@ -437,43 +444,43 @@ bool MgntIsCckRate(u16 rate)
 
 	return bReturn;
 }
-//
-//	Description:
-//		Tx Power tracking mechanism routine on 87SE.
-//	Created by Roger, 2007.12.11.
-//
+/*
+ *	Description:
+ *		Tx Power tracking mechanism routine on 87SE.
+ *	Created by Roger, 2007.12.11.
+ */
 void TxPwrTracking87SE(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	u8	tmpu1Byte, CurrentThermal, Idx;
 	char	CckTxPwrIdx, OfdmTxPwrIdx;
-	//u32	u4bRfReg;
+	/* u32 u4bRfReg; */
 
 	tmpu1Byte = read_nic_byte(dev, EN_LPF_CAL);
-	CurrentThermal = (tmpu1Byte & 0xf0) >> 4; //[ 7:4]: thermal meter indication.
-	CurrentThermal = (CurrentThermal > 0x0c) ? 0x0c:CurrentThermal;//lzm add 080826
+	CurrentThermal = (tmpu1Byte & 0xf0) >> 4; /*[ 7:4]: thermal meter indication. */
+	CurrentThermal = (CurrentThermal > 0x0c) ? 0x0c:CurrentThermal;/* lzm add 080826 */
 
-	//printk("TxPwrTracking87SE(): CurrentThermal(%d)\n", CurrentThermal);
+	/* printk("TxPwrTracking87SE(): CurrentThermal(%d)\n", CurrentThermal); */
 
 	if (CurrentThermal != priv->ThermalMeter) {
-//		printk("TxPwrTracking87SE(): Thermal meter changed!!!\n");
+/*		printk("TxPwrTracking87SE(): Thermal meter changed!!!\n"); */
 
-		// Update Tx Power level on each channel.
+		/* Update Tx Power level on each channel. */
 		for (Idx = 1; Idx < 15; Idx++) {
 			CckTxPwrIdx = priv->chtxpwr[Idx];
 			OfdmTxPwrIdx = priv->chtxpwr_ofdm[Idx];
 
 			if (CurrentThermal > priv->ThermalMeter) {
-				// higher thermal meter.
+				/* higher thermal meter. */
 				CckTxPwrIdx += (CurrentThermal - priv->ThermalMeter) * 2;
 				OfdmTxPwrIdx += (CurrentThermal - priv->ThermalMeter) * 2;
 
 				if (CckTxPwrIdx > 35)
-					CckTxPwrIdx = 35; // Force TxPower to maximal index.
+					CckTxPwrIdx = 35; /* Force TxPower to maximal index. */
 				if (OfdmTxPwrIdx > 35)
 					OfdmTxPwrIdx = 35;
 			} else {
-				// lower thermal meter.
+				/* lower thermal meter. */
 				CckTxPwrIdx -= (priv->ThermalMeter - CurrentThermal) * 2;
 				OfdmTxPwrIdx -= (priv->ThermalMeter - CurrentThermal) * 2;
 
@@ -483,12 +490,12 @@ void TxPwrTracking87SE(struct net_device *dev)
 					OfdmTxPwrIdx = 0;
 			}
 
-			// Update TxPower level on CCK and OFDM resp.
+			/* Update TxPower level on CCK and OFDM resp. */
 			priv->chtxpwr[Idx] = CckTxPwrIdx;
 			priv->chtxpwr_ofdm[Idx] = OfdmTxPwrIdx;
 		}
 
-		// Update TxPower level immediately.
+		/* Update TxPower level immediately. */
 		rtl8225z2_SetTXPowerLevel(dev, priv->ieee80211->current_network.channel);
 	}
 	priv->ThermalMeter = CurrentThermal;
@@ -499,7 +506,7 @@ void StaRateAdaptive87SE(struct net_device *dev)
 	unsigned long	CurrTxokCnt;
 	u16		CurrRetryCnt;
 	u16		CurrRetryRate;
-	//u16		i,idx;
+	/*u16		i,idx; */
 	unsigned long	CurrRxokCnt;
 	bool		bTryUp = false;
 	bool		bTryDown = false;
@@ -521,345 +528,353 @@ void StaRateAdaptive87SE(struct net_device *dev)
 	TxThroughput = (u32)(priv->NumTxOkBytesTotal - priv->LastTxOKBytes);
 	priv->LastTxOKBytes = priv->NumTxOkBytesTotal;
 	priv->CurrentOperaRate = priv->ieee80211->rate / 5;
-	//printk("priv->CurrentOperaRate is %d\n",priv->CurrentOperaRate);
-	//2 Compute retry ratio.
+	/* printk("priv->CurrentOperaRate is %d\n",priv->CurrentOperaRate); */
+	/* 2 Compute retry ratio. */
 	if (CurrTxokCnt > 0) {
 		CurrRetryRate = (u16)(CurrRetryCnt * 100 / CurrTxokCnt);
 	} else {
-	// It may be serious retry. To distinguish serious retry or no packets modified by Bruce
+	/* It may be serious retry. To distinguish serious retry or no packets modified by Bruce */
 		CurrRetryRate = (u16)(CurrRetryCnt * 100 / 1);
 	}
 
 
-	//
-	// Added by Roger, 2007.01.02.
-	// For debug information.
-	//
-	//printk("\n(1) pHalData->LastRetryRate: %d \n",priv->LastRetryRate);
-	//printk("(2) RetryCnt = %d  \n", CurrRetryCnt);
-	//printk("(3) TxokCnt = %d \n", CurrTxokCnt);
-	//printk("(4) CurrRetryRate = %d \n", CurrRetryRate);
-	//printk("(5) CurrSignalStrength = %d \n",CurrSignalStrength);
-	//printk("(6) TxThroughput is %d\n",TxThroughput);
-	//printk("priv->NumTxOkBytesTotal is %d\n",priv->NumTxOkBytesTotal);
+	/*
+	 * Added by Roger, 2007.01.02.
+	 * For debug information.
+	 *
+	 * printk("\n(1) pHalData->LastRetryRate: %d \n",priv->LastRetryRate);
+	 * printk("(2) RetryCnt = %d  \n", CurrRetryCnt);
+	 * printk("(3) TxokCnt = %d \n", CurrTxokCnt);
+	 * printk("(4) CurrRetryRate = %d \n", CurrRetryRate);
+	 * printk("(5) CurrSignalStrength = %d \n",CurrSignalStrength);
+	 * printk("(6) TxThroughput is %d\n",TxThroughput);
+	 * printk("priv->NumTxOkBytesTotal is %d\n",priv->NumTxOkBytesTotal);
+	 */
 
 	priv->LastRetryCnt = priv->CurrRetryCnt;
 	priv->LastTxokCnt = priv->NumTxOkTotal;
 	priv->LastRxokCnt = priv->ieee80211->NumRxOkTotal;
 	priv->CurrRetryCnt = 0;
 
-	//2No Tx packets, return to init_rate or not?
+	/* 2No Tx packets, return to init_rate or not? */
 	if (CurrRetryRate == 0 && CurrTxokCnt == 0) {
-		//
-		//After 9 (30*300ms) seconds in this condition, we try to raise rate.
-		//
+		/*
+		 * After 9 (30*300ms) seconds in this condition, we try to raise rate.
+		 */
 		priv->TryupingCountNoData++;
 
-//		printk("No Tx packets, TryupingCountNoData(%d)\n", priv->TryupingCountNoData);
-		//[TRC Dell Lab] Extend raised period from 4.5sec to 9sec, Isaiah 2008-02-15 18:00
+/*		printk("No Tx packets, TryupingCountNoData(%d)\n", priv->TryupingCountNoData); */
+		/* [TRC Dell Lab] Extend raised period from 4.5sec to 9sec, Isaiah 2008-02-15 18:00 */
 		if (priv->TryupingCountNoData > 30) {
 			priv->TryupingCountNoData = 0;
 			priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate);
-			// Reset Fail Record
+			/* Reset Fail Record */
 			priv->LastFailTxRate = 0;
 			priv->LastFailTxRateSS = -200;
 			priv->FailTxRateCount = 0;
 		}
 		goto SetInitialGain;
 	} else {
-		priv->TryupingCountNoData = 0; //Reset trying up times.
+		priv->TryupingCountNoData = 0; /*Reset trying up times. */
 	}
 
 
-	//
-	// For Netgear case, I comment out the following signal strength estimation,
-	// which can results in lower rate to transmit when sample is NOT enough (e.g. PING request).
-	// 2007.04.09, by Roger.
-	//
-
-	//
-	// Restructure rate adaptive as the following main stages:
-	// (1) Add retry threshold in 54M upgrading condition with signal strength.
-	// (2) Add the mechanism to degrade to CCK rate according to signal strength
-	//		and retry rate.
-	// (3) Remove all Initial Gain Updates over OFDM rate. To avoid the complicated
-	//		situation, Initial Gain Update is upon on DIG mechanism except CCK rate.
-	// (4) Add the mehanism of trying to upgrade tx rate.
-	// (5) Record the information of upping tx rate to avoid trying upping tx rate constantly.
-	// By Bruce, 2007-06-05.
-	//
-	//
-
-	// 11Mbps or 36Mbps
-	// Check more times in these rate(key rates).
-	//
+	/*
+	 * For Netgear case, I comment out the following signal strength estimation,
+	 * which can results in lower rate to transmit when sample is NOT enough (e.g. PING request).
+	 * 2007.04.09, by Roger.
+	 *
+	 *
+	 *
+	 * Restructure rate adaptive as the following main stages:
+	 * (1) Add retry threshold in 54M upgrading condition with signal strength.
+	 * (2) Add the mechanism to degrade to CCK rate according to signal strength
+	 *		and retry rate.
+	 * (3) Remove all Initial Gain Updates over OFDM rate. To avoid the complicated
+	 *		situation, Initial Gain Update is upon on DIG mechanism except CCK rate.
+	 * (4) Add the mehanism of trying to upgrade tx rate.
+	 * (5) Record the information of upping tx rate to avoid trying upping tx rate constantly.
+	 * By Bruce, 2007-06-05.
+	 *
+	 */
+
+	/*
+ 	 *  11Mbps or 36Mbps
+	 * Check more times in these rate(key rates).
+	 */
 	if (priv->CurrentOperaRate == 22 || priv->CurrentOperaRate == 72)
 		TryUpTh += 9;
-	//
-	// Let these rates down more difficult.
-	//
+	/*
+	 * Let these rates down more difficult.
+	 */
 	if (MgntIsCckRate(priv->CurrentOperaRate) || priv->CurrentOperaRate == 36)
 		TryDownTh += 1;
 
-	//1 Adjust Rate.
+	/* 1 Adjust Rate. */
 	if (priv->bTryuping == true) {
-		//2 For Test Upgrading mechanism
-		// Note:
-		//	Sometimes the throughput is upon on the capability bwtween the AP and NIC,
-		//	thus the low data rate does not improve the performance.
-		//	We randomly upgrade the data rate and check if the retry rate is improved.
-
-		// Upgrading rate did not improve the retry rate, fallback to the original rate.
+		/* 2 For Test Upgrading mechanism
+		 * Note:
+		 *	Sometimes the throughput is upon on the capability bwtween the AP and NIC,
+		 *	thus the low data rate does not improve the performance.
+		 *	We randomly upgrade the data rate and check if the retry rate is improved.
+		 */
+
+		/* Upgrading rate did not improve the retry rate, fallback to the original rate. */
 		if ((CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput) {
-			//Not necessary raising rate, fall back rate.
+			/*Not necessary raising rate, fall back rate. */
 			bTryDown = true;
-			//printk("case1-1: Not necessary raising rate, fall back rate....\n");
-			//printk("case1-1: pMgntInfo->CurrentOperaRate =%d, TxThroughput = %d, LastThroughput = %d\n",
-			//		priv->CurrentOperaRate, TxThroughput, priv->LastTxThroughput);
+			/* printk("case1-1: Not necessary raising rate, fall back rate....\n"); */
+			/* printk("case1-1: pMgntInfo->CurrentOperaRate =%d, TxThroughput = %d, LastThroughput = %d\n", */
+			/*		priv->CurrentOperaRate, TxThroughput, priv->LastTxThroughput); */
 		} else {
 			priv->bTryuping = false;
 		}
 	} else if (CurrSignalStrength > -47 && (CurrRetryRate < 50)) {
-		//2For High Power
-		//
-		// Added by Roger, 2007.04.09.
-		// Return to highest data rate, if signal strength is good enough.
-		// SignalStrength threshold(-50dbm) is for RTL8186.
-		// Revise SignalStrength threshold to -51dbm.
-		//
-		// Also need to check retry rate for safety, by Bruce, 2007-06-05.
+		/*
+ 		 * 2For High Power
+		 *
+		 * Added by Roger, 2007.04.09.
+		 * Return to highest data rate, if signal strength is good enough.
+		 * SignalStrength threshold(-50dbm) is for RTL8186.
+		 * Revise SignalStrength threshold to -51dbm.
+		 */
+		/* Also need to check retry rate for safety, by Bruce, 2007-06-05. */
 		if (priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate) {
 			bTryUp = true;
-			// Upgrade Tx Rate directly.
+			/* Upgrade Tx Rate directly. */
 			priv->TryupingCount += TryUpTh;
 		}
-//		printk("case2: StaRateAdaptive87SE: Power(%d) is high enough!!. \n", CurrSignalStrength);
+/*		printk("case2: StaRateAdaptive87SE: Power(%d) is high enough!!. \n", CurrSignalStrength); */
 
 	} else if (CurrTxokCnt > 9 && CurrTxokCnt < 100 && CurrRetryRate >= 600) {
-		//2 For Serious Retry
-		//
-		// Traffic is not busy but our Tx retry is serious.
-		//
+		/*
+		 *2 For Serious Retry
+		 *
+		 * Traffic is not busy but our Tx retry is serious.
+		 */
 		bTryDown = true;
-		// Let Rate Mechanism to degrade tx rate directly.
+		/* Let Rate Mechanism to degrade tx rate directly. */
 		priv->TryDownCountLowData += TryDownTh;
-//		printk("case3: RA: Tx Retry is serious. Degrade Tx Rate to %d directly...\n", priv->CurrentOperaRate);
+/*		printk("case3: RA: Tx Retry is serious. Degrade Tx Rate to %d directly...\n", priv->CurrentOperaRate); */
 	} else if (priv->CurrentOperaRate == 108) {
-		//2For 54Mbps
-		// Air Link
+		/* 2For 54Mbps */
+		/* Air Link */
 		if ((CurrRetryRate > 26) && (priv->LastRetryRate > 25)) {
-//		if ((CurrRetryRate>40)&&(priv->LastRetryRate>39))
-			//Down to rate 48Mbps.
+/*		if ((CurrRetryRate>40)&&(priv->LastRetryRate>39)) */
+			/*Down to rate 48Mbps. */
 			bTryDown = true;
 		}
-		// Cable Link
+		/* Cable Link */
 		else if ((CurrRetryRate > 17) && (priv->LastRetryRate > 16) && (CurrSignalStrength > -72)) {
-//		else if ((CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72))
-			//Down to rate 48Mbps.
+/*		else if ((CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72)) */
+			/*Down to rate 48Mbps. */
 			bTryDown = true;
 		}
 
-		if (bTryDown && (CurrSignalStrength < -75)) //cable link
+		if (bTryDown && (CurrSignalStrength < -75)) /* cable link */
 			priv->TryDownCountLowData += TryDownTh;
-		//printk("case4---54M \n");
+		/*printk("case4---54M \n"); */
 
 	}
 	else if (priv->CurrentOperaRate == 96) {
-		//2For 48Mbps
-		//Air Link
+		/* 2For 48Mbps */
+		/* Air Link */
 		if (((CurrRetryRate > 48) && (priv->LastRetryRate > 47))) {
-//		if ( ((CurrRetryRate>65) && (priv->LastRetryRate>64)))
-			//Down to rate 36Mbps.
+/*		if ( ((CurrRetryRate>65) && (priv->LastRetryRate>64))) */
+			/* Down to rate 36Mbps. */
 			bTryDown = true;
-		} else if (((CurrRetryRate > 21) && (priv->LastRetryRate > 20)) && (CurrSignalStrength > -74)) { //Cable Link
-			//Down to rate 36Mbps.
+		} else if (((CurrRetryRate > 21) && (priv->LastRetryRate > 20)) && (CurrSignalStrength > -74)) { /* Cable Link */
+			/* Down to rate 36Mbps. */
 			bTryDown = true;
 		} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
-//		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
+/*		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 )) */
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		} else if ((CurrRetryRate < 8) && (priv->LastRetryRate < 8)) { //TO DO: need to consider (RSSI)
-//		else if ( (CurrRetryRate<28) && (priv->LastRetryRate<8) )
+		} else if ((CurrRetryRate < 8) && (priv->LastRetryRate < 8)) { /* TO DO: need to consider (RSSI) */
+/*		else if ( (CurrRetryRate<28) && (priv->LastRetryRate<8) ) */
 			bTryUp = true;
 		}
 
 		if (bTryDown && (CurrSignalStrength < -75)){
 			priv->TryDownCountLowData += TryDownTh;
 		}
-		//printk("case5---48M \n");
+		/* printk("case5---48M \n"); */
 	} else if (priv->CurrentOperaRate == 72) {
-		//2For 36Mbps
+		/* 2For 36Mbps */
 		if ((CurrRetryRate > 43) && (priv->LastRetryRate > 41)) {
-//		if ( (CurrRetryRate>60) && (priv->LastRetryRate>59))
-			//Down to rate 24Mbps.
+/*		if ( (CurrRetryRate>60) && (priv->LastRetryRate>59)) */
+			/* Down to rate 24Mbps. */
 			bTryDown = true;
 		} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
-//		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
+/*		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 )) */
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		} else if ((CurrRetryRate < 15) &&  (priv->LastRetryRate < 16)) { //TO DO: need to consider (RSSI)
-//		else if ( (CurrRetryRate<35) &&  (priv->LastRetryRate<36))
+		} else if ((CurrRetryRate < 15) &&  (priv->LastRetryRate < 16)) { /* TO DO: need to consider (RSSI) */
+/*		else if ( (CurrRetryRate<35) &&  (priv->LastRetryRate<36)) */
 			bTryUp = true;
 		}
 
 		if (bTryDown && (CurrSignalStrength < -80))
 			priv->TryDownCountLowData += TryDownTh;
 
-		//printk("case6---36M \n");
+		/* printk("case6---36M \n"); */
 	} else if (priv->CurrentOperaRate == 48) {
-		//2For 24Mbps
-		// Air Link
+		/* 2For 24Mbps */
+		/* Air Link */
 		if (((CurrRetryRate > 63) && (priv->LastRetryRate > 62))) {
-//		if ( ((CurrRetryRate>83) && (priv->LastRetryRate>82)))
-			//Down to rate 18Mbps.
+/*		if ( ((CurrRetryRate>83) && (priv->LastRetryRate>82))) */
+			/* Down to rate 18Mbps. */
 			bTryDown = true;
-		} else if (((CurrRetryRate > 33) && (priv->LastRetryRate > 32)) && (CurrSignalStrength > -82)) { //Cable Link
-//		 else if ( ((CurrRetryRate>50) && (priv->LastRetryRate>49)) && (CurrSignalStrength > -82) )
-			//Down to rate 18Mbps.
+		} else if (((CurrRetryRate > 33) && (priv->LastRetryRate > 32)) && (CurrSignalStrength > -82)) { /* Cable Link */
+/*		 else if ( ((CurrRetryRate>50) && (priv->LastRetryRate>49)) && (CurrSignalStrength > -82) ) */
+			/* Down to rate 18Mbps. */
 			bTryDown = true;
 		} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2 )) {
-//		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
+/*		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 )) */
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		} else if ((CurrRetryRate < 20) && (priv->LastRetryRate < 21)) { //TO DO: need to consider (RSSI)
-//		else if ( (CurrRetryRate<40) && (priv->LastRetryRate<41))
+		} else if ((CurrRetryRate < 20) && (priv->LastRetryRate < 21)) { /* TO DO: need to consider (RSSI) */
+/*		else if ( (CurrRetryRate<40) && (priv->LastRetryRate<41)) */
 			bTryUp = true;
 		}
 
 		if (bTryDown && (CurrSignalStrength < -82))
 			priv->TryDownCountLowData += TryDownTh;
 
-		//printk("case7---24M \n");
+		/* printk("case7---24M \n"); */
 	} else if (priv->CurrentOperaRate == 36) {
-		//2For 18Mbps
-		// original (109, 109)
-		//[TRC Dell Lab] (90, 91), Isaiah 2008-02-18 23:24
-		//			     (85, 86), Isaiah 2008-02-18 24:00
+		/* 2For 18Mbps
+		 * original (109, 109)
+		 * [TRC Dell Lab] (90, 91), Isaiah 2008-02-18 23:24
+		 *			     (85, 86), Isaiah 2008-02-18 24:00
+		 */
 		if (((CurrRetryRate > 85) && (priv->LastRetryRate > 86))) {
-//		if ( ((CurrRetryRate>115) && (priv->LastRetryRate>116)))
-			//Down to rate 11Mbps.
+/*		if ( ((CurrRetryRate>115) && (priv->LastRetryRate>116))) */
+			/* Down to rate 11Mbps. */
 			bTryDown = true;
 
-		  //[TRC Dell Lab]  Isaiah 2008-02-18 23:24
+		  /* [TRC Dell Lab]  Isaiah 2008-02-18 23:24 */
 		} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
-//		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
+/*		else if((CurrRetryRate>  (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 )) */
 			bTryDown = true;
 			priv->TryDownCountLowData += TryDownTh;
-		} else if ((CurrRetryRate < 22) && (priv->LastRetryRate < 23)) { //TO DO: need to consider (RSSI)
-//		else if ( (CurrRetryRate<42) && (priv->LastRetryRate<43))
+		} else if ((CurrRetryRate < 22) && (priv->LastRetryRate < 23)) { /* TO DO: need to consider (RSSI) */
+/*		else if ( (CurrRetryRate<42) && (priv->LastRetryRate<43)) */
 			bTryUp = true;
 		}
-		//printk("case8---18M \n");
+		/* printk("case8---18M \n"); */
 	} else if (priv->CurrentOperaRate == 22) {
-		//2For 11Mbps
+		/* 2For 11Mbps */
 		if (CurrRetryRate > 95) {
-//		if (CurrRetryRate>155)
+/*		if (CurrRetryRate>155) */
 			bTryDown = true;
 		}
-		else if ((CurrRetryRate < 29) && (priv->LastRetryRate < 30)) { //TO DO: need to consider (RSSI)
-//		else if ( (CurrRetryRate<49) && (priv->LastRetryRate <50) )
+		else if ((CurrRetryRate < 29) && (priv->LastRetryRate < 30)) { /*TO DO: need to consider (RSSI) */
+/*		else if ( (CurrRetryRate<49) && (priv->LastRetryRate <50) ) */
 			bTryUp = true;
 		}
-		//printk("case9---11M \n");
+		/* printk("case9---11M \n"); */
 	} else if (priv->CurrentOperaRate == 11) {
-		//2For 5.5Mbps
+		/* 2For 5.5Mbps */
 		if (CurrRetryRate > 149) {
-//		if (CurrRetryRate>189)
+/*		if (CurrRetryRate>189) */
 			bTryDown = true;
 		} else if ((CurrRetryRate < 60) && (priv->LastRetryRate < 65)) {
-//		else if ( (CurrRetryRate<80) && (priv->LastRetryRate < 85))
+/*		else if ( (CurrRetryRate<80) && (priv->LastRetryRate < 85)) */
 			bTryUp = true;
 		}
-		//printk("case10---5.5M \n");
+		/* printk("case10---5.5M \n"); */
 	} else if (priv->CurrentOperaRate == 4) {
-		//2For 2 Mbps
+		/* 2For 2 Mbps */
 		if ((CurrRetryRate > 99) && (priv->LastRetryRate > 99)) {
-//		if((CurrRetryRate>199) && (priv->LastRetryRate>199))
+/*		if((CurrRetryRate>199) && (priv->LastRetryRate>199)) */
 			bTryDown = true;
 		} else if ((CurrRetryRate < 65) && (priv->LastRetryRate < 70)) {
-//		else if ( (CurrRetryRate < 85) && (priv->LastRetryRate < 90))
+/*		else if ( (CurrRetryRate < 85) && (priv->LastRetryRate < 90)) */
 			bTryUp = true;
 		}
-		//printk("case11---2M \n");
+		/* printk("case11---2M \n"); */
 	} else if (priv->CurrentOperaRate == 2) {
-		//2For 1 Mbps
+		/* 2For 1 Mbps */
 		if ((CurrRetryRate < 70) && (priv->LastRetryRate < 75)) {
-//		if( (CurrRetryRate<90) && (priv->LastRetryRate<95))
+/*		if( (CurrRetryRate<90) && (priv->LastRetryRate<95)) */
 			bTryUp = true;
 		}
-		//printk("case12---1M \n");
+		/* printk("case12---1M \n"); */
 	}
 
 	if (bTryUp && bTryDown)
 	printk("StaRateAdaptive87B(): Tx Rate tried upping and downing simultaneously!\n");
 
-	//1 Test Upgrading Tx Rate
-	// Sometimes the cause of the low throughput (high retry rate) is the compatibility between the AP and NIC.
-	// To test if the upper rate may cause lower retry rate, this mechanism randomly occurs to test upgrading tx rate.
+	/* 1 Test Upgrading Tx Rate
+	 * Sometimes the cause of the low throughput (high retry rate) is the compatibility between the AP and NIC.
+	 * To test if the upper rate may cause lower retry rate, this mechanism randomly occurs to test upgrading tx rate.
+	 */ 
 	if (!bTryUp && !bTryDown && (priv->TryupingCount == 0) && (priv->TryDownCountLowData == 0)
 		&& priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate && priv->FailTxRateCount < 2) {
 		if (jiffies % (CurrRetryRate + 101) == 0) {
 			bTryUp = true;
 			priv->bTryuping = true;
-			//printk("StaRateAdaptive87SE(): Randomly try upgrading...\n");
+			/* printk("StaRateAdaptive87SE(): Randomly try upgrading...\n"); */
 		}
 	}
 
-	//1 Rate Mechanism
+	/* 1 Rate Mechanism */
 	if (bTryUp) {
 		priv->TryupingCount++;
 		priv->TryDownCountLowData = 0;
 
-//			printk("UP: pHalData->TryupingCount = %d\n", priv->TryupingCount);
-//			printk("UP: TryUpTh(%d)+ (FailTxRateCount(%d))^2 =%d\n",
-//				TryUpTh, priv->FailTxRateCount, (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount) );
-//			printk("UP: pHalData->bTryuping=%d\n",  priv->bTryuping);}
+/*			printk("UP: pHalData->TryupingCount = %d\n", priv->TryupingCount); */
+/*			printk("UP: TryUpTh(%d)+ (FailTxRateCount(%d))^2 =%d\n", */
+/*				TryUpTh, priv->FailTxRateCount, (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount) ); */
+/*			printk("UP: pHalData->bTryuping=%d\n",  priv->bTryuping);} */
 
-		//
-		// Check more times if we need to upgrade indeed.
-		// Because the largest value of pHalData->TryupingCount is 0xFFFF and
-		// the largest value of pHalData->FailTxRateCount is 0x14,
-		// this condition will be satisfied at most every 2 min.
-		//
+		/*
+		 * Check more times if we need to upgrade indeed.
+		 * Because the largest value of pHalData->TryupingCount is 0xFFFF and
+		 * the largest value of pHalData->FailTxRateCount is 0x14,
+		 * this condition will be satisfied at most every 2 min.
+		 */
 
 		if ((priv->TryupingCount > (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount)) ||
 			(CurrSignalStrength > priv->LastFailTxRateSS) || priv->bTryuping) {
 			priv->TryupingCount = 0;
-			//
-			// When transferring from CCK to OFDM, DIG is an important issue.
-			//
+			/*
+			 * When transferring from CCK to OFDM, DIG is an important issue.
+			 */
 			if (priv->CurrentOperaRate == 22)
 				bUpdateInitialGain = true;
 
-			// The difference in throughput between 48Mbps and 36Mbps is 8M.
-			// So, we must be carefully in this rate scale. Isaiah 2008-02-15.
-			//
+			/* 
+			 * The difference in throughput between 48Mbps and 36Mbps is 8M.
+			 * So, we must be carefully in this rate scale. Isaiah 2008-02-15.
+			 */
 			if (((priv->CurrentOperaRate == 72) || (priv->CurrentOperaRate == 48) || (priv->CurrentOperaRate == 36)) &&
 				(priv->FailTxRateCount > 2))
 				priv->RateAdaptivePeriod = (RATE_ADAPTIVE_TIMER_PERIOD / 2);
 
-			// (1)To avoid upgrade frequently to the fail tx rate, add the FailTxRateCount into the threshold.
-			// (2)If the signal strength is increased, it may be able to upgrade.
+			/* (1)To avoid upgrade frequently to the fail tx rate, add the FailTxRateCount into the threshold. */
+			/* (2)If the signal strength is increased, it may be able to upgrade. */
 
 			priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate);
-//			printk("StaRateAdaptive87SE(): Upgrade Tx Rate to %d\n", priv->CurrentOperaRate);
+/*			printk("StaRateAdaptive87SE(): Upgrade Tx Rate to %d\n", priv->CurrentOperaRate); */
 
-			//[TRC Dell Lab] Bypass 12/9/6, Isaiah 2008-02-18 20:00
+			/* [TRC Dell Lab] Bypass 12/9/6, Isaiah 2008-02-18 20:00 */
 			if (priv->CurrentOperaRate == 36) {
 				priv->bUpdateARFR = true;
-				write_nic_word(dev, ARFR, 0x0F8F); //bypass 12/9/6
-//				printk("UP: ARFR=0xF8F\n");
+				write_nic_word(dev, ARFR, 0x0F8F); /* bypass 12/9/6 */
+/*				printk("UP: ARFR=0xF8F\n"); */
 			} else if(priv->bUpdateARFR) {
 				priv->bUpdateARFR = false;
-				write_nic_word(dev, ARFR, 0x0FFF); //set 1M ~ 54Mbps.
-//				printk("UP: ARFR=0xFFF\n");
+				write_nic_word(dev, ARFR, 0x0FFF); /* set 1M ~ 54Mbps. */
+/*				printk("UP: ARFR=0xFFF\n"); */
 			}
 
-			// Update Fail Tx rate and count.
+			/* Update Fail Tx rate and count. */
 			if (priv->LastFailTxRate != priv->CurrentOperaRate) {
 				priv->LastFailTxRate = priv->CurrentOperaRate;
 				priv->FailTxRateCount = 0;
-				priv->LastFailTxRateSS = -200; // Set lowest power.
+				priv->LastFailTxRateSS = -200; /* Set lowest power. */
 			}
 		}
 	} else {
@@ -871,19 +886,19 @@ void StaRateAdaptive87SE(struct net_device *dev)
 		priv->TryDownCountLowData++;
 		priv->TryupingCount = 0;
 
-//			printk("DN: pHalData->TryDownCountLowData = %d\n",priv->TryDownCountLowData);
-//			printk("DN: TryDownTh =%d\n", TryDownTh);
-//			printk("DN: pHalData->bTryuping=%d\n",  priv->bTryuping);
+/*			printk("DN: pHalData->TryDownCountLowData = %d\n",priv->TryDownCountLowData); */
+/*			printk("DN: TryDownTh =%d\n", TryDownTh); */
+/*			printk("DN: pHalData->bTryuping=%d\n",  priv->bTryuping); */
 
 
-		//Check if Tx rate can be degraded or Test trying upgrading should fallback.
+		/* Check if Tx rate can be degraded or Test trying upgrading should fallback. */
 		if (priv->TryDownCountLowData > TryDownTh || priv->bTryuping) {
 			priv->TryDownCountLowData = 0;
 			priv->bTryuping = false;
-			// Update fail information.
+			/* Update fail information. */
 			if (priv->LastFailTxRate == priv->CurrentOperaRate) {
 				priv->FailTxRateCount++;
-				// Record the Tx fail rate signal strength.
+				/* Record the Tx fail rate signal strength. */
 				if (CurrSignalStrength > priv->LastFailTxRateSS)
 					priv->LastFailTxRateSS = CurrSignalStrength;
 			} else {
@@ -893,39 +908,41 @@ void StaRateAdaptive87SE(struct net_device *dev)
 			}
 			priv->CurrentOperaRate = GetDegradeTxRate(dev, priv->CurrentOperaRate);
 
-			// Reduce chariot training time at weak signal strength situation. SD3 ED demand.
-			//[TRC Dell Lab] Revise Signal Threshold from -75 to -80 , Isaiah 2008-02-18 20:00
+			/* Reduce chariot training time at weak signal strength situation. SD3 ED demand. */
+			/* [TRC Dell Lab] Revise Signal Threshold from -75 to -80 , Isaiah 2008-02-18 20:00 */
 			if ((CurrSignalStrength < -80) && (priv->CurrentOperaRate > 72 )) {
 				priv->CurrentOperaRate = 72;
-//				printk("DN: weak signal strength (%d), degrade to 36Mbps\n", CurrSignalStrength);
+/*				printk("DN: weak signal strength (%d), degrade to 36Mbps\n", CurrSignalStrength); */
 			}
 
-			//[TRC Dell Lab] Bypass 12/9/6, Isaiah 2008-02-18 20:00
+			/* [TRC Dell Lab] Bypass 12/9/6, Isaiah 2008-02-18 20:00 */
 			if (priv->CurrentOperaRate == 36) {
 				priv->bUpdateARFR = true;
-				write_nic_word(dev, ARFR, 0x0F8F); //bypass 12/9/6
-//				printk("DN: ARFR=0xF8F\n");
+				write_nic_word(dev, ARFR, 0x0F8F); /* bypass 12/9/6 */
+/*				printk("DN: ARFR=0xF8F\n"); */
 			} else if (priv->bUpdateARFR) {
 				priv->bUpdateARFR = false;
-				write_nic_word(dev, ARFR, 0x0FFF); //set 1M ~ 54Mbps.
-//				printk("DN: ARFR=0xFFF\n");
+				write_nic_word(dev, ARFR, 0x0FFF); /* set 1M ~ 54Mbps. */
+/*				printk("DN: ARFR=0xFFF\n"); */
 			}
 
-			//
-			// When it is CCK rate, it may need to update initial gain to receive lower power packets.
-			//
+			/*
+			 * When it is CCK rate, it may need to update initial gain to receive lower power packets.
+			 */
 			if (MgntIsCckRate(priv->CurrentOperaRate)) {
 				bUpdateInitialGain = true;
 			}
-//			printk("StaRateAdaptive87SE(): Degrade Tx Rate to %d\n", priv->CurrentOperaRate);
+/*			printk("StaRateAdaptive87SE(): Degrade Tx Rate to %d\n", priv->CurrentOperaRate); */
 		}
 	} else {
 		if (priv->TryDownCountLowData > 0)
 			priv->TryDownCountLowData--;
 	}
 
-	// Keep the Tx fail rate count to equal to 0x15 at most.
-	// Reduce the fail count at least to 10 sec if tx rate is tending stable.
+	/* 
+ 	 * Keep the Tx fail rate count to equal to 0x15 at most. 
+	 * Reduce the fail count at least to 10 sec if tx rate is tending stable.
+	 */
 	if (priv->FailTxRateCount >= 0x15 ||
 		(!bTryUp && !bTryDown && priv->TryDownCountLowData == 0 && priv->TryupingCount && priv->FailTxRateCount > 0x6)) {
 		priv->FailTxRateCount--;
@@ -935,60 +952,60 @@ void StaRateAdaptive87SE(struct net_device *dev)
 	OfdmTxPwrIdx  = priv->chtxpwr_ofdm[priv->ieee80211->current_network.channel];
 	CckTxPwrIdx  = priv->chtxpwr[priv->ieee80211->current_network.channel];
 
-	//[TRC Dell Lab] Mac0x9e increase 2 level in 36M~18M situation, Isaiah 2008-02-18 24:00
+	/* [TRC Dell Lab] Mac0x9e increase 2 level in 36M~18M situation, Isaiah 2008-02-18 24:00 */
 	if ((priv->CurrentOperaRate < 96) && (priv->CurrentOperaRate > 22)) {
 		u1bCck = read_nic_byte(dev, CCK_TXAGC);
 		u1bOfdm = read_nic_byte(dev, OFDM_TXAGC);
 
-		// case 1: Never enter High power
+		/* case 1: Never enter High power */
 		if (u1bCck == CckTxPwrIdx) {
 			if (u1bOfdm != (OfdmTxPwrIdx + 2)) {
 			priv->bEnhanceTxPwr = true;
 			u1bOfdm = ((u1bOfdm + 2) > 35) ? 35: (u1bOfdm + 2);
 			write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
-//			printk("Enhance OFDM_TXAGC : +++++ u1bOfdm= 0x%x\n", u1bOfdm);
+/*			printk("Enhance OFDM_TXAGC : +++++ u1bOfdm= 0x%x\n", u1bOfdm); */
 			}
 		} else if (u1bCck < CckTxPwrIdx) {
-		// case 2: enter high power
+		/* case 2: enter high power */
 			if (!priv->bEnhanceTxPwr) {
 				priv->bEnhanceTxPwr = true;
 				u1bOfdm = ((u1bOfdm + 2) > 35) ? 35: (u1bOfdm + 2);
 				write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
-				//RT_TRACE(COMP_RATE, DBG_TRACE, ("Enhance OFDM_TXAGC(2) : +++++ u1bOfdm= 0x%x\n", u1bOfdm));
+				/* RT_TRACE(COMP_RATE, DBG_TRACE, ("Enhance OFDM_TXAGC(2) : +++++ u1bOfdm= 0x%x\n", u1bOfdm)); */
 			}
 		}
-	} else if (priv->bEnhanceTxPwr) {  //54/48/11/5.5/2/1
+	} else if (priv->bEnhanceTxPwr) {  /* 54/48/11/5.5/2/1 */
 		u1bCck = read_nic_byte(dev, CCK_TXAGC);
 		u1bOfdm = read_nic_byte(dev, OFDM_TXAGC);
 
-		// case 1: Never enter High power
+		/* case 1: Never enter High power */
 		if (u1bCck == CckTxPwrIdx) {
 			priv->bEnhanceTxPwr = false;
 			write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
-			//printk("Recover OFDM_TXAGC : ===== u1bOfdm= 0x%x\n", OfdmTxPwrIdx);
+			/*printk("Recover OFDM_TXAGC : ===== u1bOfdm= 0x%x\n", OfdmTxPwrIdx); */
 		}
-		// case 2: enter high power
+		/* case 2: enter high power */
 		else if (u1bCck < CckTxPwrIdx) {
 			priv->bEnhanceTxPwr = false;
 			u1bOfdm = ((u1bOfdm - 2) > 0) ? (u1bOfdm - 2): 0;
 			write_nic_byte(dev, OFDM_TXAGC, u1bOfdm);
-			//RT_TRACE(COMP_RATE, DBG_TRACE, ("Recover OFDM_TXAGC(2): ===== u1bOfdm= 0x%x\n", u1bOfdm));
+			/* RT_TRACE(COMP_RATE, DBG_TRACE, ("Recover OFDM_TXAGC(2): ===== u1bOfdm= 0x%x\n", u1bOfdm)); */
 
 		}
 	}
 
-	//
-	// We need update initial gain when we set tx rate "from OFDM to CCK" or
-	// "from CCK to OFDM".
-	//
+	/*
+	 * We need update initial gain when we set tx rate "from OFDM to CCK" or
+	 * "from CCK to OFDM".
+	 */
 SetInitialGain:
 	if (bUpdateInitialGain) {
-		if (MgntIsCckRate(priv->CurrentOperaRate)) { // CCK
+		if (MgntIsCckRate(priv->CurrentOperaRate)) { /* CCK */
 			if (priv->InitialGain > priv->RegBModeGainStage) {
 				priv->InitialGainBackUp = priv->InitialGain;
 
-				if (CurrSignalStrength < -85) // Low power, OFDM [0x17] = 26.
-					//SD3 SYs suggest that CurrSignalStrength < -65, ofdm 0x17=26.
+				if (CurrSignalStrength < -85) /* Low power, OFDM [0x17] = 26. */
+					/* SD3 SYs suggest that CurrSignalStrength < -65, ofdm 0x17=26. */
 					priv->InitialGain = priv->RegBModeGainStage;
 
 				else if (priv->InitialGain > priv->RegBModeGainStage + 1)
@@ -1000,7 +1017,7 @@ SetInitialGain:
 				printk("StaRateAdaptive87SE(): update init_gain to index %d for date rate %d\n",priv->InitialGain, priv->CurrentOperaRate);
 				UpdateInitialGain(dev);
 			}
-		} else { // OFDM
+		} else { /* OFDM */
 			if (priv->InitialGain < 4) {
 				priv->InitialGainBackUp = priv->InitialGain;
 
@@ -1011,7 +1028,7 @@ SetInitialGain:
 		}
 	}
 
-	//Record the related info
+	/* Record the related info */
 	priv->LastRetryRate = CurrRetryRate;
 	priv->LastTxThroughput = TxThroughput;
 	priv->ieee80211->rate = priv->CurrentOperaRate * 5;
@@ -1022,62 +1039,62 @@ void rtl8180_rate_adapter(struct work_struct *work)
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, rate_adapter_wq);
 	struct net_device *dev = ieee->dev;
-	//struct r8180_priv *priv = ieee80211_priv(dev);
-//    DMESG("---->rtl8180_rate_adapter");
+	/* struct r8180_priv *priv = ieee80211_priv(dev); */
+/*    DMESG("---->rtl8180_rate_adapter"); */
 	StaRateAdaptive87SE(dev);
-//   DMESG("<----rtl8180_rate_adapter");
+/*   DMESG("<----rtl8180_rate_adapter"); */
 }
 void timer_rate_adaptive(unsigned long data)
 {
 	struct r8180_priv *priv = ieee80211_priv((struct net_device *)data);
-	//DMESG("---->timer_rate_adaptive()\n");
+	/* DMESG("---->timer_rate_adaptive()\n"); */
 	if (!priv->up) {
-//		DMESG("<----timer_rate_adaptive():driver is not up!\n");
+/*		DMESG("<----timer_rate_adaptive():driver is not up!\n"); */
 		return;
 	}
 	if ((priv->ieee80211->iw_mode != IW_MODE_MASTER)
 			&& (priv->ieee80211->state == IEEE80211_LINKED) &&
 			(priv->ForcedDataRate == 0)) {
-//	DMESG("timer_rate_adaptive():schedule rate_adapter_wq\n");
+/*	DMESG("timer_rate_adaptive():schedule rate_adapter_wq\n"); */
 		queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->rate_adapter_wq);
-//		StaRateAdaptive87SE((struct net_device *)data);
+/*		StaRateAdaptive87SE((struct net_device *)data); */
 	}
 	priv->rateadapter_timer.expires = jiffies + MSECS(priv->RateAdaptivePeriod);
 	add_timer(&priv->rateadapter_timer);
-	//DMESG("<----timer_rate_adaptive()\n");
+	/* DMESG("<----timer_rate_adaptive()\n"); */
 }
-//by amy 080312}
+/* by amy 080312} */
 void SwAntennaDiversityRxOk8185(struct net_device *dev, u8 SignalStrength)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
-//	printk("+SwAntennaDiversityRxOk8185: RxSs: %d\n", SignalStrength);
+/*	printk("+SwAntennaDiversityRxOk8185: RxSs: %d\n", SignalStrength); */
 
 	priv->AdRxOkCnt++;
 
 	if (priv->AdRxSignalStrength != -1) {
 		priv->AdRxSignalStrength = ((priv->AdRxSignalStrength * 7) + (SignalStrength * 3)) / 10;
-	} else { // Initialization case.
+	} else { /* Initialization case. */
 		priv->AdRxSignalStrength = SignalStrength;
 	}
-//{+by amy 080312
-	if (priv->LastRxPktAntenna) //Main antenna.
+/* {+by amy 080312 */
+	if (priv->LastRxPktAntenna) /* Main antenna. */
 		priv->AdMainAntennaRxOkCnt++;
-	else	 // Aux antenna.
+	else	 /* Aux antenna. */
 		priv->AdAuxAntennaRxOkCnt++;
-//+by amy 080312
-//	printk("-SwAntennaDiversityRxOk8185: AdRxOkCnt: %d AdRxSignalStrength: %d\n", priv->AdRxOkCnt, priv->AdRxSignalStrength);
+/* +by amy 080312 */
+/*	printk("-SwAntennaDiversityRxOk8185: AdRxOkCnt: %d AdRxSignalStrength: %d\n", priv->AdRxOkCnt, priv->AdRxSignalStrength); */
 }
-//
-//	Description:
-//		Change Antenna Switch.
-//
+/*
+ *	Description:
+ *		Change Antenna Switch.
+ */
 bool SetAntenna8185(struct net_device *dev, u8 u1bAntennaIndex)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	bool bAntennaSwitched = false;
 
-//	printk("+SetAntenna8185(): Antenna is switching to: %d \n", u1bAntennaIndex);
+/*	printk("+SetAntenna8185(): Antenna is switching to: %d \n", u1bAntennaIndex); */
 
 	switch (u1bAntennaIndex) {
 	case 0:
@@ -1109,14 +1126,14 @@ bool SetAntenna8185(struct net_device *dev, u8 u1bAntennaIndex)
 	if(bAntennaSwitched)
 		priv->CurrAntennaIndex = u1bAntennaIndex;
 
-//	printk("-SetAntenna8185(): return (%#X)\n", bAntennaSwitched);
+/*	printk("-SetAntenna8185(): return (%#X)\n", bAntennaSwitched); */
 
 	return bAntennaSwitched;
 }
-//
-//	Description:
-//		Toggle Antenna switch.
-//
+/*
+ *	Description:
+ *		Toggle Antenna switch.
+ */
 bool SwitchAntenna(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -1125,33 +1142,37 @@ bool SwitchAntenna(struct net_device *dev)
 
 	if (priv->CurrAntennaIndex == 0) {
 		bResult = SetAntenna8185(dev, 1);
-//by amy 080312
-//		printk("SwitchAntenna(): switching to antenna 1 ......\n");
-//		bResult = SetAntenna8185(dev, 1);//-by amy 080312
+/* 
+ * by amy 080312
+ *		printk("SwitchAntenna(): switching to antenna 1 ......\n");
+ *		bResult = SetAntenna8185(dev, 1);//-by amy 080312
+ */
 	} else {
 		bResult = SetAntenna8185(dev, 0);
-//by amy 080312
-//		printk("SwitchAntenna(): switching to antenna 0 ......\n");
-//		bResult = SetAntenna8185(dev, 0);//-by amy 080312
+/*
+ * by amy 080312
+ *		printk("SwitchAntenna(): switching to antenna 0 ......\n");
+ *		bResult = SetAntenna8185(dev, 0);//-by amy 080312
+ */
 	}
 
 	return bResult;
 }
-//
-//	Description:
-//		Engine of SW Antenna Diversity mechanism.
-//		Since 8187 has no Tx part information,
-//		this implementation is only dependend on Rx part information.
-//
-//	2006.04.17, by rcnjko.
-//
+/*
+ *	Description:
+ *		Engine of SW Antenna Diversity mechanism.
+ *		Since 8187 has no Tx part information,
+ *		this implementation is only dependend on Rx part information.
+ *
+ *	2006.04.17, by rcnjko.
+ */
 void SwAntennaDiversity(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	bool   bSwCheckSS = false;
-//	printk("+SwAntennaDiversity(): CurrAntennaIndex: %d\n", priv->CurrAntennaIndex);
-//	printk("AdTickCount is %d\n",priv->AdTickCount);
-//by amy 080312
+/*	printk("+SwAntennaDiversity(): CurrAntennaIndex: %d\n", priv->CurrAntennaIndex); */
+/*	printk("AdTickCount is %d\n",priv->AdTickCount); */
+/* by amy 080312 */
 	if (bSwCheckSS) {
 		priv->AdTickCount++;
 
@@ -1160,168 +1181,169 @@ void SwAntennaDiversity(struct net_device *dev)
 		printk("(2) AdRxSignalStrength: %ld, AdRxSsThreshold: %ld\n",
 			priv->AdRxSignalStrength, priv->AdRxSsThreshold);
 	}
-//	priv->AdTickCount++;//-by amy 080312
+/*	priv->AdTickCount++;//-by amy 080312 */
 
-	// Case 1. No Link.
+	/* Case 1. No Link. */
 	if (priv->ieee80211->state != IEEE80211_LINKED) {
-	//	printk("SwAntennaDiversity(): Case 1. No Link.\n");
+	/*	printk("SwAntennaDiversity(): Case 1. No Link.\n"); */
 
 		priv->bAdSwitchedChecking = false;
-		// I switch antenna here to prevent any one of antenna is broken before link established, 2006.04.18, by rcnjko..
+		/* I switch antenna here to prevent any one of antenna is broken before link established, 2006.04.18, by rcnjko.. */
 		SwitchAntenna(dev);
 
-	  // Case 2. Linked but no packet receive.d
+	  /* Case 2. Linked but no packet receive.d */
 	} else if (priv->AdRxOkCnt == 0) {
-	//	printk("SwAntennaDiversity(): Case 2. Linked but no packet received.\n");
+	/*	printk("SwAntennaDiversity(): Case 2. Linked but no packet received.\n"); */
 
 		priv->bAdSwitchedChecking = false;
 		SwitchAntenna(dev);
 
-	  // Case 3. Evaluate last antenna switch action and undo it if necessary.
+	  /* Case 3. Evaluate last antenna switch action and undo it if necessary. */
 	} else if (priv->bAdSwitchedChecking == true) {
-	//	printk("SwAntennaDiversity(): Case 3. Evaluate last antenna switch action.\n");
+	/*	printk("SwAntennaDiversity(): Case 3. Evaluate last antenna switch action.\n"); */
 
 		priv->bAdSwitchedChecking = false;
 
-		// Adjust Rx signal strength threshold.
+		/* Adjust Rx signal strength threshold. */
 		priv->AdRxSsThreshold = (priv->AdRxSignalStrength + priv->AdRxSsBeforeSwitched) / 2;
 
 		priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ?
 					priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold;
 		if(priv->AdRxSignalStrength < priv->AdRxSsBeforeSwitched) {
-		// Rx signal strength is not improved after we swtiched antenna. => Swich back.
-//			printk("SwAntennaDiversity(): Rx Signal Strength is not improved, CurrRxSs: %d, LastRxSs: %d\n",
-//				priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched);
-//by amy 080312
-			// Increase Antenna Diversity checking period due to bad decision.
+		/* Rx signal strength is not improved after we swtiched antenna. => Swich back. */
+/*			printk("SwAntennaDiversity(): Rx Signal Strength is not improved, CurrRxSs: %d, LastRxSs: %d\n", */
+/*				priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched); */
+/* by amy 080312 */
+			/* Increase Antenna Diversity checking period due to bad decision. */
 			priv->AdCheckPeriod *= 2;
-//by amy 080312
-			// Increase Antenna Diversity checking period.
+/* by amy 080312 */
+			/* Increase Antenna Diversity checking period. */
 			if (priv->AdCheckPeriod > priv->AdMaxCheckPeriod)
 				priv->AdCheckPeriod = priv->AdMaxCheckPeriod;
 
-			// Wrong deceision => switch back.
+			/* Wrong deceision => switch back. */
 			SwitchAntenna(dev);
 		} else {
-		// Rx Signal Strength is improved.
-//			printk("SwAntennaDiversity(): Rx Signal Strength is improved, CurrRxSs: %d, LastRxSs: %d\n",
-//				priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched);
+		/* Rx Signal Strength is improved. */
+/*			printk("SwAntennaDiversity(): Rx Signal Strength is improved, CurrRxSs: %d, LastRxSs: %d\n", */
+/*				priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched); */
 
-			// Reset Antenna Diversity checking period to its min value.
+			/* Reset Antenna Diversity checking period to its min value. */
 			priv->AdCheckPeriod = priv->AdMinCheckPeriod;
 		}
 
-//		printk("SwAntennaDiversity(): AdRxSsThreshold: %d, AdCheckPeriod: %d\n",
-//			priv->AdRxSsThreshold, priv->AdCheckPeriod);
+/*		printk("SwAntennaDiversity(): AdRxSsThreshold: %d, AdCheckPeriod: %d\n", */
+/*			priv->AdRxSsThreshold, priv->AdCheckPeriod); */
 	}
-	// Case 4. Evaluate if we shall switch antenna now.
-	// Cause Table Speed is very fast in TRC Dell Lab, we check it every time.
-	else { // if(priv->AdTickCount >= priv->AdCheckPeriod)//-by amy 080312
-//		printk("SwAntennaDiversity(): Case 4. Evaluate if we shall switch antenna now.\n");
+	/* Case 4. Evaluate if we shall switch antenna now. */
+	/* Cause Table Speed is very fast in TRC Dell Lab, we check it every time. */
+	else { /* if(priv->AdTickCount >= priv->AdCheckPeriod)//-by amy 080312 */
+/*		printk("SwAntennaDiversity(): Case 4. Evaluate if we shall switch antenna now.\n"); */
 
 		priv->AdTickCount = 0;
 
-		//
-		// <Roger_Notes> We evaluate RxOk counts for each antenna first and than
-		// evaluate signal strength.
-		// The following operation can overcome the disability of CCA on both two antennas
-		// When signal strength was extremely low or high.
-		// 2008.01.30.
-		//
-
-		//
-		// Evaluate RxOk count from each antenna if we shall switch default antenna now.
-		// Added by Roger, 2008.02.21.
-//{by amy 080312
+		/*
+		 * <Roger_Notes> We evaluate RxOk counts for each antenna first and than
+		 * evaluate signal strength.
+		 * The following operation can overcome the disability of CCA on both two antennas
+		 * When signal strength was extremely low or high.
+		 * 2008.01.30.
+		 */
+
+		/*
+		 * Evaluate RxOk count from each antenna if we shall switch default antenna now.
+		 * Added by Roger, 2008.02.21.
+		 */
+/* {by amy 080312 */
 		if ((priv->AdMainAntennaRxOkCnt < priv->AdAuxAntennaRxOkCnt)
 			&& (priv->CurrAntennaIndex == 0)) {
-		// We set Main antenna as default but RxOk count was less than Aux ones.
+		/* We set Main antenna as default but RxOk count was less than Aux ones. */
 
-	//		printk("SwAntennaDiversity(): Main antenna RxOK is poor, AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",
-	//			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt);
+	/*		printk("SwAntennaDiversity(): Main antenna RxOK is poor, AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n", */
+	/*			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt); */
 
-			// Switch to Aux antenna.
+			/* Switch to Aux antenna. */
 			SwitchAntenna(dev);
 			priv->bHWAdSwitched = true;
 		} else if ((priv->AdAuxAntennaRxOkCnt < priv->AdMainAntennaRxOkCnt)
 			&& (priv->CurrAntennaIndex == 1)) {
-		// We set Aux antenna as default but RxOk count was less than Main ones.
+		/* We set Aux antenna as default but RxOk count was less than Main ones. */
 
-	//		printk("SwAntennaDiversity(): Aux antenna RxOK is poor, AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",
-	//			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt);
+	/*		printk("SwAntennaDiversity(): Aux antenna RxOK is poor, AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n", */
+	/*			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt); */
 
-			// Switch to Main antenna.
+			/* Switch to Main antenna. */
 			SwitchAntenna(dev);
 			priv->bHWAdSwitched = true;
 		} else {
-		// Default antenna is better.
+		/* Default antenna is better. */
 
-	//		printk("SwAntennaDiversity(): Default antenna is better., AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",
-	//			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt);
+	/*		printk("SwAntennaDiversity(): Default antenna is better., AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n", */
+	/*			priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt); */
 
-			// Still need to check current signal strength.
+			/* Still need to check current signal strength. */
 			priv->bHWAdSwitched = false;
 		}
-		//
-		// <Roger_Notes> We evaluate Rx signal strength ONLY when default antenna
-		// didn't changed by HW evaluation.
-		// 2008.02.27.
-		//
-		// [TRC Dell Lab] SignalStrength is inaccuracy. Isaiah 2008-03-05
-		// For example, Throughput of aux is better than main antenna(about 10M v.s 2M),
-		// but AdRxSignalStrength is less than main.
-		// Our guess is that main antenna have lower throughput and get many change
-		// to receive more CCK packets(ex.Beacon) which have stronger SignalStrength.
-		//
+		/*
+		 * <Roger_Notes> We evaluate Rx signal strength ONLY when default antenna
+		 * didn't changed by HW evaluation.
+		 * 2008.02.27.
+		 *
+		 * [TRC Dell Lab] SignalStrength is inaccuracy. Isaiah 2008-03-05
+		 * For example, Throughput of aux is better than main antenna(about 10M v.s 2M),
+		 * but AdRxSignalStrength is less than main.
+		 * Our guess is that main antenna have lower throughput and get many change
+		 * to receive more CCK packets(ex.Beacon) which have stronger SignalStrength.
+		 */
 		if ((!priv->bHWAdSwitched) && (bSwCheckSS)) {
-//by amy 080312}
-			// Evaluate Rx signal strength if we shall switch antenna now.
+/* by amy 080312} */
+			/* Evaluate Rx signal strength if we shall switch antenna now. */
 			if (priv->AdRxSignalStrength < priv->AdRxSsThreshold) {
-			// Rx signal strength is weak => Switch Antenna.
-//				printk("SwAntennaDiversity(): Rx Signal Strength is weak, CurrRxSs: %d, RxSsThreshold: %d\n",
-//				priv->AdRxSignalStrength, priv->AdRxSsThreshold);
+			/* Rx signal strength is weak => Switch Antenna. */
+/*				printk("SwAntennaDiversity(): Rx Signal Strength is weak, CurrRxSs: %d, RxSsThreshold: %d\n", */
+/*				priv->AdRxSignalStrength, priv->AdRxSsThreshold); */
 
 				priv->AdRxSsBeforeSwitched = priv->AdRxSignalStrength;
 				priv->bAdSwitchedChecking = true;
 
 				SwitchAntenna(dev);
 			} else {
-			// Rx signal strength is OK.
-//				printk("SwAntennaDiversity(): Rx Signal Strength is OK, CurrRxSs: %d, RxSsThreshold: %d\n",
-//				priv->AdRxSignalStrength, priv->AdRxSsThreshold);
+			/* Rx signal strength is OK. */
+/*				printk("SwAntennaDiversity(): Rx Signal Strength is OK, CurrRxSs: %d, RxSsThreshold: %d\n", */
+/*				priv->AdRxSignalStrength, priv->AdRxSsThreshold); */
 
 				priv->bAdSwitchedChecking = false;
-				// Increase Rx signal strength threshold if necessary.
-				if ((priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && // Signal is much stronger than current threshold
-					priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) { // Current threhold is not yet reach upper limit.
+				/* Increase Rx signal strength threshold if necessary. */
+				if ((priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && /* Signal is much stronger than current threshold */
+					priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) { /* Current threhold is not yet reach upper limit. */
 
 					priv->AdRxSsThreshold = (priv->AdRxSsThreshold + priv->AdRxSignalStrength) / 2;
 					priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ?
-								priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold;//+by amy 080312
+								priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold;/* +by amy 080312 */
 				}
 
-				// Reduce Antenna Diversity checking period if possible.
+				/* Reduce Antenna Diversity checking period if possible. */
 				if (priv->AdCheckPeriod > priv->AdMinCheckPeriod)
 					priv->AdCheckPeriod /= 2;
 			}
 		}
 	}
-//by amy 080312
-	// Reset antenna diversity Rx related statistics.
+/* by amy 080312 */
+	/* Reset antenna diversity Rx related statistics. */
 	priv->AdRxOkCnt = 0;
 	priv->AdMainAntennaRxOkCnt = 0;
 	priv->AdAuxAntennaRxOkCnt = 0;
-//by amy 080312
+/* by amy 080312 */
 
-//	priv->AdRxOkCnt = 0;//-by amy 080312
+/*	priv->AdRxOkCnt = 0;//-by amy 080312 */
 
-//	printk("-SwAntennaDiversity()\n");
+/*	printk("-SwAntennaDiversity()\n"); */
 }
 
-//
-//	Description:
-//		Return TRUE if we shall perform Tx Power Tracking Mecahnism, FALSE otherwise.
-//
+/*
+ *	Description:
+ *		Return TRUE if we shall perform Tx Power Tracking Mecahnism, FALSE otherwise.
+ */
 bool CheckTxPwrTracking(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -1329,13 +1351,15 @@ bool CheckTxPwrTracking(struct net_device *dev)
 	if (!priv->bTxPowerTrack)
 		return false;
 
-//lzm reserved 080826
-	//if(priv->bScanInProgress)
-	//{
-	//	return false;
-	//}
+/* lzm reserved 080826 */
+	/* 
+	 * if(priv->bScanInProgress)
+	 * {
+	 * 	return false;
+	 * }
+	 */
 
-	//if 87SE is in High Power , don't do Tx Power Tracking. asked by SD3 ED. 2008-08-08 Isaiah
+	/* if 87SE is in High Power , don't do Tx Power Tracking. asked by SD3 ED. 2008-08-08 Isaiah */
 	if (priv->bToUpdateTxPwr)
 		return false;
 
@@ -1343,29 +1367,29 @@ bool CheckTxPwrTracking(struct net_device *dev)
 }
 
 
-//
-//	Description:
-//		Timer callback function of SW Antenna Diversity.
-//
+/*
+ *	Description:
+ *		Timer callback function of SW Antenna Diversity.
+ */
 void SwAntennaDiversityTimerCallback(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	RT_RF_POWER_STATE rtState;
 
-	//printk("+SwAntennaDiversityTimerCallback()\n");
+	/* printk("+SwAntennaDiversityTimerCallback()\n"); */
 
-	//
-	// We do NOT need to switch antenna while RF is off.
-	// 2007.05.09, added by Roger.
-	//
+	/*
+	 * We do NOT need to switch antenna while RF is off.
+	 * 2007.05.09, added by Roger.
+	 */
 	rtState = priv->eRFPowerState;
 	do {
 		if (rtState == eRfOff) {
-//			printk("SwAntennaDiversityTimer - RF is OFF.\n");
+/*			printk("SwAntennaDiversityTimer - RF is OFF.\n"); */
 			break;
 		} else if (rtState == eRfSleep) {
-			// Don't access BB/RF under Disable PLL situation.
-			//RT_TRACE((COMP_RF|COMP_ANTENNA), DBG_LOUD, ("SwAntennaDiversityTimerCallback(): RF is Sleep => skip it\n"));
+			/* Don't access BB/RF under Disable PLL situation. */
+			/* RT_TRACE((COMP_RF|COMP_ANTENNA), DBG_LOUD, ("SwAntennaDiversityTimerCallback(): RF is Sleep => skip it\n")); */
 			break;
 		}
 		SwAntennaDiversity(dev);
@@ -1377,6 +1401,6 @@ void SwAntennaDiversityTimerCallback(struct net_device *dev)
 		add_timer(&priv->SwAntennaDiversityTimer);
 	}
 
-	//printk("-SwAntennaDiversityTimerCallback()\n");
+	/* printk("-SwAntennaDiversityTimerCallback()\n"); */
 }
 
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments
  2012-03-15 19:05 ` [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments Andrew Miller
@ 2012-03-15 19:34   ` Dan Carpenter
  2012-03-15 20:49     ` Andrew Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2012-03-15 19:34 UTC (permalink / raw)
  To: Andrew Miller; +Cc: gregkh, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 413 bytes --]

On Thu, Mar 15, 2012 at 03:05:21PM -0400, Andrew Miller wrote:
> -//+by amy 080312
> +/*{by amy 080312 */
      ^^^^^^^^^^^^^
Just remove these comments.  We use version control to see who is
doing what.

>  
> -	//printk("----> DoTxHighPower()\n");
> +	/* printk("----> DoTxHighPower()\n"); */
>  

Also this dead debugging code can be deleted.  There was a bunch of
it.

regards,
dan carpenter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments
  2012-03-15 19:34   ` Dan Carpenter
@ 2012-03-15 20:49     ` Andrew Miller
  2012-03-15 21:08       ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Miller @ 2012-03-15 20:49 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, devel, linux-kernel

On Thu, Mar 15, 2012 at 10:34:05PM +0300, Dan Carpenter wrote:
> On Thu, Mar 15, 2012 at 03:05:21PM -0400, Andrew Miller wrote:
> > -//+by amy 080312
> > +/*{by amy 080312 */
>       ^^^^^^^^^^^^^
> Just remove these comments.  We use version control to see who is
> doing what.
> 
> >  
> > -	//printk("----> DoTxHighPower()\n");
> > +	/* printk("----> DoTxHighPower()\n"); */
> >  
> 
> Also this dead debugging code can be deleted.  There was a bunch of
> it.
> 
> regards,
> dan carpenter

Thanks for the advice, If the patch goes through. I'll make another one 
with this changes. If not then I will include them when I revise it.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments
  2012-03-15 20:49     ` Andrew Miller
@ 2012-03-15 21:08       ` Greg KH
  2012-03-15 21:15         ` Andrew Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2012-03-15 21:08 UTC (permalink / raw)
  To: Andrew Miller; +Cc: Dan Carpenter, devel, linux-kernel

On Thu, Mar 15, 2012 at 04:49:23PM -0400, Andrew Miller wrote:
> On Thu, Mar 15, 2012 at 10:34:05PM +0300, Dan Carpenter wrote:
> > On Thu, Mar 15, 2012 at 03:05:21PM -0400, Andrew Miller wrote:
> > > -//+by amy 080312
> > > +/*{by amy 080312 */
> >       ^^^^^^^^^^^^^
> > Just remove these comments.  We use version control to see who is
> > doing what.
> > 
> > >  
> > > -	//printk("----> DoTxHighPower()\n");
> > > +	/* printk("----> DoTxHighPower()\n"); */
> > >  
> > 
> > Also this dead debugging code can be deleted.  There was a bunch of
> > it.
> > 
> > regards,
> > dan carpenter
> 
> Thanks for the advice, If the patch goes through. I'll make another one 
> with this changes. If not then I will include them when I revise it.

Send another one on top of this one that removes those unneeded
comments, as I've just applied all of the patches in this series.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments
  2012-03-15 21:08       ` Greg KH
@ 2012-03-15 21:15         ` Andrew Miller
  2012-03-15 21:24           ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Miller @ 2012-03-15 21:15 UTC (permalink / raw)
  To: Greg KH; +Cc: Dan Carpenter, devel, linux-kernel

On Thu, Mar 15, 2012 at 02:08:56PM -0700, Greg KH wrote:
> On Thu, Mar 15, 2012 at 04:49:23PM -0400, Andrew Miller wrote:
> > On Thu, Mar 15, 2012 at 10:34:05PM +0300, Dan Carpenter wrote:
> > > On Thu, Mar 15, 2012 at 03:05:21PM -0400, Andrew Miller wrote:
> > > > -//+by amy 080312
> > > > +/*{by amy 080312 */
> > >       ^^^^^^^^^^^^^
> > > Just remove these comments.  We use version control to see who is
> > > doing what.
> > > 
> > > >  
> > > > -	//printk("----> DoTxHighPower()\n");
> > > > +	/* printk("----> DoTxHighPower()\n"); */
> > > >  
> > > 
> > > Also this dead debugging code can be deleted.  There was a bunch of
> > > it.
> > > 
> > > regards,
> > > dan carpenter
> > 
> > Thanks for the advice, If the patch goes through. I'll make another one 
> > with this changes. If not then I will include them when I revise it.
> 
> Send another one on top of this one that removes those unneeded
> comments, as I've just applied all of the patches in this series.
> 
> thanks,
> 
> greg k-h

What about the old code that is commented out?
There is about one line of code commented out per
two line of code.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments
  2012-03-15 21:15         ` Andrew Miller
@ 2012-03-15 21:24           ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2012-03-15 21:24 UTC (permalink / raw)
  To: Andrew Miller; +Cc: Dan Carpenter, devel, linux-kernel

On Thu, Mar 15, 2012 at 05:15:52PM -0400, Andrew Miller wrote:
> On Thu, Mar 15, 2012 at 02:08:56PM -0700, Greg KH wrote:
> > On Thu, Mar 15, 2012 at 04:49:23PM -0400, Andrew Miller wrote:
> > > On Thu, Mar 15, 2012 at 10:34:05PM +0300, Dan Carpenter wrote:
> > > > On Thu, Mar 15, 2012 at 03:05:21PM -0400, Andrew Miller wrote:
> > > > > -//+by amy 080312
> > > > > +/*{by amy 080312 */
> > > >       ^^^^^^^^^^^^^
> > > > Just remove these comments.  We use version control to see who is
> > > > doing what.
> > > > 
> > > > >  
> > > > > -	//printk("----> DoTxHighPower()\n");
> > > > > +	/* printk("----> DoTxHighPower()\n"); */
> > > > >  
> > > > 
> > > > Also this dead debugging code can be deleted.  There was a bunch of
> > > > it.
> > > > 
> > > > regards,
> > > > dan carpenter
> > > 
> > > Thanks for the advice, If the patch goes through. I'll make another one 
> > > with this changes. If not then I will include them when I revise it.
> > 
> > Send another one on top of this one that removes those unneeded
> > comments, as I've just applied all of the patches in this series.
> > 
> > thanks,
> > 
> > greg k-h
> 
> What about the old code that is commented out?
> There is about one line of code commented out per
> two line of code.

Just delete it, it's obviously not being used :)


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-03-15 21:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 19:05 [PATCH 0/5] Staging: rtl8187se: r8180_dm.c: Fix Coding Style issues Andrew Miller
2012-03-15 19:05 ` [PATCH 1/5] Staging: rtl8187se: r8180_dm.c: Removed spaces before tab stop Andrew Miller
2012-03-15 19:05 ` [PATCH 2/5] Staging: rtl8187se: r8180_dm.c: Fix brackets Andrew Miller
2012-03-15 19:05 ` [PATCH 3/5] Staging: rtl8187se: r8180_dm.c Fixed indentation issues Andrew Miller
2012-03-15 19:05 ` [PATCH 4/5] Staging: rtl8187se: r8180_dm.c: Fix spacing issues Andrew Miller
2012-03-15 19:05 ` [PATCH 5/5] Staging: rtl8187se: r8180_dm.c: Fix comments Andrew Miller
2012-03-15 19:34   ` Dan Carpenter
2012-03-15 20:49     ` Andrew Miller
2012-03-15 21:08       ` Greg KH
2012-03-15 21:15         ` Andrew Miller
2012-03-15 21:24           ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox