public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>, Joe Perches <joe@perches.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [RFA][PATCH 8/8] debugfs: Have debugfs_print_regs32() return void
Date: Wed, 29 Oct 2014 17:56:10 -0400	[thread overview]
Message-ID: <20141029220108.467786659@goodmis.org> (raw)
In-Reply-To: 20141029215602.535533597@goodmis.org

[-- Attachment #1: 0008-debugfs-Have-debugfs_print_regs32-return-void.patch --]
[-- Type: text/plain, Size: 3795 bytes --]

From: Joe Perches <joe@perches.com>

[ REQUEST FOR ACKS ]

The seq_printf() will soon just return void, and seq_has_overflowed()
should be used instead to see if the seq can no longer accept input.

As the return value of debugfs_print_regs32() has no users and
the seq_file descriptor should be checked with seq_has_overflowed()
instead of return values of functions, it is better to just have
debugfs_print_regs32() also return void.

Link: http://lkml.kernel.org/p/2634b19eb1c04a9d31148c1fe6f1f3819be95349.1412031505.git.joe@perches.com

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Joe Perches <joe@perches.com>
[ original change only updated seq_printf() return, added return of
  void to debugfs_print_regs32() as well ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 Documentation/filesystems/debugfs.txt |  2 +-
 fs/debugfs/file.c                     | 15 ++++++++-------
 include/linux/debugfs.h               |  7 +++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt
index 3a863f692728..88ab81c79109 100644
--- a/Documentation/filesystems/debugfs.txt
+++ b/Documentation/filesystems/debugfs.txt
@@ -140,7 +140,7 @@ file.
 				     struct dentry *parent,
 				     struct debugfs_regset32 *regset);
 
-    int debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
+    void debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
 			 int nregs, void __iomem *base, char *prefix);
 
 The "base" argument may be 0, but you may want to build the reg32 array
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 76c08c2beb2f..8e0f2f410189 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -692,18 +692,19 @@ EXPORT_SYMBOL_GPL(debugfs_create_u32_array);
  * because some peripherals have several blocks of identical registers,
  * for example configuration of dma channels
  */
-int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
-			   int nregs, void __iomem *base, char *prefix)
+void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
+			  int nregs, void __iomem *base, char *prefix)
 {
-	int i, ret = 0;
+	int i;
 
 	for (i = 0; i < nregs; i++, regs++) {
 		if (prefix)
-			ret += seq_printf(s, "%s", prefix);
-		ret += seq_printf(s, "%s = 0x%08x\n", regs->name,
-				  readl(base + regs->offset));
+			seq_printf(s, "%s", prefix);
+		seq_printf(s, "%s = 0x%08x\n", regs->name,
+			   readl(base + regs->offset));
+		if (seq_has_overflowed(s))
+			break;
 	}
-	return ret;
 }
 EXPORT_SYMBOL_GPL(debugfs_print_regs32);
 
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 4d0b4d1aa132..d84f8c254a87 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -92,8 +92,8 @@ struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
 				     struct dentry *parent,
 				     struct debugfs_regset32 *regset);
 
-int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
-			 int nregs, void __iomem *base, char *prefix);
+void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
+			  int nregs, void __iomem *base, char *prefix);
 
 struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
 					struct dentry *parent,
@@ -233,10 +233,9 @@ static inline struct dentry *debugfs_create_regset32(const char *name,
 	return ERR_PTR(-ENODEV);
 }
 
-static inline int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
+static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
 			 int nregs, void __iomem *base, char *prefix)
 {
-	return 0;
 }
 
 static inline bool debugfs_initialized(void)
-- 
2.1.1



  parent reply	other threads:[~2014-10-29 22:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 21:56 [RFA][PATCH 0/8] seq_file: Remove return checks of seq_printf() Steven Rostedt
2014-10-29 21:56 ` [RFA][PATCH 1/8] seq_file: Rename seq_overflow() to seq_has_overflowed() and make public Steven Rostedt
2014-10-29 22:08   ` Joe Perches
2014-10-29 23:42     ` Steven Rostedt
2014-10-29 23:53       ` Joe Perches
2014-10-30  0:10         ` Steven Rostedt
2014-10-30  0:26           ` Joe Perches
2014-10-30  0:20     ` Steven Rostedt
2014-10-30  0:27       ` Steven Rostedt
2014-10-30  4:39         ` Joe Perches
2014-10-29 21:56 ` [RFA][PATCH 2/8] netfilter: Remove return values for print_conntrack callbacks Steven Rostedt
2014-10-29 22:16   ` Florian Westphal
2014-10-29 23:53     ` Steven Rostedt
2014-10-30  1:06     ` Steven Rostedt
2014-11-04 13:05   ` Steven Rostedt
2014-11-04 14:11     ` Steven Rostedt
2014-11-04 14:22     ` Pablo Neira Ayuso
2014-11-04 14:31       ` Steven Rostedt
2014-11-04 14:46         ` Joe Perches
2014-11-04 14:52           ` Steven Rostedt
2014-11-04 14:46         ` Pablo Neira Ayuso
2014-11-04 14:48           ` Steven Rostedt
2014-11-04 19:59           ` Steven Rostedt
2014-10-29 21:56 ` [RFA][PATCH 3/8] netfilter: Convert print_tuple functions to return void Steven Rostedt
2014-11-04 13:07   ` Steven Rostedt
2014-11-04 14:50   ` Steven Rostedt
2014-10-29 21:56 ` [RFA][PATCH 4/8] netfilter: Remove checks of seq_printf() return values Steven Rostedt
2014-11-04 13:08   ` Steven Rostedt
2014-10-29 21:56 ` [RFA][PATCH 5/8] dlm: Remove seq_printf() return checks and use seq_has_overflowed() Steven Rostedt
2014-11-04 13:08   ` Steven Rostedt
2014-11-04 19:57     ` David Teigland
2014-10-29 21:56 ` [RFA][PATCH 6/8] dlm: Use seq_puts() instead of seq_printf() for constant strings Steven Rostedt
2014-11-04 13:09   ` Steven Rostedt
2014-10-29 21:56 ` [RFA][PATCH 7/8] fs: Convert show_fdinfo functions to void Steven Rostedt
2014-10-29 21:56 ` Steven Rostedt [this message]
2014-10-29 22:03   ` [RFA][PATCH 8/8] debugfs: Have debugfs_print_regs32() return void Greg Kroah-Hartman
2014-10-29 23:37     ` Steven Rostedt
2014-11-04 13:04 ` [RFA][PATCH 0/8] seq_file: Remove return checks of seq_printf() Steven Rostedt
2014-11-05 17:50   ` Al Viro
2014-11-05 18:14     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141029220108.467786659@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox