linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] openpromfs: Adjust three seq_printf() calls in property_show()
@ 2019-07-02 15:40 Markus Elfring
  2019-07-02 16:08 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2019-07-02 15:40 UTC (permalink / raw)
  To: kernel-janitors, Al Viro, David S. Miller, Greg Kroah-Hartman,
	Rob Herring, Thomas Gleixner
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 2 Jul 2019 17:24:27 +0200

A bit of information should be put into a sequence.
Thus improve the execution speed for this data output by better usage
of corresponding functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/openpromfs/inode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index e6cb7689fec4..2234103fd8ee 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -76,14 +76,14 @@ static int property_show(struct seq_file *f, void *v)
 		while (len > 0) {
 			int n = strlen(pval);

-			seq_printf(f, "%s", (char *) pval);
+			seq_puts(f, (char *) pval);

 			/* Skip over the NULL byte too.  */
 			pval += n + 1;
 			len -= n + 1;

 			if (len > 0)
-				seq_printf(f, " + ");
+				seq_puts(f, " + ");
 		}
 	} else {
 		if (len & 3) {
@@ -111,8 +111,7 @@ static int property_show(struct seq_file *f, void *v)
 			}
 		}
 	}
-	seq_printf(f, "\n");
-
+	seq_putc(f, '\n');
 	return 0;
 }

--
2.22.0


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

* Re: [PATCH] openpromfs: Adjust three seq_printf() calls in property_show()
  2019-07-02 15:40 [PATCH] openpromfs: Adjust three seq_printf() calls in property_show() Markus Elfring
@ 2019-07-02 16:08 ` Joe Perches
  2019-07-02 17:59   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2019-07-02 16:08 UTC (permalink / raw)
  To: Markus Elfring, kernel-janitors, Al Viro, David S. Miller,
	Greg Kroah-Hartman, Rob Herring, Thomas Gleixner
  Cc: LKML

On Tue, 2019-07-02 at 17:40 +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 2 Jul 2019 17:24:27 +0200
> 
> A bit of information should be put into a sequence.
> Thus improve the execution speed for this data output by better usage
> of corresponding functions.
> 
> This issue was detected by using the Coccinelle software.

(wasn't Markus perma-banned?)

> diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
[]
> @@ -76,14 +76,14 @@ static int property_show(struct seq_file *f, void *v)
>  		while (len > 0) {
>  			int n = strlen(pval);
> 
> -			seq_printf(f, "%s", (char *) pval);
> +			seq_puts(f, (char *) pval);
> 
>  			/* Skip over the NULL byte too.  */
>  			pval += n + 1;
>  			len -= n + 1;
> 
>  			if (len > 0)
> -				seq_printf(f, " + ");
> +				seq_puts(f, " + ");
>  		}
>  	} else {
>  		if (len & 3) {
> @@ -111,8 +111,7 @@ static int property_show(struct seq_file *f, void *v)
>  			}
>  		}
>  	}
> -	seq_printf(f, "\n");
> -
> +	seq_putc(f, '\n');
>  	return 0;
>  }

If this is really useful (and it's really not),
at least change void *pval to char *pval and
remove a bunch of useless casts.



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

* Re: [PATCH] openpromfs: Adjust three seq_printf() calls in property_show()
  2019-07-02 16:08 ` Joe Perches
@ 2019-07-02 17:59   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-02 17:59 UTC (permalink / raw)
  To: Joe Perches
  Cc: Markus Elfring, kernel-janitors, Al Viro, David S. Miller,
	Rob Herring, Thomas Gleixner, LKML

On Tue, Jul 02, 2019 at 09:08:04AM -0700, Joe Perches wrote:
> On Tue, 2019-07-02 at 17:40 +0200, Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Tue, 2 Jul 2019 17:24:27 +0200
> > 
> > A bit of information should be put into a sequence.
> > Thus improve the execution speed for this data output by better usage
> > of corresponding functions.
> > 
> > This issue was detected by using the Coccinelle software.
> 
> (wasn't Markus perma-banned?)

He's in my kill-file, I recommend you doing the same, it's much easier
that way :)

thanks,

greg k-h

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

end of thread, other threads:[~2019-07-02 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 15:40 [PATCH] openpromfs: Adjust three seq_printf() calls in property_show() Markus Elfring
2019-07-02 16:08 ` Joe Perches
2019-07-02 17:59   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).