[PATCH 1/3] mtdswap: Reduce function calls for sequence output in mtdswap_show()

From: SF Markus Elfring
Date: Mon May 08 2017 - 11:09:07 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 8 May 2017 16:02:34 +0200

Two line breaks were put into a sequence by separate function calls.
Print the same data together with adjusted seq_printf() calls instead.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/mtd/mtdswap.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index f12879a3d4ff..0805f45c5139 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1283,19 +1283,14 @@ static int mtdswap_show(struct seq_file *s, void *data)
"erased %u times\n",
cwp, d->pages_per_eblk - cwp, cwecount);

- seq_printf(s, "total erasures: %lu\n", sum);
-
- seq_puts(s, "\n");
-
+ seq_printf(s, "total erasures: %lu\n\n", sum);
seq_printf(s, "mtdswap_readsect count: %llu\n", d->sect_read_count);
seq_printf(s, "mtdswap_writesect count: %llu\n", d->sect_write_count);
seq_printf(s, "mtdswap_discard count: %llu\n", d->discard_count);
seq_printf(s, "mtd read count: %llu\n", d->mtd_read_count);
seq_printf(s, "mtd write count: %llu\n", d->mtd_write_count);
seq_printf(s, "discarded pages count: %llu\n", d->discard_page_count);
-
- seq_puts(s, "\n");
- seq_printf(s, "total pages: %u\n", pages);
+ seq_printf(s, "\ntotal pages: %u\n", pages);
seq_printf(s, "pages mapped: %u\n", mapped);

return 0;
--
2.12.2