staging: comedi: drivers: pcmuio: Merge if conditions
PATCH 6/6 staging: comedi: drivers: pcmuio: Merge if conditions
Merge if conditions with the same statements.
Found using Coccinelle. The semantic patch used to find this is as follows:
//<smpl>
@@
statement S;
expression e,x;
@@
* if(e)
(
{ ... return ...; }
&
S
)
* if(x)
(
{ ... return ...; }
&
S
)
//</smpl>
--- drivers/staging/comedi/drivers/pcmuio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/comedi/drivers/pcmuio.c +1 -4
@@ -319,10 +319,7 @@ static void pcmuio_handle_intr_subdev(struct comedi_device *dev,spin_lock_irqsave (&chip->spinlock, flags); -if (!chip->active) - goto done; - -if (!(triggered & chip->enabled_mask)) +if (!(chip->active && (triggered & chip->enabled_mask))) goto done;for (i =0 ; i < cmd->chanlist_len; i++) {
Signature · 1 line
1.9.1
Quoted 36 lines · Amitoj Kaur Chawla
Merge if conditions with the same statements.
Found using Coccinelle. The semantic patch used to find this is as follows:
//<smpl>
@@
statement S;
expression e,x;
@@* if(e)
(
{ ... return ...; }
&
S
)* if(x)
(
{ ... return ...; }
&
S
)
//</smpl>Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/comedi/drivers/pcmuio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/comedi/drivers/pcmuio.c +0
-0
drivers/staging/comedi/drivers/pcmuio.c static void pcmuio_handle_intr_subdev(struct comedi_device *dev, · line 322
Quoted 8 lines
drivers/staging/comedi/drivers/pcmuio.c +1
-4@@ -319,10 +319,7 @@ static void pcmuio_handle_intr_subdev(struct comedi_device *dev,spin_lock_irqsave (&chip->spinlock, flags); -if (!chip->active) - goto done; - -if (!(triggered & chip->enabled_mask)) +if (!(chip->active && (triggered & chip->enabled_mask)))
I�m not sure that converting to only one ! in this way is a good idea. !X || !Y could be more readable. Here there are a lot of parentheses to sort out.
julia
Quoted 13 lines
drivers/staging/comedi/drivers/pcmuio.c +0
-1goto done;for (i =0 ; i < cmd->chanlist_len; i++) { --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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160210085942.GA14651%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.
Quoted 6 lines · Julia Lawall
drivers/staging/comedi/drivers/pcmuio.c static void pcmuio_handle_intr_subdev(struct comedi_device *dev, · line 322
Quoted 5 lines
drivers/staging/comedi/drivers/pcmuio.c +1
-4-if (!chip->active) - goto done; - -if (!(triggered & chip->enabled_mask)) +if (!(chip->active && (triggered & chip->enabled_mask)))
Quoted 6 lines
I´m not sure that converting to only one ! in this way is a good idea. !X || !Y could be more readable. Here there are a lot of parentheses to sort out.
julia
I wasn't very sure about this either whether I should make it !(X &&
Y) or !X || !Y.
Since Patch 5/6 also does a similar thing, would you like me to change to !X || !Y for both?
Amitoj
Quoted 11 lines · Amitoj Kaur Chawla
Quoted 10 lines · Julia Lawall
drivers/staging/comedi/drivers/pcmuio.c static void pcmuio_handle_intr_subdev(struct comedi_device *dev, · line 322
Quoted 5 lines
drivers/staging/comedi/drivers/pcmuio.c +1
-4-if (!chip->active) - goto done; - -if (!(triggered & chip->enabled_mask)) +if (!(chip->active && (triggered & chip->enabled_mask)))I´m not sure that converting to only one ! in this way is a good idea. !X || !Y could be more readable. Here there are a lot of parentheses to sort out.
Quoted 7 lines
Quoted 2 lines
julia
I wasn't very sure about this either whether I should make it !(X &&
Y) or !X || !Y.
Since Patch 5/6 also does a similar thing, would you like me to change to !X || !Y for both?
Yes, for all cases. I didn´t want to make the same comemnt more than once :)
julia
Quoted 10 lines
Amitoj
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CA%2B5yK5F1nNgDLCJrFm3CrgOjCe3OJUutMrQ5%2B2R_FOrz3g0wzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 10 lines · Julia Lawall
Quoted 4 lines
I wasn't very sure about this either whether I should make it !(X &&
Y) or !X || !Y.
Since Patch 5/6 also does a similar thing, would you like me to change to !X || !Y for both?Yes, for all cases. I didn´t want to make the same comemnt more than once :)
julia
Okay!
Amitoj
Greg KH
maintainerQuoted 36 lines · Amitoj Kaur Chawla
Merge if conditions with the same statements.
Found using Coccinelle. The semantic patch used to find this is as follows:
//<smpl>
@@
statement S;
expression e,x;
@@* if(e)
(
{ ... return ...; }
&
S
)* if(x)
(
{ ... return ...; }
&
S
)
//</smpl>Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/comedi/drivers/pcmuio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/comedi/drivers/pcmuio.c +0
-0
drivers/staging/comedi/drivers/pcmuio.c static void pcmuio_handle_intr_subdev(struct comedi_device *dev, · line 323
Quoted 9 lines
drivers/staging/comedi/drivers/pcmuio.c +1
-4@@ -319,10 +319,7 @@ static void pcmuio_handle_intr_subdev(struct comedi_device *dev,spin_lock_irqsave (&chip->spinlock, flags); -if (!chip->active) - goto done; - -if (!(triggered & chip->enabled_mask)) +if (!(chip->active && (triggered & chip->enabled_mask))) goto done;
This is now harder to read, sorry, I don't like these at all.
greg k-h