fs/seq_file: use seq_* helpers in seq_hex_dump()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Sat, 7 Nov 2015 00:32:37 +0000 (16:32 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 7 Nov 2015 01:50:42 +0000 (17:50 -0800)
This improves code readability.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/seq_file.c

index 225586e141cac6e21a35b75e74201355f7f3f6d1..ad034fb49f300d3a300dc75728b18897c9eae031 100644 (file)
@@ -773,6 +773,8 @@ void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
 {
        const u8 *ptr = buf;
        int i, linelen, remaining = len;
+       char *buffer;
+       size_t size;
        int ret;
 
        if (rowsize != 16 && rowsize != 32)
@@ -794,15 +796,12 @@ void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
                        break;
                }
 
+               size = seq_get_buf(m, &buffer);
                ret = hex_dump_to_buffer(ptr + i, linelen, rowsize, groupsize,
-                                        m->buf + m->count, m->size - m->count,
-                                        ascii);
-               if (ret >= m->size - m->count) {
-                       seq_set_overflow(m);
-               } else {
-                       m->count += ret;
-                       seq_putc(m, '\n');
-               }
+                                        buffer, size, ascii);
+               seq_commit(m, ret < size ? ret : -1);
+
+               seq_putc(m, '\n');
        }
 }
 EXPORT_SYMBOL(seq_hex_dump);