Skip to contentSkip to conversation

staging: comedi: drivers: pcl812.c: fixed a coding style issue

PATCH In review Kumar Amit Mehta 4 participants 8 messages Apr 4, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: comedi: drivers: pcl812.c: fixed a coding style issue

Fixed a coding style issue. Reported by checkpatch.pl

---
 drivers/staging/comedi/drivers/pcl812.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/comedi/drivers/pcl812.c +2 -1
index 160eac8..5cc01fe 100644
@@ -811,8 +811,9 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 				devpriv->ai_dma = 0;
 				break;
 			}
-	} else
+	} else {
 		devpriv->ai_dma = 0;
+	}
 
 	devpriv->ai_act_scan = 0;
 	devpriv->ai_poll_ptr = 0;
Signature · 1 line
1.8.5.3
#1 lore raw
Quoted 2 lines · Kumar Amit Mehta

Fixed a coding style issue. Reported by checkpatch.pl

It's better if the commit messages are more specific than this.

regards,
dan carpenter

#2 lore raw
Quoted 5 lines · Dan Carpenter
Quoted 2 lines · Kumar Amit Mehta

Fixed a coding style issue. Reported by checkpatch.pl

It's better if the commit messages are more specific than this.

So, should I resend the patch with a more appropriate commit message ?

Thanks,
Kumar

#3 lore raw
Quoted 8 lines · Kumar Amit Mehta
Quoted 5 lines · Dan Carpenter
Quoted 2 lines · Kumar Amit Mehta

Fixed a coding style issue. Reported by checkpatch.pl

It's better if the commit messages are more specific than this.

So, should I resend the patch with a more appropriate commit message ?

[PATCH] staging: comedi: drivers: pcl812.c: add curly braces for checkpatch

Kernel style is that if one side of the if else statement gets has curly braces then both side should have them.

regards,
dan carpenter

#4 lore raw
Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Kumar Amit Mehta
Quoted 4 lines · Dan Carpenter
Quoted 2 lines · Kumar Amit Mehta

Fixed a coding style issue. Reported by checkpatch.pl

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It's better if the commit messages are more specific than this.

So, should I resend the patch with a more appropriate commit message ?

[PATCH] staging: comedi: drivers: pcl812.c: add curly braces for checkpatch

Kernel style is that if one side of the if else statement gets has curly braces then both side should have them.

Dan,

What Walter mentioned also makes sense, So shouldn't it be something like this:

[amit@localhost linux-next]$ git diff

(quoted diff) +0 -0

b/drivers/staging/comedi/drivers/pcl812.c
index 160eac8..552b696 100644

drivers/staging/comedi/drivers/pcl812.c +0 -0
@@ -803,16 +803,14 @@ static int pcl812_ai_cmd(struct comedi_device

*dev, struct comedi_subdevice *s)

        pcl812_ai_set_chan_range(dev, cmd->chanlist[0], 1);
+       devpriv->ai_dma = 0;
        if (devpriv->dma) {     /*  check if we can use DMA transfer */
                devpriv->ai_dma = 1;
                for (i = 1; i < cmd->chanlist_len; i++)
                        if (cmd->chanlist[0] != cmd->chanlist[i]) {
                                /*  we cann't use DMA :-( */
-                               devpriv->ai_dma = 0;
                                break;
                        }

- } else
- devpriv->ai_dma = 0;

        devpriv->ai_act_scan = 0;
        devpriv->ai_poll_ptr = 0;

Thanks,
Kumar

#5 lore raw
Quoted 2 lines · Kumar Amit Mehta

What Walter mentioned also makes sense, So shouldn't it be something like this:

I'm not Dan, but:

Quoted 8 lines

[amit@localhost linux-next]$ git diff

drivers/staging/comedi/drivers/pcl812.c +0 -0
index 160eac8..552b696 100644
@@ -803,16 +803,14 @@ static int pcl812_ai_cmd(struct comedi_device
 *dev, struct comedi_subdevice *s)

