public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: fix coding style in rtl8188eu/core
@ 2016-02-02 20:57 Colin Vidal
  2016-02-02 21:14 ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Colin Vidal @ 2016-02-02 20:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Colin Vidal, open list:STAGING SUBSYSTEM,
	open list

Set constant on the left of the test, and jump a new line to avoid to
exceed the 80 char length limit.

Signed-off-by: Colin Vidal <colin@cvidal.org>
---
 drivers/staging/rtl8188eu/core/rtw_iol.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c
index cdcf0ea..8d6b368 100644
--- a/drivers/staging/rtl8188eu/core/rtw_iol.c
+++ b/drivers/staging/rtl8188eu/core/rtw_iol.c
@@ -22,10 +22,11 @@
 
 bool rtw_IOL_applied(struct adapter  *adapter)
 {
-	if (1 == adapter->registrypriv.fw_iol)
+	if (adapter->registrypriv.fw_iol == 1)
 		return true;
 
-	if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed))
+	if ((adapter->registrypriv.fw_iol == 2)
+	    && (!adapter_to_dvobj(adapter)->ishighspeed))
 		return true;
 	return false;
 }
-- 
2.5.0

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

* Re: [PATCH] Staging: fix coding style in rtl8188eu/core
  2016-02-02 20:57 Colin Vidal
@ 2016-02-02 21:14 ` Joe Perches
  2016-02-02 21:28   ` Colin Vidal
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2016-02-02 21:14 UTC (permalink / raw)
  To: Colin Vidal, Greg Kroah-Hartman, open list:STAGING SUBSYSTEM,
	open list

On Tue, 2016-02-02 at 21:57 +0100, Colin Vidal wrote:
> Set constant on the left of the test, and jump a new line to avoid to
> exceed the 80 char length limit.
[]
> diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c
[]
> @@ -22,10 +22,11 @@
>  
>  bool rtw_IOL_applied(struct adapter  *adapter)
>  {
> -	if (1 == adapter->registrypriv.fw_iol)
> +	if (adapter->registrypriv.fw_iol == 1)
>  		return true;
>  
> -	if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed))
> +	if ((adapter->registrypriv.fw_iol == 2)
> +	    && (!adapter_to_dvobj(adapter)->ishighspeed))
>  		return true;
>  	return false;
>  }

Please review your patches with scripts/checkpatch.pl

Perhaps this is better as:

bool rtw_IOL_applied(struct adapter *adapter)
{
	if (adapter->registrypriv.fw_iol == 1)
		return true;

	if (adapter->registrypriv.fw_iol == 2 &&
	    !adapter_to_dvobj(adapter)->ishighspeed)
		return true;

	return false;
}

or maybe even

bool rtw_IOL_applied(struct adapter *adapter)
{
	return adapter->registrypriv.fw_iol == 1 ||
	       (adapter->registrypriv.fw_iol == 2 &&
		!adapter_to_dvobj(adapter)->ishighspeed);
}

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

* Re: [PATCH] Staging: fix coding style in rtl8188eu/core
  2016-02-02 21:14 ` Joe Perches
@ 2016-02-02 21:28   ` Colin Vidal
  2016-02-02 22:51     ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Colin Vidal @ 2016-02-02 21:28 UTC (permalink / raw)
  To: Joe Perches, Greg Kroah-Hartman, open list:STAGING SUBSYSTEM,
	open list

On Tue, 2016-02-02 at 13:14 -0800, Joe Perches wrote:
> On Tue, 2016-02-02 at 21:57 +0100, Colin Vidal wrote:
> > Set constant on the left of the test, and jump a new line to avoid
> > to
> > exceed the 80 char length limit.
> []
> > diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c
> > b/drivers/staging/rtl8188eu/core/rtw_iol.c
> []
> > @@ -22,10 +22,11 @@
> >  
> >  bool rtw_IOL_applied(struct adapter  *adapter)
> >  {
> > -	if (1 == adapter->registrypriv.fw_iol)
> > +	if (adapter->registrypriv.fw_iol == 1)
> >  		return true;
> >  
> > -	if ((2 == adapter->registrypriv.fw_iol) &&
> > (!adapter_to_dvobj(adapter)->ishighspeed))
> > +	if ((adapter->registrypriv.fw_iol == 2)
> > +	    && (!adapter_to_dvobj(adapter)->ishighspeed))
> >  		return true;
> >  	return false;
> >  }
> 
> Please review your patches with scripts/checkpatch.pl
> 
> Perhaps this is better as:
> 
> bool rtw_IOL_applied(struct adapter *adapter)
> {
> 	if (adapter->registrypriv.fw_iol == 1)
> 		return true;
> 
> 	if (adapter->registrypriv.fw_iol == 2 &&
> 	    !adapter_to_dvobj(adapter)->ishighspeed)
> 		return true;
> 
> 	return false;
> }
> 
> or maybe even
> 
> bool rtw_IOL_applied(struct adapter *adapter)
> {
> 	return adapter->registrypriv.fw_iol == 1 ||
> 	       (adapter->registrypriv.fw_iol == 2 &&
> 		!adapter_to_dvobj(adapter)->ishighspeed);
> }
> 

