All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8188eu: Remove redundant if conditions
@ 2015-02-23 15:06 Vatika Harlalka
  2015-02-23 19:25 ` [Outreachy kernel] " Jes Sorensen
  2015-02-26 20:52 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Vatika Harlalka @ 2015-02-23 15:06 UTC (permalink / raw)
  To: outreachy-kernel

The if branches are redundant as is2t is declared false
and is not modified before the if statements.

Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
---
 drivers/staging/rtl8188eu/hal/phy.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c
index e005150..e7ede44 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -471,7 +471,8 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
 	u32 i = 0, j = 0;
 	bool is2t = false;
 
-	u8 ofdm_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB */
+	u8 ofdm_min_index = 6;
+	u8  rf = 1; /* OFDM BB Swing should be less than +3.0dB */
 	u8 indexforchannel = 0;
 	s8 ofdm_index_mapping[2][index_mapping_NUM_88E] = {
 		/* 2.4G, decrease power */
@@ -496,12 +497,6 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
 
 	thermal_val = (u8)phy_query_rf_reg(adapt, RF_PATH_A,
 					   RF_T_METER_88E, 0xfc00);
-
-	if (is2t)
-		rf = 2;
-	else
-		rf = 1;
-
 	if (thermal_val) {
 		/* Query OFDM path A default setting */
 		ele_d = phy_query_bb_reg(adapt, rOFDM0_XATxIQImbalance, bMaskDWord)&bMaskOFDM_D;
@@ -513,17 +508,6 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
 			}
 		}
 
-		/* Query OFDM path B default setting */
-		if (is2t) {
-			ele_d = phy_query_bb_reg(adapt, rOFDM0_XBTxIQImbalance, bMaskDWord)&bMaskOFDM_D;
-			for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {
-				if (ele_d == (OFDMSwingTable[i]&bMaskOFDM_D)) {
-					ofdm_index_old[1] = (u8)i;
-					break;
-				}
-			}
-		}
-
 		/* Query CCK default setting From 0xa24 */
 		temp_cck = dm_odm->RFCalibrateInfo.RegA24;
 
-- 
1.9.1



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

* Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: Remove redundant if conditions
  2015-02-23 15:06 [PATCH] Staging: rtl8188eu: Remove redundant if conditions Vatika Harlalka
@ 2015-02-23 19:25 ` Jes Sorensen
  2015-02-26 20:52 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2015-02-23 19:25 UTC (permalink / raw)
  To: Vatika Harlalka, outreachy-kernel

On 02/23/15 10:06, Vatika Harlalka wrote:
> The if branches are redundant as is2t is declared false
> and is not modified before the if statements.
> 
> Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
> ---
>  drivers/staging/rtl8188eu/hal/phy.c | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)

This one is perfect!

Jes


> diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c
> index e005150..e7ede44 100644
> --- a/drivers/staging/rtl8188eu/hal/phy.c
> +++ b/drivers/staging/rtl8188eu/hal/phy.c
> @@ -471,7 +471,8 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
>  	u32 i = 0, j = 0;
>  	bool is2t = false;
>  
> -	u8 ofdm_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB */
> +	u8 ofdm_min_index = 6;
> +	u8  rf = 1; /* OFDM BB Swing should be less than +3.0dB */
>  	u8 indexforchannel = 0;
>  	s8 ofdm_index_mapping[2][index_mapping_NUM_88E] = {
>  		/* 2.4G, decrease power */
> @@ -496,12 +497,6 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
>  
>  	thermal_val = (u8)phy_query_rf_reg(adapt, RF_PATH_A,
>  					   RF_T_METER_88E, 0xfc00);
> -
> -	if (is2t)
> -		rf = 2;
> -	else
> -		rf = 1;
> -
>  	if (thermal_val) {
>  		/* Query OFDM path A default setting */
>  		ele_d = phy_query_bb_reg(adapt, rOFDM0_XATxIQImbalance, bMaskDWord)&bMaskOFDM_D;
> @@ -513,17 +508,6 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
>  			}
>  		}
>  
> -		/* Query OFDM path B default setting */
> -		if (is2t) {
> -			ele_d = phy_query_bb_reg(adapt, rOFDM0_XBTxIQImbalance, bMaskDWord)&bMaskOFDM_D;
> -			for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {
> -				if (ele_d == (OFDMSwingTable[i]&bMaskOFDM_D)) {
> -					ofdm_index_old[1] = (u8)i;
> -					break;
> -				}
> -			}
> -		}
> -
>  		/* Query CCK default setting From 0xa24 */
>  		temp_cck = dm_odm->RFCalibrateInfo.RegA24;
>  
> 



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

* Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: Remove redundant if conditions
  2015-02-23 15:06 [PATCH] Staging: rtl8188eu: Remove redundant if conditions Vatika Harlalka
  2015-02-23 19:25 ` [Outreachy kernel] " Jes Sorensen
@ 2015-02-26 20:52 ` Greg KH
  2015-02-27  6:05   ` Vatika Harlalka
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2015-02-26 20:52 UTC (permalink / raw)
  To: Vatika Harlalka; +Cc: outreachy-kernel

On Mon, Feb 23, 2015 at 08:36:47PM +0530, Vatika Harlalka wrote:
> The if branches are redundant as is2t is declared false
> and is not modified before the if statements.
> 
> Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
> ---
>  drivers/staging/rtl8188eu/hal/phy.c | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c
> index e005150..e7ede44 100644
> --- a/drivers/staging/rtl8188eu/hal/phy.c
> +++ b/drivers/staging/rtl8188eu/hal/phy.c
> @@ -471,7 +471,8 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
>  	u32 i = 0, j = 0;
>  	bool is2t = false;

Can't you also just remove this variable?  That way you will notice that
you can get rid of one more chunk of if() in the function.

thanks,

greg k-h


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

* Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: Remove redundant if conditions
  2015-02-26 20:52 ` Greg KH
@ 2015-02-27  6:05   ` Vatika Harlalka
  0 siblings, 0 replies; 4+ messages in thread
From: Vatika Harlalka @ 2015-02-27  6:05 UTC (permalink / raw)
  To: Greg KH; +Cc: outreachy-kernel

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

Hey,
I noticed that other chunk of if() later and sent in
another patch for it. I'll send in a v2 with both changes merged
and remove the variable :)

Thanks!

[-- Attachment #2: Type: text/html, Size: 226 bytes --]

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

end of thread, other threads:[~2015-02-27  6:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-23 15:06 [PATCH] Staging: rtl8188eu: Remove redundant if conditions Vatika Harlalka
2015-02-23 19:25 ` [Outreachy kernel] " Jes Sorensen
2015-02-26 20:52 ` Greg KH
2015-02-27  6:05   ` Vatika Harlalka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.