drivers/staging/comedi/drivers/pcl812.c static int pcl812_ai_cmd(struct comedi_device · line 812

Quoted 10 lines
drivers/staging/comedi/drivers/pcl812.c +1 -1
 
        pcl812_ai_set_chan_range(dev, cmd->chanlist[0], 1);
 
+       devpriv->ai_dma = 0;
        if (devpriv->dma) {     /*  check if we can use DMA transfer */
                devpriv->ai_dma = 1;
                for (i = 1; i < cmd->chanlist_len; i++)
                        if (cmd->chanlist[0] != cmd->chanlist[i]) {
                                /*  we cann't use DMA :-( */
-                               devpriv->ai_dma = 0;

No.

You enable unwanted DMA capability here.
There's a typo of can't too.

drivers/staging/comedi/drivers/pcl812.c static int pcl812_ai_cmd(struct comedi_device · line 816

Quoted 4 lines
drivers/staging/comedi/drivers/pcl812.c +0 -2
                                break;
                        }
-       } else
-               devpriv->ai_dma = 0;

Otherwise, I suppose either style is OK.

#6 lore raw
In reply to Kumar Amit Mehta
Quoted 29 lines · Kumar Amit Mehta
Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Kumar Amit Mehta
Quoted 4 lines · Dan Carpenter
Quoted 2 lines · Kumar Amit Mehta

Fixed a coding style issue. Reported by checkpatch.pl

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It's better if the commit messages are more specific than this.

So, should I resend the patch with a more appropriate commit message ?

[PATCH] staging: comedi: drivers: pcl812.c: add curly braces for checkpatch

Kernel style is that if one side of the if else statement gets has curly braces then both side should have them.

Dan,

What Walter mentioned also makes sense, So shouldn't it be something like this:

[amit@localhost linux-next]$ git diff

drivers/staging/comedi/drivers/pcl812.c +0 -0
index 160eac8..552b696 100644
@@ -803,16 +803,14 @@ static int pcl812_ai_cmd(struct comedi_device
 *dev, struct comedi_subdevice *s)

drivers/staging/comedi/drivers/pcl812.c static int pcl812_ai_cmd(struct comedi_device · line 812

Quoted 10 lines
drivers/staging/comedi/drivers/pcl812.c +1 -1
 
        pcl812_ai_set_chan_range(dev, cmd->chanlist[0], 1);
 
+       devpriv->ai_dma = 0;
        if (devpriv->dma) {     /*  check if we can use DMA transfer */
                devpriv->ai_dma = 1;
                for (i = 1; i < cmd->chanlist_len; i++)
                        if (cmd->chanlist[0] != cmd->chanlist[i]) {
                                /*  we cann't use DMA :-( */
-                               devpriv->ai_dma = 0;

You'd still want this assignment.

drivers/staging/comedi/drivers/pcl812.c static int pcl812_ai_cmd(struct comedi_device · line 816

Quoted 4 lines
drivers/staging/comedi/drivers/pcl812.c +0 -2
                                break;
                        }
-       } else
-               devpriv->ai_dma = 0;

regards,
dan carpenter

#7 lore raw
In reply to Kumar Amit Mehta

Am 04.04.2014 12:05, schrieb Kumar Amit Mehta:

Quoted 12 lines

Fixed a coding style issue. Reported by checkpatch.pl

---
 drivers/staging/comedi/drivers/pcl812.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/comedi/drivers/pcl812.c +0 -0
index 160eac8..5cc01fe 100644

drivers/staging/comedi/drivers/pcl812.c static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) · line 819

Quoted 10 lines
drivers/staging/comedi/drivers/pcl812.c +2 -1
@@ -811,8 +811,9 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 				devpriv->ai_dma = 0;
 				break;
 			}
-	} else
+	} else {
 		devpriv->ai_dma = 0;
+	}
 
 	devpriv->ai_act_scan = 0;
 	devpriv->ai_poll_ptr = 0;

hi Kumar,
is that else needed at all ? perhaps it is possible to devpriv->ai_dma=0 before the if ? That would reduce code and give a better readability.

re,
wh