diff mbox

[13/18] HID-debug: Combine 11 seq_printf() calls into one call in hid_dump_field()

Message ID 99abe158-ba41-99eb-95e1-e9aed7bafb53@users.sourceforge.net (mailing list archive)
State New, archived
Headers show

Commit Message

SF Markus Elfring Feb. 7, 2017, 7:56 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 7 Feb 2017 20:04:28 +0100

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

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/hid/hid-debug.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

Comments

Joe Perches Feb. 7, 2017, 10:52 p.m. UTC | #1
On Tue, 2017-02-07 at 20:56 +0100, SF Markus Elfring wrote:
> diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
[]
> @@ -614,19 +614,18 @@ void hid_dump_field(struct hid_field *field, int n, struct seq_file *f) {
>  	tab(n, f); seq_printf(f, "Report Size(%u)\n", field->report_size);
>  	tab(n, f); seq_printf(f, "Report Count(%u)\n", field->report_count);
>  	tab(n, f); seq_printf(f, "Report Offset(%u)\n", field->report_offset);
> -
> -	tab(n, f); seq_printf(f, "Flags( ");
> +	tab(n, f);

Consider converting tab(n, f) to seq_indent(f, n)
making seq_indent a global function or maybe using
a new name like seq_spaces, and converting the
existing uses in net/ipv4/fib_trie.c appropriately.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 2ce809eb4c97..aafa963e8a04 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -614,19 +614,18 @@  void hid_dump_field(struct hid_field *field, int n, struct seq_file *f) {
 	tab(n, f); seq_printf(f, "Report Size(%u)\n", field->report_size);
 	tab(n, f); seq_printf(f, "Report Count(%u)\n", field->report_count);
 	tab(n, f); seq_printf(f, "Report Offset(%u)\n", field->report_offset);
-
-	tab(n, f); seq_printf(f, "Flags( ");
+	tab(n, f);
 	j = field->flags;
-	seq_printf(f, "%s", HID_MAIN_ITEM_CONSTANT & j ? "Constant " : "");
-	seq_printf(f, "%s", HID_MAIN_ITEM_VARIABLE & j ? "Variable " : "Array ");
-	seq_printf(f, "%s", HID_MAIN_ITEM_RELATIVE & j ? "Relative " : "Absolute ");
-	seq_printf(f, "%s", HID_MAIN_ITEM_WRAP & j ? "Wrap " : "");
-	seq_printf(f, "%s", HID_MAIN_ITEM_NONLINEAR & j ? "NonLinear " : "");
-	seq_printf(f, "%s", HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPreferredState " : "");
-	seq_printf(f, "%s", HID_MAIN_ITEM_NULL_STATE & j ? "NullState " : "");
-	seq_printf(f, "%s", HID_MAIN_ITEM_VOLATILE & j ? "Volatile " : "");
-	seq_printf(f, "%s", HID_MAIN_ITEM_BUFFERED_BYTE & j ? "BufferedByte " : "");
-	seq_printf(f, ")\n");
+	seq_printf(f, "Flags( %s%s%s%s%s%s%s%s%s)\n",
+		   HID_MAIN_ITEM_CONSTANT & j ? "Constant " : "",
+		   HID_MAIN_ITEM_VARIABLE & j ? "Variable " : "Array ",
+		   HID_MAIN_ITEM_RELATIVE & j ? "Relative " : "Absolute ",
+		   HID_MAIN_ITEM_WRAP & j ? "Wrap " : "",
+		   HID_MAIN_ITEM_NONLINEAR & j ? "NonLinear " : "",
+		   HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPreferredState " : "",
+		   HID_MAIN_ITEM_NULL_STATE & j ? "NullState " : "",
+		   HID_MAIN_ITEM_VOLATILE & j ? "Volatile " : "",
+		   HID_MAIN_ITEM_BUFFERED_BYTE & j ? "BufferedByte " : "");
 }
 EXPORT_SYMBOL_GPL(hid_dump_field);