diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-19 13:02:53 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-19 13:02:53 -0500 |
commit | 8ce74dd6057832618957fc2cbd38fa959c3a0a6c (patch) | |
tree | af3bede951087ebc58988ad073182a85bf899e27 /fs/debugfs | |
parent | 78d28e651f97866d608d9b41f8ad291e65d47dd5 (diff) | |
parent | 9761536e1d9e9e1f325fb04d4ad46b15a39eb94a (diff) |
Merge tag 'trace-seq-file-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into for-next
Pull the beginning of seq_file cleanup from Steven:
"I'm looking to clean up the seq_file code and to eventually merge the
trace_seq code with seq_file as well, since they basically do the same thing.
Part of this process is to remove the return code of seq_printf() and friends
as they are rather inconsistent. It is better to use the new function
seq_has_overflowed() if you want to stop processing when the buffer
is full. Note, if the buffer is full, the seq_file code will throw away
the contents, allocate a bigger buffer, and then call your code again
to fill in the data. The only thing that breaking out of the function
early does is to save a little time which is probably never noticed.
I started with patches from Joe Perches and modified them as well.
There's many more places that need to be updated before we can convert
seq_printf() and friends to return void. But this patch set introduces
the seq_has_overflowed() and does some initial updates."
Diffstat (limited to 'fs/debugfs')
-rw-r--r-- | fs/debugfs/file.c | 15 |
1 files changed, 8 insertions, 7 deletions
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); | |||
692 | * because some peripherals have several blocks of identical registers, | 692 | * because some peripherals have several blocks of identical registers, |
693 | * for example configuration of dma channels | 693 | * for example configuration of dma channels |
694 | */ | 694 | */ |
695 | int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | 695 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, |
696 | int nregs, void __iomem *base, char *prefix) | 696 | int nregs, void __iomem *base, char *prefix) |
697 | { | 697 | { |
698 | int i, ret = 0; | 698 | int i; |
699 | 699 | ||
700 | for (i = 0; i < nregs; i++, regs++) { | 700 | for (i = 0; i < nregs; i++, regs++) { |
701 | if (prefix) | 701 | if (prefix) |
702 | ret += seq_printf(s, "%s", prefix); | 702 | seq_printf(s, "%s", prefix); |
703 | ret += seq_printf(s, "%s = 0x%08x\n", regs->name, | 703 | seq_printf(s, "%s = 0x%08x\n", regs->name, |
704 | readl(base + regs->offset)); | 704 | readl(base + regs->offset)); |
705 | if (seq_has_overflowed(s)) | ||
706 | break; | ||
705 | } | 707 | } |
706 | return ret; | ||
707 | } | 708 | } |
708 | EXPORT_SYMBOL_GPL(debugfs_print_regs32); | 709 | EXPORT_SYMBOL_GPL(debugfs_print_regs32); |
709 | 710 | ||