Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1637579 > unrolled thread

[PATCH] sky2: Use seq_putc() in sky2_debug_show()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-05-08 18:50 +0200
Last post2017-05-09 16:30 +0200
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sky2: Use seq_putc() in sky2_debug_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-08 18:50 +0200
    Re: [PATCH] sky2: Use seq_putc() in sky2_debug_show() Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2017-05-08 19:10 +0200
      Re: sky2: Use seq_putc() in sky2_debug_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-08 19:50 +0200
        Re: sky2: Use seq_putc() in sky2_debug_show() Stephen Hemminger <stephen@networkplumber.org> - 2017-05-09 08:00 +0200
          RE: sky2: Use seq_putc() in sky2_debug_show() David Laight <David.Laight@ACULAB.COM> - 2017-05-09 16:30 +0200

#1637579 — [PATCH] sky2: Use seq_putc() in sky2_debug_show()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-08 18:50 +0200
Subject[PATCH] sky2: Use seq_putc() in sky2_debug_show()
Message-ID<tEU1c-6nV-11@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 18:38:17 +0200

A single character (line break) should be put into a sequence.
Thus use the corresponding function "seq_putc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/marvell/sky2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 1145cde2274a..73575101cd72 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4562,7 +4562,7 @@ static int sky2_debug_show(struct seq_file *seq, void *v)
 			seq_printf(seq, "[%d] %#x %d %#x\n",
 				   idx, le->opcode, le->length, le->status);
 		}
-		seq_puts(seq, "\n");
+		seq_putc(seq, '\n');
 	}
 
 	seq_printf(seq, "Tx ring pending=%u...%u report=%d done=%d\n",
-- 
2.12.2

[toc] | [next] | [standalone]


#1637598

FromLino Sanfilippo <LinoSanfilippo@gmx.de>
Date2017-05-08 19:10 +0200
Message-ID<tEUky-6JE-15@gated-at.bofh.it>
In reply to#1637579
Hi,

On 08.05.2017 18:42, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 8 May 2017 18:38:17 +0200
> 
> A single character (line break) should be put into a sequence.

Why?

> Thus use the corresponding function "seq_putc".
> 
> This issue was detected by using the Coccinelle software.

Which issue do you mean? I dont see any issue you fix here.

> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/net/ethernet/marvell/sky2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
> index 1145cde2274a..73575101cd72 100644
> --- a/drivers/net/ethernet/marvell/sky2.c
> +++ b/drivers/net/ethernet/marvell/sky2.c
> @@ -4562,7 +4562,7 @@ static int sky2_debug_show(struct seq_file *seq, void *v)
>  			seq_printf(seq, "[%d] %#x %d %#x\n",
>  				   idx, le->opcode, le->length, le->status);
>  		}
> -		seq_puts(seq, "\n");
> +		seq_putc(seq, '\n');
>  	}
>  
>  	seq_printf(seq, "Tx ring pending=%u...%u report=%d done=%d\n",
> 

Regards,
Lino

[toc] | [prev] | [next] | [standalone]


#1637620 — Re: sky2: Use seq_putc() in sky2_debug_show()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-08 19:50 +0200
SubjectRe: sky2: Use seq_putc() in sky2_debug_show()
Message-ID<tEUXg-6Yd-9@gated-at.bofh.it>
In reply to#1637598
> Which issue do you mean? I dont see any issue you fix here.

Are the run time characteristics a bit nicer for the function “seq_putc”
in comparison to the function “seq_puts” for printing a single line break here?

Regards,
Markus

[toc] | [prev] | [next] | [standalone]


#1637884 — Re: sky2: Use seq_putc() in sky2_debug_show()

FromStephen Hemminger <stephen@networkplumber.org>
Date2017-05-09 08:00 +0200
SubjectRe: sky2: Use seq_putc() in sky2_debug_show()
Message-ID<tF6lI-5Sx-17@gated-at.bofh.it>
In reply to#1637620
On Mon, 8 May 2017 19:42:46 +0200
SF Markus Elfring <elfring@users.sourceforge.net> wrote:

> > Which issue do you mean? I dont see any issue you fix here.  
> 
> Are the run time characteristics a bit nicer for the function “seq_putc”
> in comparison to the function “seq_puts” for printing a single line break here?
> 
> Regards,
> Markus

I would put this in why bother category. seq_puts is correct and this is only
in diagnostic output useful to developer and disabled on most distro kernels

[toc] | [prev] | [next] | [standalone]


#1638159 — RE: sky2: Use seq_putc() in sky2_debug_show()

FromDavid Laight <David.Laight@ACULAB.COM>
Date2017-05-09 16:30 +0200
SubjectRE: sky2: Use seq_putc() in sky2_debug_show()
Message-ID<tFejg-2TS-21@gated-at.bofh.it>
In reply to#1637884
From: Stephen Hemminger
> Sent: 09 May 2017 06:50
> On Mon, 8 May 2017 19:42:46 +0200
> SF Markus Elfring <elfring@users.sourceforge.net> wrote:
> 
> > > Which issue do you mean? I dont see any issue you fix here.
> >
> > Are the run time characteristics a bit nicer for the function seq_putc
> > in comparison to the function seq_puts for printing a single line break here?
> >
> > Regards,
> > Markus
> 
> I would put this in why bother category. seq_puts is correct and this is only
> in diagnostic output useful to developer and disabled on most distro kernels

Sometimes consistency is best.
Output everything with seq_printf(), using a format "%s" if necessary.
The performance really doesn't matter here at all.

It is also (probably) possible to get gcc to do the conversions - as it does for printf().
(A right PITA for embedded systems where only printf() exists.)

	David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web