Oh, yeah, the second one is obviously finer. If I'm right, I should
resend a new patch with a subject which looks something like "[PATCH
v2] ... " ? 

Thanks

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

* Re: [PATCH] Staging: fix coding style in rtl8188eu/core
  2016-02-02 21:28   ` Colin Vidal
@ 2016-02-02 22:51     ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2016-02-02 22:51 UTC (permalink / raw)
  To: Colin Vidal, Greg Kroah-Hartman, open list:STAGING SUBSYSTEM,
	open list

On Tue, 2016-02-02 at 22:28 +0100, Colin Vidal wrote:
> On Tue, 2016-02-02 at 13:14 -0800, Joe Perches wrote:
> > On Tue, 2016-02-02 at 21:57 +0100, Colin Vidal wrote:
> > > Set constant on the left of the test, and jump a new line to avoid to
> > > exceed the 80 char length limit.
> > []
> > > diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c
[]
> > bool rtw_IOL_applied(struct adapter *adapter)
> > {
> > 	return adapter->registrypriv.fw_iol == 1 ||
> > 	       (adapter->registrypriv.fw_iol == 2 &&
> > 		!adapter_to_dvobj(adapter)->ishighspeed);
> > }
> > 
> 
> Oh, yeah, the second one is obviously finer. If I'm right, I should
> resend a new patch with a subject which looks something like "[PATCH
> v2] ... " ? 

correct.

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

* [PATCH] Staging: fix coding style in rtl8188eu/core
@ 2016-02-02 22:54 Colin Vidal
  2016-02-02 23:04 ` Colin Vidal
  0 siblings, 1 reply; 6+ messages in thread
From: Colin Vidal @ 2016-02-02 22:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Colin Vidal, open list:STAGING SUBSYSTEM,
	open list

Set constant operand on right of test, and refactor the code in a more
compact and readable way.

Signed-off-by: Colin Vidal <colin@cvidal.org>
---
 drivers/staging/rtl8188eu/core/rtw_iol.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c
index cdcf0ea..00e1136 100644
--- a/drivers/staging/rtl8188eu/core/rtw_iol.c
+++ b/drivers/staging/rtl8188eu/core/rtw_iol.c
@@ -18,14 +18,11 @@
  *
  ******************************************************************************/
 
-#include<rtw_iol.h>
+#include <rtw_iol.h>
 
-bool rtw_IOL_applied(struct adapter  *adapter)
+bool rtw_IOL_applied(struct adapter *adapter)
 {
-	if (1 == adapter->registrypriv.fw_iol)
-		return true;
-
-	if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed))
-		return true;
-	return false;
+	return adapter->registrypriv.fw_iol == 1 ||
+		(adapter->registrypriv.fw_iol == 2 &&
+		 !adapter_to_dvobj(adapter)->ishighspeed);
 }
-- 
2.5.0

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

* Re: [PATCH] Staging: fix coding style in rtl8188eu/core
  2016-02-02 22:54 [PATCH] Staging: fix coding style in rtl8188eu/core Colin Vidal
@ 2016-02-02 23:04 ` Colin Vidal
  0 siblings, 0 replies; 6+ messages in thread
From: Colin Vidal @ 2016-02-02 23:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, open list:STAGING SUBSYSTEM, open list

On Tue, 2016-02-02 at 23:54 +0100, Colin Vidal wrote:
> Set constant operand on right of test, and refactor the code in a
> more
> compact and readable way.
> 
> Signed-off-by: Colin Vidal <colin@cvidal.org>
> ---
>  drivers/staging/rtl8188eu/core/rtw_iol.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c
> b/drivers/staging/rtl8188eu/core/rtw_iol.c
> index cdcf0ea..00e1136 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_iol.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c
> @@ -18,14 +18,11 @@
>   *
>  
> *********************************************************************
> *********/
>  
> -#include<rtw_iol.h>
> +#include <rtw_iol.h>
>  
> -bool rtw_IOL_applied(struct adapter  *adapter)
> +bool rtw_IOL_applied(struct adapter *adapter)
>  {
> -	if (1 == adapter->registrypriv.fw_iol)
> -		return true;
> -
> -	if ((2 == adapter->registrypriv.fw_iol) &&
> (!adapter_to_dvobj(adapter)->ishighspeed))
> -		return true;
> -	return false;
> +	return adapter->registrypriv.fw_iol == 1 ||
> +		(adapter->registrypriv.fw_iol == 2 &&
> +		 !adapter_to_dvobj(adapter)->ishighspeed);
>  }

Argh... The subject should be prefixed by "[PATCH v2]"... Missing
training, sorry.

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

end of thread, other threads:[~2016-02-02 23:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-02 22:54 [PATCH] Staging: fix coding style in rtl8188eu/core Colin Vidal
2016-02-02 23:04 ` Colin Vidal
  -- strict thread matches above, loose matches on Subject: below --
2016-02-02 20:57 Colin Vidal
2016-02-02 21:14 ` Joe Perches
2016-02-02 21:28   ` Colin Vidal
2016-02-02 22:51     ` Joe Perches

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