public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf
@ 2013-10-02  1:57 Mathieu Rhéaume
  2013-10-02  2:19 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mathieu Rhéaume @ 2013-10-02  1:57 UTC (permalink / raw)
  To: mathieu
  Cc: gregkh, arve, dan.carpenter, mirsal, serban.constantinescu, devel,
	linux-kernel

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

Signed-off-by: Mathieu Rhéaume <mathieu@codingrhemes.com>
---
 drivers/staging/android/binder.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 09edebb..f3d4a1f 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -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,
-- 
1.8.3.1


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

* Re: [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf
  2013-10-02  1:57 [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf Mathieu Rhéaume
@ 2013-10-02  2:19 ` Joe Perches
  2013-10-02  5:15 ` Ryan Mallon
  2013-10-02  7:55 ` Dan Carpenter
  2 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2013-10-02  2:19 UTC (permalink / raw)
  To: Mathieu Rhéaume
  Cc: gregkh, arve, dan.carpenter, mirsal, serban.constantinescu, devel,
	linux-kernel

On Tue, 2013-10-01 at 21:57 -0400, Mathieu Rhéaume wrote:
> 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.

> diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
[]
> @@ -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

> @@ -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...



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

* Re: [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf
  2013-10-02  1:57 [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf Mathieu Rhéaume
  2013-10-02  2:19 ` Joe Perches
@ 2013-10-02  5:15 ` Ryan Mallon
  2013-10-02  6:35   ` Joe Perches
  2013-10-02  7:55 ` Dan Carpenter
  2 siblings, 1 reply; 5+ messages in thread
From: Ryan Mallon @ 2013-10-02  5:15 UTC (permalink / raw)
  To: Mathieu Rhéaume
  Cc: gregkh, arve, dan.carpenter, mirsal, serban.constantinescu, devel,
	linux-kernel, Joe Perches

On 02/10/13 11:57, Mathieu Rhéaume wrote:
> This patch changes seq_printf for seq_puts in binder.c.
> It fixes the warnings emitted by checkpatch.pl.
> 
> Signed-off-by: Mathieu Rhéaume <mathieu@codingrhemes.com>
> ---
>  drivers/staging/android/binder.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
> index 09edebb..f3d4a1f 100644
> --- a/drivers/staging/android/binder.c
> +++ b/drivers/staging/android/binder.c
> @@ -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


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

* Re: [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf
  2013-10-02  5:15 ` Ryan Mallon
@ 2013-10-02  6:35   ` Joe Perches
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2013-10-02  6:35 UTC (permalink / raw)
  To: Ryan Mallon
  Cc: Mathieu Rhéaume, gregkh, arve, dan.carpenter, mirsal,
	serban.constantinescu, devel, linux-kernel

On Wed, 2013-10-02 at 15:15 +1000, Ryan Mallon wrote:
> On 02/10/13 11:57, Mathieu Rhéaume wrote:
> > This patch changes seq_printf for seq_puts in binder.c.
> > It fixes the warnings emitted by checkpatch.pl.
[]
> 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

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

Yes, please.


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

* Re: [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf
  2013-10-02  1:57 [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf Mathieu Rhéaume
  2013-10-02  2:19 ` Joe Perches
  2013-10-02  5:15 ` Ryan Mallon
@ 2013-10-02  7:55 ` Dan Carpenter
  2 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2013-10-02  7:55 UTC (permalink / raw)
  To: Mathieu Rhéaume
  Cc: devel, gregkh, serban.constantinescu, linux-kernel, arve, mirsal

On Tue, Oct 01, 2013 at 09:57:36PM -0400, Mathieu Rhéaume wrote:
> 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


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

end of thread, other threads:[~2013-10-02  7:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02  1:57 [PATCH] Staging : android: binder.c: Prefer seq_puts to seq_printf Mathieu Rhéaume
2013-10-02  2:19 ` Joe Perches
2013-10-02  5:15 ` Ryan Mallon
2013-10-02  6:35   ` Joe Perches
2013-10-02  7:55 ` Dan Carpenter

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