All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: comedi: adl_pci9118: fixed some parentheses coding style issue
@ 2017-11-21 19:17 Guilherme Tadashi Maeoka
  2017-11-22  0:28 ` Tobin C. Harding
  0 siblings, 1 reply; 3+ messages in thread
From: Guilherme Tadashi Maeoka @ 2017-11-21 19:17 UTC (permalink / raw)
  To: abbotti; +Cc: devel, linux-kernel, Guilherme Tadashi Maeoka

Fixed some code style issues.

Signed-off-by: Guilherme Tadashi Maeoka <gui.maeoka@gmail.com>
---
 drivers/staging/comedi/drivers/adl_pci9118.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
index 1cc9b7ef1ff9..53f13994ac94 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -947,7 +947,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 	if (devpriv->master) {
 		devpriv->usedma = 1;
 		if ((cmd->flags & CMDF_WAKE_EOS) &&
-		    (cmd->scan_end_arg == 1)) {
+		    cmd->scan_end_arg == 1) {
 			if (cmd->convert_src == TRIG_NOW)
 				devpriv->ai_add_back = 1;
 			if (cmd->convert_src == TRIG_TIMER) {
@@ -960,7 +960,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 		}
 		if ((cmd->flags & CMDF_WAKE_EOS) &&
 		    (cmd->scan_end_arg & 1) &&
-		    (cmd->scan_end_arg > 1)) {
+		    cmd->scan_end_arg > 1) {
 			if (cmd->scan_begin_src == TRIG_FOLLOW) {
 				devpriv->usedma = 0;
 				/*
@@ -983,7 +983,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 	 */
 	if (cmd->convert_src == TRIG_NOW && devpriv->softsshdelay) {
 		devpriv->ai_add_front = 2;
-		if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) {
+		if (devpriv->usedma == 1 && devpriv->ai_add_back == 1) {
 							/* move it to front */
 			devpriv->ai_add_front++;
 			devpriv->ai_add_back = 0;
@@ -1185,7 +1185,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
 	    (!(cmd->convert_src & (TRIG_TIMER | TRIG_NOW))))
 		err |= -EINVAL;
 
-	if ((cmd->scan_begin_src == TRIG_FOLLOW) &&
+	if (cmd->scan_begin_src == TRIG_FOLLOW &&
 	    (!(cmd->convert_src & (TRIG_TIMER | TRIG_EXT))))
 		err |= -EINVAL;
 
@@ -1210,8 +1210,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
 	if (cmd->scan_begin_src & (TRIG_FOLLOW | TRIG_EXT))
 		err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
 
-	if ((cmd->scan_begin_src == TRIG_TIMER) &&
-	    (cmd->convert_src == TRIG_TIMER) && (cmd->scan_end_arg == 1)) {
+	if (cmd->scan_begin_src == TRIG_TIMER &&
+	    cmd->convert_src == TRIG_TIMER && cmd->scan_end_arg == 1) {
 		cmd->scan_begin_src = TRIG_FOLLOW;
 		cmd->convert_arg = cmd->scan_begin_arg;
 		cmd->scan_begin_arg = 0;
-- 
2.15.0

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

* Re: [PATCH] Staging: comedi: adl_pci9118: fixed some parentheses coding style issue
  2017-11-21 19:17 [PATCH] Staging: comedi: adl_pci9118: fixed some parentheses coding style issue Guilherme Tadashi Maeoka
@ 2017-11-22  0:28 ` Tobin C. Harding
  2017-11-22 11:50   ` Guilherme Tadashi Maeoka
  0 siblings, 1 reply; 3+ messages in thread
From: Tobin C. Harding @ 2017-11-22  0:28 UTC (permalink / raw)
  To: Guilherme Tadashi Maeoka; +Cc: abbotti, devel, linux-kernel

You may like to limit the git log brief description to 50 characters
(this is going to be hard with such a long pre-fix though :)

Brief description should be in imperative mood i.e 'Fix foo' instead of
'fixed foo'.

On Tue, Nov 21, 2017 at 05:17:53PM -0200, Guilherme Tadashi Maeoka wrote:
> Fixed some code style issues.

This is not descriptive enough. You may like to read

	Documentation/process/submitting-patches.rst

for tips on writing git log messages. 

> Signed-off-by: Guilherme Tadashi Maeoka <gui.maeoka@gmail.com>
> ---
>  drivers/staging/comedi/drivers/adl_pci9118.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
> index 1cc9b7ef1ff9..53f13994ac94 100644
> --- a/drivers/staging/comedi/drivers/adl_pci9118.c
> +++ b/drivers/staging/comedi/drivers/adl_pci9118.c
> @@ -947,7 +947,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
>  	if (devpriv->master) {
>  		devpriv->usedma = 1;
>  		if ((cmd->flags & CMDF_WAKE_EOS) &&
> -		    (cmd->scan_end_arg == 1)) {
> +		    cmd->scan_end_arg == 1) {

The code was easier to read before this change IMO.

>  			if (cmd->convert_src == TRIG_NOW)
>  				devpriv->ai_add_back = 1;
>  			if (cmd->convert_src == TRIG_TIMER) {
> @@ -960,7 +960,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
>  		}
>  		if ((cmd->flags & CMDF_WAKE_EOS) &&
>  		    (cmd->scan_end_arg & 1) &&
> -		    (cmd->scan_end_arg > 1)) {
> +		    cmd->scan_end_arg > 1) {
>  			if (cmd->scan_begin_src == TRIG_FOLLOW) {
>  				devpriv->usedma = 0;
>  				/*
> @@ -983,7 +983,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
>  	 */
>  	if (cmd->convert_src == TRIG_NOW && devpriv->softsshdelay) {
>  		devpriv->ai_add_front = 2;
> -		if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) {
> +		if (devpriv->usedma == 1 && devpriv->ai_add_back == 1) {

Likewise, this is not making the code easier to read.

>  							/* move it to front */
>  			devpriv->ai_add_front++;
>  			devpriv->ai_add_back = 0;
> @@ -1185,7 +1185,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
>  	    (!(cmd->convert_src & (TRIG_TIMER | TRIG_NOW))))
>  		err |= -EINVAL;
>  
> -	if ((cmd->scan_begin_src == TRIG_FOLLOW) &&
> +	if (cmd->scan_begin_src == TRIG_FOLLOW &&
>  	    (!(cmd->convert_src & (TRIG_TIMER | TRIG_EXT))))
>  		err |= -EINVAL;
>  
> @@ -1210,8 +1210,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
>  	if (cmd->scan_begin_src & (TRIG_FOLLOW | TRIG_EXT))
>  		err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
>  
> -	if ((cmd->scan_begin_src == TRIG_TIMER) &&
> -	    (cmd->convert_src == TRIG_TIMER) && (cmd->scan_end_arg == 1)) {
> +	if (cmd->scan_begin_src == TRIG_TIMER &&
> +	    cmd->convert_src == TRIG_TIMER && cmd->scan_end_arg == 1) {
>  		cmd->scan_begin_src = TRIG_FOLLOW;
>  		cmd->convert_arg = cmd->scan_begin_arg;
>  		cmd->scan_begin_arg = 0;

Remember, we are writing code for developers to read. It should be as
easy to parse as possible.

Hope this helps,
Tobin.

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

* Re: [PATCH] Staging: comedi: adl_pci9118: fixed some parentheses coding style issue
  2017-11-22  0:28 ` Tobin C. Harding
