staging: comedi: proc.c Fixed warning and brace code style issue [kernel: linux-next: next-20130607]
PATCH 1/1 staging: comedi: proc.c Fixed warning and brace code style issue [kernel: linux-next: next-20130607]
checkpatch provided a warning on line 38. It recommended seq_puts instead of seq_printf. Since the return value of printf is ignored, I decided to switch to the seq_puts function since it is just regular character output.
source:: http://lwn.net/Articles/22355/
I also added braces on a for loop, since loops should be in braces. source:: Documentation/CodingStyle
--- drivers/staging/comedi/proc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/comedi/proc.c +7 -6
@@ -34,11 +34,11 @@ static int comedi_read(struct seq_file *m, void *v)int devices_q =0 ;struct comedi_driver *driv; -seq_printf (m, -"comedi version " COMEDI_RELEASE "\n" -"format string: %s\n" , -"\"%2d: %-20s %-20s %4d\", i, " -"driver_name, board_name, n_subdevices" ); +seq_puts (m, +"comedi version " COMEDI_RELEASE "\n" +"format string: %s\n" , +"\"%2d: %-20s %-20s %4d\", i, " +"driver_name, board_name, n_subdevices" );for (i =0 ; i <COMEDI_NUM_BOARD_MINORS ; i++) {struct comedi_device *dev =comedi_dev_from_minor (i);
@@ -57,10 +57,11 @@ static int comedi_read(struct seq_file *m, void *v)for (driv = comedi_drivers; driv; driv = driv->next) {seq_printf (m,"%s:\n" , driv->driver_name); -for (i =0 ; i < driv->num_names; i++) +for (i =0 ; i < driv->num_names; i++) {seq_printf (m," %s\n" , *(char **)((char *)driv->board_name + i * driv->offset)); + }if (!driv->num_names)seq_printf (m," %s\n" , driv->driver_name);
Signature · 1 line
1.7.11.7
Quoted 21 lines · Daniel Hamacher
checkpatch provided a warning on line 38. It recommended
seq_putsinstead ofseq_printf. Since the return value of printf is ignored, I decided to switch to theseq_putsfunction since it is just regular character output.
source:: http://lwn.net/Articles/22355/I also added braces on a for loop, since loops should be in braces. source::
Documentation/CodingStyleSigned-off-by Daniel Hamcher <[email protected]>--- drivers/staging/comedi/proc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/staging/comedi/proc.c +0
-0@@ -34,11 +34,11 @@ static int comedi_read(struct seq_file *m, void *v)int devices_q =0 ;struct comedi_driver *driv;
drivers/staging/comedi/proc.c static int comedi_read(struct seq_file *m, void *v) · line 41
Quoted 10 lines
drivers/staging/comedi/proc.c +5
-5-seq_printf (m, -"comedi version " COMEDI_RELEASE "\n" -"format string: %s\n" , -"\"%2d: %-20s %-20s %4d\", i, " -"driver_name, board_name, n_subdevices" ); +seq_puts (m, +"comedi version " COMEDI_RELEASE "\n" +"format string: %s\n" , +"\"%2d: %-20s %-20s %4d\", i, " +"driver_name, board_name, n_subdevices" );
Please compile the files patched by your patches
before submitting the patches.
This doesn't compile, the seq_printf is correct and the recommendation to use seq_puts not correct. checkpatch ain't perfect.
drivers/staging/comedi/proc.c static int comedi_read(struct seq_file *m, void *v) · line 64
Quoted 10 lines
drivers/staging/comedi/proc.c +2
-1@@ -57,10 +57,11 @@ static int comedi_read(struct seq_file *m, void *v)for (driv = comedi_drivers; driv; driv = driv->next) {seq_printf (m,"%s:\n" , driv->driver_name); -for (i =0 ; i < driv->num_names; i++) +for (i =0 ; i < driv->num_names; i++) {seq_printf (m," %s\n" , *(char **)((char *)driv->board_name + i * driv->offset)); + }
Adding braces here is not necessary.
Run checkpatch on your patches too.