* [PATCH v2] staging: comedi: Remove if condition.
@ 2015-03-03 11:38 Navya Sri Nizamkari
2015-03-03 12:00 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-03 11:38 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a if condition which has a semicolon
after it. As the conditional check is redundant, the comment
before it is also changed. 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>
---
Changes in v2:
-Updated the commit subject and message.
-Removed the if-condition completely as
it was redundant.
-Changed the comment about the statements
which follow the if-condition.
drivers/staging/comedi/drivers/das1800.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
index 0790a28..8ffc9d0b 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -491,9 +491,7 @@ 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)
- ;
+ /* convert to unsigned type */
dpnt = munge_bipolar_sample(dev, dpnt);
comedi_buf_write_samples(s, &dpnt, 1);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH v2] staging: comedi: Remove if condition.
2015-03-03 11:38 [PATCH v2] staging: comedi: Remove if condition Navya Sri Nizamkari
@ 2015-03-03 12:00 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2015-03-03 12:00 UTC (permalink / raw)
To: Navya Sri Nizamkari; +Cc: outreachy-kernel
On Tue, 3 Mar 2015, Navya Sri Nizamkari wrote:
> This patch removes a if condition which has a semicolon
> after it. As the conditional check is redundant, the comment
> before it is also changed. 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)
A simpler way to do this is just
@@
@@
*if (...) ;
You will get a diff in which there is a - in front of each match. Of
course you don't want to remove the matches, but it highlights the matched
code and shows some context.
julia
> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
> ---
> Changes in v2:
> -Updated the commit subject and message.
> -Removed the if-condition completely as
> it was redundant.
> -Changed the comment about the statements
> which follow the if-condition.
>
> drivers/staging/comedi/drivers/das1800.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
> index 0790a28..8ffc9d0b 100644
> --- a/drivers/staging/comedi/drivers/das1800.c
> +++ b/drivers/staging/comedi/drivers/das1800.c
> @@ -491,9 +491,7 @@ 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)
> - ;
> + /* convert to unsigned type */
> dpnt = munge_bipolar_sample(dev, dpnt);
> comedi_buf_write_samples(s, &dpnt, 1);
>
> --
> 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/20150303113806.GA8173%40localhost.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-03 12:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 11:38 [PATCH v2] staging: comedi: Remove if condition Navya Sri Nizamkari
2015-03-03 12:00 ` [Outreachy kernel] " Julia Lawall
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.