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


Groups > linux.kernel > #1496497 > unrolled thread

[PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-10-06 11:40 +0200
Last post2016-10-06 21:20 +0200
Articles 8 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in  raid5_status() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 11:40 +0200
    Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by  seq_puts() in raid5_status() Joe Perches <coupons@perches.com> - 2016-10-06 18:40 +0200
      Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts()  in raid5_status() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 19:20 +0200
        Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by  seq_puts() in raid5_status() Joe Perches <joe@perches.com> - 2016-10-06 19:40 +0200
          Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts()  in raid5_status() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 20:00 +0200
            Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by  seq_puts() in raid5_status() Joe Perches <joe@perches.com> - 2016-10-06 20:00 +0200
              Re: md/raid5: Replace a seq_printf() call by seq_puts() in  raid5_status() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 20:30 +0200
            Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by  seq_puts() in raid5_status() Bernd Petrovitsch <bernd@petrovitsch.priv.at> - 2016-10-06 21:20 +0200

#1496497 — [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-06 11:40 +0200
Subject[PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()
Message-ID<spdjI-6HB-29@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 5 Oct 2016 14:40:27 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: Prefer seq_puts to seq_printf

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

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ebcd692..7a825c0 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7044,7 +7044,7 @@ static void raid5_status(struct seq_file *seq, struct mddev *mddev)
 			   rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_");
 	}
 	rcu_read_unlock();
-	seq_printf (seq, "]");
+	seq_puts(seq, "]");
 }
 
 static void print_raid5_conf(struct r5conf *conf)
-- 
2.10.1

[toc] | [next] | [standalone]


#1496758 — Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

FromJoe Perches <coupons@perches.com>
Date2016-10-06 18:40 +0200
SubjectRe: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()
Message-ID<spjSa-2Un-39@gated-at.bofh.it>
In reply to#1496497
On Thu, 2016-10-06 at 11:37 +0200, SF Markus Elfring wrote:
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
[]
> @@ -7044,7 +7044,7 @@ static void raid5_status(struct seq_file *seq, struct mddev *mddev)
>  			   rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_");
>  	}
>  	rcu_read_unlock();
> -	seq_printf (seq, "]");
> +	seq_puts(seq, "]");

seq_putc

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


#1496771 — Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-06 19:20 +0200
SubjectRe: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()
Message-ID<spkuR-3vj-3@gated-at.bofh.it>
In reply to#1496758
>> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> []
>> @@ -7044,7 +7044,7 @@ static void raid5_status(struct seq_file *seq, struct mddev *mddev)
>>  			   rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_");
>>  	}
>>  	rcu_read_unlock();
>> -	seq_printf (seq, "]");
>> +	seq_puts(seq, "]");
> 
> seq_putc

Thanks for your update suggestion.

How do you think about the possibility that the script "checkpatch.pl" can also point
such a source code transformation out directly?
Would an additional check for the length of the passed string be useful in similar
use cases?

Regards,
Markus

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


#1496782 — Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

FromJoe Perches <joe@perches.com>
Date2016-10-06 19:40 +0200
SubjectRe: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()
Message-ID<spkOd-3Hh-25@gated-at.bofh.it>
In reply to#1496771
On Thu, 2016-10-06 at 19:09 +0200, SF Markus Elfring wrote:
> > > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> > []
> > > @@ -7044,7 +7044,7 @@ static void raid5_status(struct seq_file *seq, struct mddev *mddev)
> > >  			   rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_");
> > >  	}
> > >  	rcu_read_unlock();
> > > -	seq_printf (seq, "]");
> > > +	seq_puts(seq, "]");
> > seq_putc
> How do you think about the possibility that the script "checkpatch.pl" can also point
> such a source code transformation out directly?

Why don't _you_ try to implement that in checkpatch instead?

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


#1496787 — Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-06 20:00 +0200
SubjectRe: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()
Message-ID<spl7A-3RX-39@gated-at.bofh.it>
In reply to#1496782
>>>> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
>>> []
>>>> @@ -7044,7 +7044,7 @@ static void raid5_status(struct seq_file *seq, struct mddev *mddev)
>>>>  			   rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_");
>>>>  	}
>>>>  	rcu_read_unlock();
>>>> -	seq_printf (seq, "]");
>>>> +	seq_puts(seq, "]");
>>> seq_putc
>> How do you think about the possibility that the script "checkpatch.pl" can also point
>> such a source code transformation out directly?
> 
> Why don't _you_ try to implement that in checkpatch instead?

How are the chances that any other software developer would be quicker (than me) for such
an addition because of more practical knowledge for the programming language "Perl"?

Regards,
Markus

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


#1496788 — Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

FromJoe Perches <joe@perches.com>
Date2016-10-06 20:00 +0200
SubjectRe: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()
Message-ID<spl7A-3RX-43@gated-at.bofh.it>
In reply to#1496787
On Thu, 2016-10-06 at 19:49 +0200, SF Markus Elfring wrote:
> > Why don't _you_ try to implement that in checkpatch instead?
> How are the chances that any other software developer would be quicker (than me) for such
> an addition because of more practical knowledge for the programming language "Perl"?

Extremely high.

What are the chances you can add useful attributes to your skilz?

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


#1496796 — Re: md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-06 20:30 +0200
SubjectRe: md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()
Message-ID<splAB-4sH-1@gated-at.bofh.it>
In reply to#1496788
>>> Why don't _you_ try to implement that in checkpatch instead?
>> How are the chances that any other software developer would be quicker (than me) for such
>> an addition because of more practical knowledge for the programming language "Perl"?
> 
> Extremely high.

Thanks for this feedback.


> What are the chances you can add useful attributes to your skilz?

Unfortunately, "Perl" does not belong to a favourite in my current collection
of programming languages I learned through my software development activities.
I imagine that I would prefer to improve other Linux software modules
for a while instead?

Would it be interesting if the Coccinelle software could help a bit more with
corresponding semantic patches?

Regards,
Markus

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


#1496821 — Re: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()

FromBernd Petrovitsch <bernd@petrovitsch.priv.at>
Date2016-10-06 21:20 +0200
SubjectRe: [PATCH 37/54] md/raid5: Replace a seq_printf() call by seq_puts() in raid5_status()
Message-ID<spmmZ-57E-3@gated-at.bofh.it>
In reply to#1496787
Hi all!

On Thu, 2016-10-06 at 19:49 +0200, SF Markus Elfring wrote:
> > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> > > > []
> > > > > 
> > > > > @@ -7044,7 +7044,7 @@ static void raid5_status(struct
> > > > > seq_file *seq, struct mddev *mddev)
> > > > >  			   rdev && test_bit(In_sync, &rdev-
> > > > > >flags) ? "U" : "_");
> > > > >  	}
> > > > >  	rcu_read_unlock();
> > > > > -	seq_printf (seq, "]");
> > > > > +	seq_puts(seq, "]");
> > > > seq_putc
> > > How do you think about the possibility that the script
> > > "checkpatch.pl" can also point
> > > such a source code transformation out directly?
> > 
> > Why don't _you_ try to implement that in checkpatch instead?
> 
> How are the chances that any other software developer would be
> quicker (than me) for such
> an addition because of more practical knowledge for the programming
> language "Perl"?

The above is BTW a pretty simple thing and thus good for a learning
experience for regular expressions and copy-pasting a few lines in that
perl-script and editing them.

MfG,
	Bernd

PS: Sry for the noise - it's somewhat OT here ....
-- 
Bernd Petrovitsch                  Email : bernd@petrovitsch.priv.at
                     LUGA : http://www.luga.at

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web