@ 2017-11-22 11:50   ` Guilherme Tadashi Maeoka
  0 siblings, 0 replies; 3+ messages in thread
From: Guilherme Tadashi Maeoka @ 2017-11-22 11:50 UTC (permalink / raw)
  To: Tobin C. Harding; +Cc: abbotti, devel, linux-kernel

Thank you. I'll keep that in mind next time!

On Wed, Nov 22, 2017 at 11:28:51AM +1100, Tobin C. Harding wrote:
> You may like to limit the git log brief description to 50 characters
> (this is going to be hard with such a long pre-fix though :)
> 
> Brief description should be in imperative mood i.e 'Fix foo' instead of
> 'fixed foo'.
> 
> On Tue, Nov 21, 2017 at 05:17:53PM -0200, Guilherme Tadashi Maeoka wrote:
> > Fixed some code style issues.
> 
> This is not descriptive enough. You may like to read
> 
> 	Documentation/process/submitting-patches.rst
> 
> for tips on writing git log messages. 
> 
> > Signed-off-by: Guilherme Tadashi Maeoka <gui.maeoka@gmail.com>
> > ---
> >  drivers/staging/comedi/drivers/adl_pci9118.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
> > index 1cc9b7ef1ff9..53f13994ac94 100644
> > --- a/drivers/staging/comedi/drivers/adl_pci9118.c
> > +++ b/drivers/staging/comedi/drivers/adl_pci9118.c
> > @@ -947,7 +947,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
> >  	if (devpriv->master) {
> >  		devpriv->usedma = 1;
> >  		if ((cmd->flags & CMDF_WAKE_EOS) &&
> > -		    (cmd->scan_end_arg == 1)) {
> > +		    cmd->scan_end_arg == 1) {
> 
> The code was easier to read before this change IMO.
> 
> >  			if (cmd->convert_src == TRIG_NOW)
> >  				devpriv->ai_add_back = 1;
> >  			if (cmd->convert_src == TRIG_TIMER) {
> > @@ -960,7 +960,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
> >  		}
> >  		if ((cmd->flags & CMDF_WAKE_EOS) &&
> >  		    (cmd->scan_end_arg & 1) &&
> > -		    (cmd->scan_end_arg > 1)) {
> > +		    cmd->scan_end_arg > 1) {
> >  			if (cmd->scan_begin_src == TRIG_FOLLOW) {
> >  				devpriv->usedma = 0;
> >  				/*
> > @@ -983,7 +983,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
> >  	 */
> >  	if (cmd->convert_src == TRIG_NOW && devpriv->softsshdelay) {
> >  		devpriv->ai_add_front = 2;
> > -		if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) {
> > +		if (devpriv->usedma == 1 && devpriv->ai_add_back == 1) {
> 
> Likewise, this is not making the code easier to read.
> 
> >  							/* move it to front */
> >  			devpriv->ai_add_front++;
> >  			devpriv->ai_add_back = 0;
> > @@ -1185,7 +1185,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
> >  	    (!(cmd->convert_src & (TRIG_TIMER | TRIG_NOW))))
> >  		err |= -EINVAL;
> >  
> > -	if ((cmd->scan_begin_src == TRIG_FOLLOW) &&
> > +	if (cmd->scan_begin_src == TRIG_FOLLOW &&
> >  	    (!(cmd->convert_src & (TRIG_TIMER | TRIG_EXT))))
> >  		err |= -EINVAL;
> >  
> > @@ -1210,8 +1210,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
> >  	if (cmd->scan_begin_src & (TRIG_FOLLOW | TRIG_EXT))
> >  		err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
> >  
> > -	if ((cmd->scan_begin_src == TRIG_TIMER) &&
> > -	    (cmd->convert_src == TRIG_TIMER) && (cmd->scan_end_arg == 1)) {
> > +	if (cmd->scan_begin_src == TRIG_TIMER &&
> > +	    cmd->convert_src == TRIG_TIMER && cmd->scan_end_arg == 1) {
> >  		cmd->scan_begin_src = TRIG_FOLLOW;
> >  		cmd->convert_arg = cmd->scan_begin_arg;
> >  		cmd->scan_begin_arg = 0;
> 
> Remember, we are writing code for developers to read. It should be as
> easy to parse as possible.
> 
> Hope this helps,
> Tobin.

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

end of thread, other threads:[~2017-11-22 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21 19:17 [PATCH] Staging: comedi: adl_pci9118: fixed some parentheses coding style issue Guilherme Tadashi Maeoka
2017-11-22  0:28 ` Tobin C. Harding
2017-11-22 11:50   ` Guilherme Tadashi Maeoka

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.