All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: comedi: Remove semicolon after if.
@ 2015-02-28 22:03 Navya Sri Nizamkari
  2015-03-01 22:37 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Navya Sri Nizamkari @ 2015-02-28 22:03 UTC (permalink / raw)
  To: outreachy-kernel

This patch removes a semicolon after if and encloses
statements related to that if in brackets. The following
coccinelle script was used to detect the pattern of a
semicolon after if.

@r1@
position p;
@@
if (...);@p
@script:python@
p0 << r1.p;
@@
// Emacs org-mode output
cocci.print_main("", p0)
cocci.print_secs("", p0)

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
 drivers/staging/comedi/drivers/das1800.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
index 0790a28..c759a84 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -492,11 +492,11 @@ static void das1800_handle_fifo_not_empty(struct comedi_device *dev,
 	while (inb(dev->iobase + DAS1800_STATUS) & FNE) {
 		dpnt = inw(dev->iobase + DAS1800_FIFO);
 		/* convert to unsigned type if we are in a bipolar mode */
-		if (!unipolar)
-			;
-		dpnt = munge_bipolar_sample(dev, dpnt);
+		if (!unipolar) {
+		dpnt = mungef_bipolar_sample(dev, dpnt);
 		comedi_buf_write_samples(s, &dpnt, 1);
-
+		}
+	
 		if (cmd->stop_src == TRIG_COUNT &&
 		    s->async->scans_done >= cmd->stop_arg)
 			break;
-- 
1.9.1



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

* Re: [Outreachy kernel] [PATCH] staging: comedi: Remove semicolon after if.
  2015-02-28 22:03 [PATCH] staging: comedi: Remove semicolon after if Navya Sri Nizamkari
@ 2015-03-01 22:37 ` Julia Lawall
  2015-03-02  8:05   ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2015-03-01 22:37 UTC (permalink / raw)
  To: Navya Sri Nizamkari; +Cc: outreachy-kernel



On Sun, 1 Mar 2015, Navya Sri Nizamkari wrote:

> This patch removes a semicolon after if and encloses
> statements related to that if in brackets. The following
> coccinelle script was used to detect the pattern of a
> semicolon after if.
>
> @r1@
> position p;
> @@
> if (...);@p
> @script:python@
> p0 << r1.p;
> @@
> // Emacs org-mode output
> cocci.print_main("", p0)
> cocci.print_secs("", p0)
>
> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
> ---
>  drivers/staging/comedi/drivers/das1800.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
> index 0790a28..c759a84 100644
> --- a/drivers/staging/comedi/drivers/das1800.c
> +++ b/drivers/staging/comedi/drivers/das1800.c
> @@ -492,11 +492,11 @@ static void das1800_handle_fifo_not_empty(struct comedi_device *dev,
>  	while (inb(dev->iobase + DAS1800_STATUS) & FNE) {
>  		dpnt = inw(dev->iobase + DAS1800_FIFO);
>  		/* convert to unsigned type if we are in a bipolar mode */
> -		if (!unipolar)
> -			;
> -		dpnt = munge_bipolar_sample(dev, dpnt);
> +		if (!unipolar) {
> +		dpnt = mungef_bipolar_sample(dev, dpnt);

You need some indentation here.

julia

>  		comedi_buf_write_samples(s, &dpnt, 1);
> -
> +		}
> +
>  		if (cmd->stop_src == TRIG_COUNT &&
>  		    s->async->scans_done >= cmd->stop_arg)
>  			break;
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150228220347.GA5430%40localhost.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel] [PATCH] staging: comedi: Remove semicolon after if.
  2015-03-01 22:37 ` [Outreachy kernel] " Julia Lawall
@ 2015-03-02  8:05   ` Arnd Bergmann
  2015-03-02 18:09     ` Navya Sri Nizamkari
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2015-03-02  8:05 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Julia Lawall, Navya Sri Nizamkari

On Sunday 01 March 2015 16:37:57 Julia Lawall wrote:
> >       while (inb(dev->iobase + DAS1800_STATUS) & FNE) {
> >               dpnt = inw(dev->iobase + DAS1800_FIFO);
> >               /* convert to unsigned type if we are in a bipolar mode */
> > -             if (!unipolar)
> > -                     ;
> > -             dpnt = munge_bipolar_sample(dev, dpnt);
> > +             if (!unipolar) {
> > +             dpnt = mungef_bipolar_sample(dev, dpnt);
> 
> You need some indentation here.
> 
> julia
> 
> >               comedi_buf_write_samples(s, &dpnt, 1);
> > -
> > +             }

It rather looks to me that the patch fundamentally changes the 
behavior of the function, but calling two functions conditionally
that were called unconditionally previously.

There is also a typo in 'mungef_bipolar_sample' that will prevent
this from compiling.

	Arnd


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

* Re: [Outreachy kernel] [PATCH] staging: comedi: Remove semicolon after if.
  2015-03-02  8:05   ` Arnd Bergmann
@ 2015-03-02 18:09     ` Navya Sri Nizamkari
  2015-03-02 19:43       ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-02 18:09 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: julia.lawall, navyasri.tech


[-- Attachment #1.1: Type: text/plain, Size: 1195 bytes --]



On Monday, March 2, 2015 at 1:35:40 PM UTC+5:30, Arnd Bergmann wrote:
>
> On Sunday 01 March 2015 16:37:57 Julia Lawall wrote: 
> > >       while (inb(dev->iobase + DAS1800_STATUS) & FNE) { 
> > >               dpnt = inw(dev->iobase + DAS1800_FIFO); 
> > >               /* convert to unsigned type if we are in a bipolar mode 
> */ 
> > > -             if (!unipolar) 
> > > -                     ; 
> > > -             dpnt = munge_bipolar_sample(dev, dpnt); 
> > > +             if (!unipolar) { 
> > > +             dpnt = mungef_bipolar_sample(dev, dpnt); 
> > 
> > You need some indentation here. 
> > 
> > julia 
> > 
> > >               comedi_buf_write_samples(s, &dpnt, 1); 
> > > - 
> > > +             } 
>
> It rather looks to me that the patch fundamentally changes the 
> behavior of the function, but calling two functions conditionally 
> that were called unconditionally previously. 
>
> There is also a typo in 'mungef_bipolar_sample' that will prevent 
> this from compiling. 
>
>         Arnd 
>

If it's changing the way the functions are being called, I'll simply remove 
the if condition, fix the typo with proper indentation and send a newer 
version.

Thanks,
Navya

[-- Attachment #1.2: Type: text/html, Size: 1858 bytes --]

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

* Re: [Outreachy kernel] [PATCH] staging: comedi: Remove semicolon after if.
  2015-03-02 18:09     ` Navya Sri Nizamkari
@ 2015-03-02 19:43       ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2015-03-02 19:43 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Navya Sri Nizamkari, julia.lawall

On Monday 02 March 2015 10:09:38 Navya Sri Nizamkari wrote:
> On Monday, March 2, 2015 at 1:35:40 PM UTC+5:30, Arnd Bergmann wrote:
> >
> > On Sunday 01 March 2015 16:37:57 Julia Lawall wrote: 
> > > >       while (inb(dev->iobase + DAS1800_STATUS) & FNE) { 
> > > >               dpnt = inw(dev->iobase + DAS1800_FIFO); 
> > > >               /* convert to unsigned type if we are in a bipolar mode 
> > */ 
> > > > -             if (!unipolar) 
> > > > -                     ; 
> > > > -             dpnt = munge_bipolar_sample(dev, dpnt); 
> > > > +             if (!unipolar) { 
> > > > +             dpnt = mungef_bipolar_sample(dev, dpnt); 
> > > 
> > > You need some indentation here. 
> > > 
> > > julia 
> > > 
> > > >               comedi_buf_write_samples(s, &dpnt, 1); 
> > > > - 
> > > > +             } 
> >
> > It rather looks to me that the patch fundamentally changes the 
> > behavior of the function, but calling two functions conditionally 
> > that were called unconditionally previously. 
> >
> > There is also a typo in 'mungef_bipolar_sample' that will prevent 
> > this from compiling. 
> >
> >         Arnd 
> >
> 
> If it's changing the way the functions are being called, I'll simply remove 
> the if condition, fix the typo with proper indentation and send a newer 
> version.
> 

Yes, I think that would be ok. This is the sort of code that is clearly
bogus, but it's hard to tell why. It was originally written as

	if (!unipolar) ;

when the code was initially merged, which was likely already the result
of a cleanup gone wrong, and it was later changed to

	if (!unipolar)
		;

which is obviously still doing nothing, but more obvious at that.

	Arnd



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

end of thread, other threads:[~2015-03-02 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-28 22:03 [PATCH] staging: comedi: Remove semicolon after if Navya Sri Nizamkari
2015-03-01 22:37 ` [Outreachy kernel] " Julia Lawall
2015-03-02  8:05   ` Arnd Bergmann
2015-03-02 18:09     ` Navya Sri Nizamkari
2015-03-02 19:43       ` Arnd Bergmann

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.