Skip to contentSkip to conversation

staging: lustre: lustre: osc: fix Prefer seq_puts to seq_printf

PATCH In review Heba Aamer 3 participants 4 messages Jan 29, 2015 Staging

lore
Share & tools
lore

Heba Aamer

author
#0 lore raw

PATCH 1/1 staging: lustre: lustre: osc: fix Prefer seq_puts to seq_printf

This patch fixes the following checkpatch.pl warning:
Prefer seq_puts to seq_printf

---
 drivers/staging/lustre/lustre/osc/lproc_osc.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/osc/lproc_osc.c +4 -4
index 8e22e45..4da837e 100644
@@ -364,7 +364,7 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
 		else
 			seq_printf(m, "%s ", cksum_name[i]);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 	return 0;
 }
 
@@ -601,7 +601,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 	seq_printf(seq, "pending read pages:   %d\n",
 		   atomic_read(&cli->cl_pending_r_pages));
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "pages per rpc	 rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");
 
@@ -624,7 +624,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 			break;
 	}
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "rpcs in flight	rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");
 
@@ -647,7 +647,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 			break;
 	}
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "offset		rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 2 lines · Heba Aamer

This patch fixes the following checkpatch.pl warning:
Prefer seq_puts to seq_printf

checkpatch is pretty stupid.
Please don't just do what it says.

Look further and see what else can be improved.

drivers/staging/lustre/lustre/osc/lproc_osc.c

Quoted 1 line
drivers/staging/lustre/lustre/osc/lproc_osc.c +0 -0

[]

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_checksum_type_seq_show(struct seq_file *m, void *v) · line 367

Quoted 6 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -364,7 +364,7 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
 		else
 			seq_printf(m, "%s ", cksum_name[i]);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");

This could be seq_putc

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) · line 606

Quoted 8 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -601,7 +601,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 	seq_printf(seq, "pending read pages:   %d\n",
 		   atomic_read(&cli->cl_pending_r_pages));
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "pages per rpc	 rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");

The seq_printf uses with %% could also be seq_puts

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) · line 629

Quoted 8 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -624,7 +624,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 			break;
 	}
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "rpcs in flight	rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");

seq_puts here too

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) · line 653

Quoted 9 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -647,7 +647,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 			break;
 	}
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "offset		rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");
 

and here

author
#2 lore raw
Quoted 6 lines · Joe Perches
Quoted 2 lines · Heba Aamer

This patch fixes the following checkpatch.pl warning:
Prefer seq_puts to seq_printf

checkpatch is pretty stupid.
Please don't just do what it says.

I checked checkpatch script and I found it only searches for a % in order not to give that warning, and it does not consider its escaping case %%.

Quoted 2 lines

Look further and see what else can be improved.

I will make a new patch modifying all the seq_printf statements in that file soon.

Regards,
Heba Aamer

Quoted 47 lines

drivers/staging/lustre/lustre/osc/lproc_osc.c

Quoted 2 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +0 -0

[]

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_checksum_type_seq_show(struct seq_file *m, void *v) · line 367

Quoted 6 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -364,7 +364,7 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
 		else
 			seq_printf(m, "%s ", cksum_name[i]);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");

This could be seq_putc

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) · line 606

Quoted 8 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -601,7 +601,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 	seq_printf(seq, "pending read pages:   %d\n",
 		   atomic_read(&cli->cl_pending_r_pages));
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "pages per rpc	 rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");

The seq_printf uses with %% could also be seq_puts

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) · line 629

Quoted 8 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -624,7 +624,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 			break;
 	}
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "rpcs in flight	rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");

seq_puts here too

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) · line 653

Quoted 9 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -647,7 +647,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 			break;
 	}
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "offset		rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");
 

and here

maintainer
#3 lore raw
In reply to Heba Aamer
Quoted 13 lines · Heba Aamer

This patch fixes the following checkpatch.pl warning:
Prefer seq_puts to seq_printf

---
 drivers/staging/lustre/lustre/osc/lproc_osc.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/osc/lproc_osc.c +0 -0
index 8e22e45..4da837e 100644

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_checksum_type_seq_show(struct seq_file *m, void *v) · line 367

Quoted 5 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
@@ -364,7 +364,7 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
 		else
 			seq_printf(m, "%s ", cksum_name[i]);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");

I don't think this is a straight search/replace issue, but:

drivers/staging/lustre/lustre/osc/lproc_osc.c static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) · line 606

Quoted 11 lines
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -1
 	return 0;
 }
 
@@ -601,7 +601,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 	seq_printf(seq, "pending read pages:   %d\n",
 		   atomic_read(&cli->cl_pending_r_pages));
 
-	seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+	seq_puts(seq, "\n\t\t\tread\t\t\twrite\n");
 	seq_printf(seq, "pages per rpc	 rpcs   %% cum %% |");
 	seq_printf(seq, "       rpcs   %% cum %%\n");

if it were, why didn't you fix the other uses here?

thanks,

greg k-h