public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH next] batman-adv: use seq_puts instead of seq_printf when the format is constant
@ 2013-03-21  8:23 Antonio Quartulli
  2013-03-25  8:47 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2013-03-21  8:23 UTC (permalink / raw)
  To: b.a.t.m.a.n

As reported by checkpatch, seq_puts has to be preferred with
respect to seq_printf when the format is a constant string
(no va_args)

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---

However checkpatch seems to be implementing this check in a wrong way:
multi-line seq_printf are reported like having no arguments after the
format.

Cheers,


 gateway_client.c | 2 +-
 main.c           | 2 +-
 network-coding.c | 8 ++++----
 originator.c     | 4 ++--
 vis.c            | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gateway_client.c b/gateway_client.c
index 34f99a4..f105219 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -500,7 +500,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
 	rcu_read_unlock();
 
 	if (gw_count == 0)
-		seq_printf(seq, "No gateways in range ...\n");
+		seq_puts(seq, "No gateways in range ...\n");
 
 out:
 	if (primary_if)
diff --git a/main.c b/main.c
index 62b1f89..6277735 100644
--- a/main.c
+++ b/main.c
@@ -419,7 +419,7 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
 {
 	struct batadv_algo_ops *bat_algo_ops;
 
-	seq_printf(seq, "Available routing algorithms:\n");
+	seq_puts(seq, "Available routing algorithms:\n");
 
 	hlist_for_each_entry(bat_algo_ops, &batadv_algo_list, list) {
 		seq_printf(seq, "%s\n", bat_algo_ops->name);
diff --git a/network-coding.c b/network-coding.c
index 086c107..6b9a544 100644
--- a/network-coding.c
+++ b/network-coding.c
@@ -1760,23 +1760,23 @@ int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset)
 		hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
 			seq_printf(seq, "Node:      %pM\n", orig_node->orig);
 
-			seq_printf(seq, " Ingoing:  ");
+			seq_puts(seq, " Ingoing:  ");
 			/* For each in_nc_node to this orig_node */
 			list_for_each_entry_rcu(nc_node,
 						&orig_node->in_coding_list,
 						list)
 				seq_printf(seq, "%pM ",
 					   nc_node->addr);
-			seq_printf(seq, "\n");
+			seq_puts(seq, "\n");
 
-			seq_printf(seq, " Outgoing: ");
+			seq_puts(seq, " Outgoing: ");
 			/* For out_nc_node to this orig_node */
 			list_for_each_entry_rcu(nc_node,
 						&orig_node->out_coding_list,
 						list)
 				seq_printf(seq, "%pM ",
 					   nc_node->addr);
-			seq_printf(seq, "\n\n");
+			seq_puts(seq, "\n\n");
 		}
 		rcu_read_unlock();
 	}
diff --git a/originator.c b/originator.c
index 585e684..2f34525 100644
--- a/originator.c
+++ b/originator.c
@@ -465,7 +465,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
 					   neigh_node_tmp->tq_avg);
 			}
 
-			seq_printf(seq, "\n");
+			seq_puts(seq, "\n");
 			batman_count++;
 
 next:
@@ -475,7 +475,7 @@ next:
 	}
 
 	if (batman_count == 0)
-		seq_printf(seq, "No batman nodes in range ...\n");
+		seq_puts(seq, "No batman nodes in range ...\n");
 
 out:
 	if (primary_if)
diff --git a/vis.c b/vis.c
index c053244..962ccf3 100644
--- a/vis.c
+++ b/vis.c
@@ -149,7 +149,7 @@ static void batadv_vis_data_read_prim_sec(struct seq_file *seq,
 
 	hlist_for_each_entry(entry, if_list, list) {
 		if (entry->primary)
-			seq_printf(seq, "PRIMARY, ");
+			seq_puts(seq, "PRIMARY, ");
 		else
 			seq_printf(seq,  "SEC %pM, ", entry->addr);
 	}
@@ -207,7 +207,7 @@ static void batadv_vis_data_read_entries(struct seq_file *seq,
 		if (batadv_compare_eth(entry->addr, packet->vis_orig))
 			batadv_vis_data_read_prim_sec(seq, list);
 
-		seq_printf(seq, "\n");
+		seq_puts(seq, "\n");
 	}
 }
 
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH next] batman-adv: use seq_puts instead of seq_printf when the format is constant
  2013-03-21  8:23 [B.A.T.M.A.N.] [PATCH next] batman-adv: use seq_puts instead of seq_printf when the format is constant Antonio Quartulli
@ 2013-03-25  8:47 ` Marek Lindner
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2013-03-25  8:47 UTC (permalink / raw)
  To: b.a.t.m.a.n

On Thursday, March 21, 2013 16:23:29 Antonio Quartulli wrote:
> As reported by checkpatch, seq_puts has to be preferred with
> respect to seq_printf when the format is a constant string
> (no va_args)
> 
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
> 
> However checkpatch seems to be implementing this check in a wrong way:
> multi-line seq_printf are reported like having no arguments after the
> format.
> 
> Cheers,
> 
> 
>  gateway_client.c | 2 +-
>  main.c           | 2 +-
>  network-coding.c | 8 ++++----
>  originator.c     | 4 ++--
>  vis.c            | 4 ++--
>  5 files changed, 10 insertions(+), 10 deletions(-)

Applied in revision 174cf3a.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-25  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-21  8:23 [B.A.T.M.A.N.] [PATCH next] batman-adv: use seq_puts instead of seq_printf when the format is constant Antonio Quartulli
2013-03-25  8:47 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox