Skip to contentSkip to conversation

Staging : android: binder.c: Prefer seq_puts to seq_printf

PATCH Superseded Mathieu Rhéaume 4 participants 5 messages Oct 2, 2013 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging : android: binder.c: Prefer seq_puts to seq_printf

This patch changes seq_printf for seq_puts in binder.c. It fixes the warnings emitted by checkpatch.pl.

---
 drivers/staging/android/binder.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/android/binder.c +3 -3
index 09edebb..f3d4a1f 100644
@@ -3272,7 +3272,7 @@ binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer)
 static void print_binder_transaction(struct seq_file *m, const char *prefix,
 				     struct binder_transaction *t)
 {
-	seq_printf(m,
+	seq_puts(m,
 		   "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d",
 		   prefix, t->debug_id, t,
 		   t->from ? t->from->proc->pid : 0,
@@ -3287,7 +3287,7 @@ static void print_binder_transaction(struct seq_file *m, const char *prefix,
 	if (t->buffer->target_node)
 		seq_printf(m, " node %d",
 			   t->buffer->target_node->debug_id);
-	seq_printf(m, " size %zd:%zd data %p\n",
+	seq_puts(m, " size %zd:%zd data %p\n",
 		   t->buffer->data_size, t->buffer->offsets_size,
 		   t->buffer->data);
 }
@@ -3656,7 +3656,7 @@ static int binder_proc_show(struct seq_file *m, void *unused)
 static void print_binder_transaction_log_entry(struct seq_file *m,
 				struct binder_transaction_log_entry *e)
 {
-	seq_printf(m,
+	seq_puts(m,
 		  "%d: %s from %d:%d to %d:%d node %d handle %d size %d:%d\n",
 		   e->debug_id, (e->call_type == 2) ? "reply" :
 		   ((e->call_type == 1) ? "async" : "call "), e->from_proc,
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 2 lines · Mathieu Rhéaume

This patch changes seq_printf for seq_puts in binder.c. It fixes the warnings emitted by checkpatch.pl.

Please realign function argument to the open parenthesis.

drivers/staging/android/binder.c

Quoted 1 line
drivers/staging/android/binder.c +0 -0

[]

drivers/staging/android/binder.c binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) · line 3278

Quoted 9 lines
drivers/staging/android/binder.c +1 -1
@@ -3272,7 +3272,7 @@ binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer)
 static void print_binder_transaction(struct seq_file *m, const char *prefix,
 				     struct binder_transaction *t)
 {
-	seq_printf(m,
+	seq_puts(m,
 		   "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d",
 		   prefix, t->debug_id, t,
 		   t->from ? t->from->proc->pid : 0,

This should be

	seq_puts(m, "%s..."
		 prefix, etc...

using two tabs then 1 space to align to open parenthesis

drivers/staging/android/binder.c static void print_binder_transaction(struct seq_file *m, const char *prefix, · line 3291

Quoted 7 lines
drivers/staging/android/binder.c +1 -1
@@ -3287,7 +3287,7 @@ static void print_binder_transaction(struct seq_file *m, const char *prefix,
 	if (t->buffer->target_node)
 		seq_printf(m, " node %d",
 			   t->buffer->target_node->debug_id);
-	seq_printf(m, " size %zd:%zd data %p\n",
+	seq_puts(m, " size %zd:%zd data %p\n",
 		   t->buffer->data_size, t->buffer->offsets_size,
	seq_puts(m, " size...",
		 t->buffer->etc...

etc...

#2 lore raw
In reply to Mathieu Rhéaume
Quoted 13 lines · Mathieu Rhéaume

This patch changes seq_printf for seq_puts in binder.c. It fixes the warnings emitted by checkpatch.pl.

---
 drivers/staging/android/binder.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/android/binder.c +0 -0
index 09edebb..f3d4a1f 100644

drivers/staging/android/binder.c binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) · line 3278

Quoted 8 lines
drivers/staging/android/binder.c +1 -1
@@ -3272,7 +3272,7 @@ binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer)
 static void print_binder_transaction(struct seq_file *m, const char *prefix,
 				     struct binder_transaction *t)
 {
-	seq_printf(m,
+	seq_puts(m,
 		   "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d",
 		   prefix, t->debug_id, t,
 		   t->from ? t->from->proc->pid : 0,

Umm, this won't compile. seq_puts() is defined as:

  int seq_puts(struct seq_file *m, const char *s);

checkpatch.pl does indeed complain about uses of seq_printf() in drivers/staging/android/binder.c which are passing formatted strings. At a quick glance it looks like checkpatch.pl is only checking for the format string on the same line as seq_printf(), so this files ugly coding style confuses the check. Joe?

Anyway, please don't blindly change things in the kernel without at least compile testing them.

~Ryan

#3 lore raw
Quoted 3 lines · Ryan Mallon
Quoted 2 lines · Mathieu Rhéaume

This patch changes seq_printf for seq_puts in binder.c. It fixes the warnings emitted by checkpatch.pl.

[]

Quoted 9 lines

Umm, this won't compile. seq_puts() is defined as:

  int seq_puts(struct seq_file *m, const char *s);

checkpatch.pl does indeed complain about uses of seq_printf() in drivers/staging/android/binder.c which are passing formatted strings. At a quick glance it looks like checkpatch.pl is only checking for the format string on the same line as seq_printf(), so this files ugly coding style confuses the check. Joe?

True.

This patch should have fixed it. It's in -next already.

https://lkml.org/lkml/2013/9/13/698

Quoted 2 lines

Anyway, please don't blindly change things in the kernel without at least compile testing them.

Yes, please.

#4 lore raw
In reply to Mathieu Rhéaume
Quoted 2 lines · Mathieu Rhéaume

This patch changes seq_printf for seq_puts in binder.c. It fixes the warnings emitted by checkpatch.pl.

Which warnings? Seems like a false positive somehow because seq_puts() is totally wrong here. This doesn't compile.

regards,
dan carpenter