public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8192u: removed an unnecessary else statement
@ 2014-12-18  9:20 Karthik Nayak
  2014-12-18 22:38 ` Jeremiah Mahler
  0 siblings, 1 reply; 4+ messages in thread
From: Karthik Nayak @ 2014-12-18  9:20 UTC (permalink / raw)
  To: trivial; +Cc: gregkh, anarey, linux-kernel, Karthik Nayak

As per checkpatch warning, removed an unnecessary else statement
proceeding an if statement with a return.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_dm.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 936565d..b3b508c 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -480,15 +480,13 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
 
 	if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){
 		return;
-	}else{
-		if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
-			if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
-				priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
-		}else{//in force send packets in 20 Mhz in 20/40
-			if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
-				priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
-
-		}
+	}
+	if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
+		if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
+			priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
+	}else{//in force send packets in 20 Mhz in 20/40
+		if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
+			priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
 	}
 }	// dm_BandwidthAutoSwitch
 
-- 
2.1.3


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

* Re: [PATCH] Staging: rtl8192u: removed an unnecessary else statement
  2014-12-18  9:20 [PATCH] Staging: rtl8192u: removed an unnecessary else statement Karthik Nayak
@ 2014-12-18 22:38 ` Jeremiah Mahler
  2014-12-19  4:46   ` karthik nayak
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremiah Mahler @ 2014-12-18 22:38 UTC (permalink / raw)
  To: Karthik Nayak; +Cc: trivial, gregkh, anarey, linux-kernel

Karthik,

On Thu, Dec 18, 2014 at 02:50:11PM +0530, Karthik Nayak wrote:
> As per checkpatch warning, removed an unnecessary else statement
> proceeding an if statement with a return.
> 
> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> ---
>  drivers/staging/rtl8192u/r8192U_dm.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
> index 936565d..b3b508c 100644
> --- a/drivers/staging/rtl8192u/r8192U_dm.c
> +++ b/drivers/staging/rtl8192u/r8192U_dm.c
> @@ -480,15 +480,13 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
>  
>  	if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){
>  		return;
> -	}else{
> -		if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
> -			if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
> -				priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
> -		}else{//in force send packets in 20 Mhz in 20/40
> -			if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
> -				priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
> -
> -		}
> +	}
> +	if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
> +		if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
> +			priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
> +	}else{//in force send packets in 20 Mhz in 20/40
> +		if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
> +			priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
>  	}
>  }	// dm_BandwidthAutoSwitch
>  
[...]

Wow, I don't think I have ever seen a file with so many checkpatch errors!

Instead of only fixing one instance of one error I would fix all
instances of that type of error.  Since the changes would be very
similar it should still be easy to review.

You could even make a whole patch series with each patch fixing one type
of error.  Although I would keep the series to just a few at first until
you are sure you are doing everything right.

-- 
- Jeremiah Mahler

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

* Re: [PATCH] Staging: rtl8192u: removed an unnecessary else statement
  2014-12-18 22:38 ` Jeremiah Mahler
@ 2014-12-19  4:46   ` karthik nayak
  2014-12-19  7:16     ` Jeremiah Mahler
  0 siblings, 1 reply; 4+ messages in thread
From: karthik nayak @ 2014-12-19  4:46 UTC (permalink / raw)
  To: Jeremiah Mahler; +Cc: trivial, gregkh, anarey, linux-kernel


On 12/19/2014 04:08 AM, Jeremiah Mahler wrote:
> Karthik,
>
> On Thu, Dec 18, 2014 at 02:50:11PM +0530, Karthik Nayak wrote:
>> As per checkpatch warning, removed an unnecessary else statement
>> proceeding an if statement with a return.
>>
>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
>> ---
>>   drivers/staging/rtl8192u/r8192U_dm.c | 16 +++++++---------
>>   1 file changed, 7 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
>> index 936565d..b3b508c 100644
>> --- a/drivers/staging/rtl8192u/r8192U_dm.c
>> +++ b/drivers/staging/rtl8192u/r8192U_dm.c
>> @@ -480,15 +480,13 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
>>   
>>   	if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){
>>   		return;
>> -	}else{
>> -		if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
>> -			if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
>> -				priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
>> -		}else{//in force send packets in 20 Mhz in 20/40
>> -			if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
>> -				priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
>> -
>> -		}
>> +	}
>> +	if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
>> +		if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
>> +			priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
>> +	}else{//in force send packets in 20 Mhz in 20/40
>> +		if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
>> +			priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
>>   	}
>>   }	// dm_BandwidthAutoSwitch
>>   
> [...]
>
> Wow, I don't think I have ever seen a file with so many checkpatch errors!
>
> Instead of only fixing one instance of one error I would fix all
> instances of that type of error.  Since the changes would be very
> similar it should still be easy to review.
>
> You could even make a whole patch series with each patch fixing one type
> of error.  Although I would keep the series to just a few at first until
> you are sure you are doing everything right.
>
Hello Jeremiah,
I agree, there are a lot of errors, so I fixed a single issue.
This is just to get used to checkpatch system.
I can write patches to fix the other things, but I rather not.
I hope you get the point.
Regards
Karthik Nayak

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

* Re: [PATCH] Staging: rtl8192u: removed an unnecessary else statement
  2014-12-19  4:46   ` karthik nayak
@ 2014-12-19  7:16     ` Jeremiah Mahler
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremiah Mahler @ 2014-12-19  7:16 UTC (permalink / raw)
  To: karthik nayak; +Cc: trivial, gregkh, anarey, linux-kernel

Karthik,

On Fri, Dec 19, 2014 at 10:16:18AM +0530, karthik nayak wrote:
> 
> On 12/19/2014 04:08 AM, Jeremiah Mahler wrote:
> >Karthik,
> >
> >On Thu, Dec 18, 2014 at 02:50:11PM +0530, Karthik Nayak wrote:
> >>As per checkpatch warning, removed an unnecessary else statement
> >>proceeding an if statement with a return.
> >>
> >>Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> >>---
> >>  drivers/staging/rtl8192u/r8192U_dm.c | 16 +++++++---------
> >>  1 file changed, 7 insertions(+), 9 deletions(-)
> >>
> >>diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
> >>index 936565d..b3b508c 100644
> >>--- a/drivers/staging/rtl8192u/r8192U_dm.c
> >>+++ b/drivers/staging/rtl8192u/r8192U_dm.c
> >>@@ -480,15 +480,13 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
> >>  	if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){
> >>  		return;
> >>-	}else{
> >>-		if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
> >>-			if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
> >>-				priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
> >>-		}else{//in force send packets in 20 Mhz in 20/40
> >>-			if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
> >>-				priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
> >>-
> >>-		}
> >>+	}
> >>+	if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
> >>+		if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
> >>+			priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
> >>+	}else{//in force send packets in 20 Mhz in 20/40
> >>+		if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
> >>+			priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
> >>  	}
> >>  }	// dm_BandwidthAutoSwitch
> >[...]
> >
> >Wow, I don't think I have ever seen a file with so many checkpatch errors!
> >
> >Instead of only fixing one instance of one error I would fix all
> >instances of that type of error.  Since the changes would be very
> >similar it should still be easy to review.
> >
> >You could even make a whole patch series with each patch fixing one type
> >of error.  Although I would keep the series to just a few at first until
> >you are sure you are doing everything right.
> >
> Hello Jeremiah,
> I agree, there are a lot of errors, so I fixed a single issue.
> This is just to get used to checkpatch system.
> I can write patches to fix the other things, but I rather not.
> I hope you get the point.
> Regards
> Karthik Nayak

Starting small sounds like a good idea.

-- 
- Jeremiah Mahler

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

end of thread, other threads:[~2014-12-19  7:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-18  9:20 [PATCH] Staging: rtl8192u: removed an unnecessary else statement Karthik Nayak
2014-12-18 22:38 ` Jeremiah Mahler
2014-12-19  4:46   ` karthik nayak
2014-12-19  7:16     ` Jeremiah Mahler

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