[PATCH 09/10] staging/irda/net: Combine some seq_printf() calls in two functions

SF Markus Elfring
2017-10-12T10:49:18Z

Date: Thu, 12 Oct 2017 08:58:38 +0200

Some data were printed into a sequence by separate function calls.
Print the same data by a single function call at each place instead.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/staging/irda/net/irlap.c | 9 ++++-----
drivers/staging/irda/net/irlmp.c | 6 ++----
2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/irda/net/irlap.c b/drivers/staging/irda/net/irlap.c
index 715cedab2f41..345c4eb55a59 100644
--- a/drivers/staging/irda/net/irlap.c
+++ b/drivers/staging/irda/net/irlap.c
@@ -1141,9 +1141,9 @@ static int irlap_seq_show(struct seq_file *seq, void *v)
seq_printf(seq, "vr: %d ", self->vr);
seq_printf(seq, "va: %d\n", self->va);

- seq_printf(seq, " qos\tbps\tmaxtt\tdsize\twinsize\taddbofs\tmintt\tldisc\tcomp\n");
-
- seq_printf(seq, " tx\t%d\t",
+ seq_printf(seq,
+ " qos\tbps\tmaxtt\tdsize\twinsize\taddbofs\tmintt\tldisc\tcomp\n"
+ " tx\t%d\t",
self->qos_tx.baud_rate.value);
seq_printf(seq, "%d\t",
self->qos_tx.max_turn_time.value);
@@ -1157,9 +1157,8 @@ static int irlap_seq_show(struct seq_file *seq, void *v)
self->qos_tx.min_turn_time.value);
seq_printf(seq, "%d\t",
self->qos_tx.link_disc_time.value);
- seq_printf(seq, "\n");

- seq_printf(seq, " rx\t%d\t",
+ seq_printf(seq, "\n rx\t%d\t",
self->qos_rx.baud_rate.value);
seq_printf(seq, "%d\t",
self->qos_rx.max_turn_time.value);
diff --git a/drivers/staging/irda/net/irlmp.c b/drivers/staging/irda/net/irlmp.c
index 318660fbc094..6a09cf621bd4 100644
--- a/drivers/staging/irda/net/irlmp.c
+++ b/drivers/staging/irda/net/irlmp.c
@@ -1920,8 +1920,7 @@ static int irlmp_seq_show(struct seq_file *seq, void *v)
seq_printf(seq,
"slsap_sel: %#02x, dlsap_sel: %#02x, ",
self->slsap_sel, self->dlsap_sel);
- seq_printf(seq, "(%s)", self->notify.name);
- seq_printf(seq, "\n");
+ seq_printf(seq, "(%s)\n", self->notify.name);
} else if (iter->hashbin = irlmp->links) {
struct lap_cb *lap = v;

@@ -1930,9 +1929,8 @@ static int irlmp_seq_show(struct seq_file *seq, void *v)

seq_printf(seq, "saddr: %#08x, daddr: %#08x, ",
lap->saddr, lap->daddr);
- seq_printf(seq, "num lsaps: %d",
+ seq_printf(seq, "num lsaps: %d\n",
HASHBIN_GET_SIZE(lap->lsaps));
- seq_printf(seq, "\n");

/* Careful for priority inversions here !
* All other uses of attrib spinlock are independent of
--
2.14.2