public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-input@vger.kernel.org,
	"Benjamin Tissoires" <benjamin.tissoires@redhat.com>,
	"Bruno Prémont" <bonbons@linux-vserver.org>,
	"Jiri Kosina" <jikos@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 12/18] HID-debug: Replace 12 seq_printf() calls by seq_puts()
Date: Tue, 7 Feb 2017 20:55:09 +0100	[thread overview]
Message-ID: <5e7692e4-b857-f708-080c-013ddcdcfe0f@users.sourceforge.net> (raw)
In-Reply-To: <edd25fcd-8625-2469-fa28-2315f81b6b8e@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 7 Feb 2017 20:02:45 +0100

Strings which did not contain data format specifications should be put into
a sequence. Thus use the corresponding function "seq_puts".

This issue was detected by using the Coccinelle software.

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

diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 8d019d0db4f3..2ce809eb4c97 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -508,9 +508,7 @@ char *hid_resolv_usage(unsigned usage, struct seq_file *f) {
 							max(0,HID_DEBUG_BUFSIZE - len - 1),
 							"%s", p->description);
 					else
-						seq_printf(f,
-							"%s",
-							p->description);
+						seq_puts(f, p->description);
 					return buf;
 				}
 			break;
@@ -533,18 +531,21 @@ void hid_dump_field(struct hid_field *field, int n, struct seq_file *f) {
 
 	if (field->physical) {
 		tab(n, f);
-		seq_printf(f, "Physical(");
-		hid_resolv_usage(field->physical, f); seq_printf(f, ")\n");
+		seq_puts(f, "Physical(");
+		hid_resolv_usage(field->physical, f);
+		seq_puts(f, ")\n");
 	}
 	if (field->logical) {
 		tab(n, f);
-		seq_printf(f, "Logical(");
-		hid_resolv_usage(field->logical, f); seq_printf(f, ")\n");
+		seq_puts(f, "Logical(");
+		hid_resolv_usage(field->logical, f);
+		seq_puts(f, ")\n");
 	}
 	if (field->application) {
 		tab(n, f);
-		seq_printf(f, "Application(");
-		hid_resolv_usage(field->application, f); seq_printf(f, ")\n");
+		seq_puts(f, "Application(");
+		hid_resolv_usage(field->application, f);
+		seq_puts(f, ")\n");
 	}
 	tab(n, f); seq_printf(f, "Usage(%d)\n", field->maxusage);
 	for (j = 0; j < field->maxusage; j++) {
@@ -582,7 +583,8 @@ void hid_dump_field(struct hid_field *field, int n, struct seq_file *f) {
 		data >>= 4;
 
 		if(sys > 4) {
-			tab(n, f); seq_printf(f, "Unit(Invalid)\n");
+			tab(n, f);
+			seq_puts(f, "Unit(Invalid)\n");
 		}
 		else {
 			int earlier_unit = 0;
@@ -595,7 +597,7 @@ void hid_dump_field(struct hid_field *field, int n, struct seq_file *f) {
 				if (nibble != 0) {
 					if(earlier_unit++ > 0)
 						seq_putc(f, '*');
-					seq_printf(f, "%s", units[sys][i]);
+					seq_puts(f, units[sys][i]);
 					if(nibble != 1) {
 						/* This is a _signed_ nibble(!) */
 
@@ -606,7 +608,7 @@ void hid_dump_field(struct hid_field *field, int n, struct seq_file *f) {
 					}
 				}
 			}
-			seq_printf(f, ")\n");
+			seq_puts(f, ")\n");
 		}
 	}
 	tab(n, f); seq_printf(f, "Report Size(%u)\n", field->report_size);
@@ -1036,7 +1038,7 @@ static void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
 				for ( j = 0; j < report->field[i]->maxusage; j++) {
 					usage = report->field[i]->usage + j;
 					hid_resolv_usage(usage->hid, f);
-					seq_printf(f, " ---> ");
+					seq_puts(f, " ---> ");
 					hid_resolv_event(usage->type, usage->code, f);
 					seq_putc(f, '\n');
 				}
@@ -1061,7 +1063,7 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p)
 	/* dump HID report descriptor */
 	for (i = 0; i < rsize; i++)
 		seq_printf(f, "%02x ", rdesc[i]);
-	seq_printf(f, "\n\n");
+	seq_puts(f, "\n\n");
 
 	/* dump parsed data and input mappings */
 	hid_dump_device(hdev, f);
-- 
2.11.1

  parent reply	other threads:[~2017-02-07 19:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 19:36 [PATCH 00/18] HID: Fine-tuning for several function implementations SF Markus Elfring
2017-02-07 19:39 ` [PATCH 01/18] HID: Use kmalloc_array() in hid_input_field() SF Markus Elfring
2017-02-07 19:40 ` [PATCH 02/18] HID: Delete an error message for a failed memory allocation in open_collection() SF Markus Elfring
2017-02-07 19:42 ` [PATCH 03/18] HID: Use kmalloc_array() " SF Markus Elfring
2017-02-07 19:43 ` [PATCH 04/18] HID: Improve another size determination " SF Markus Elfring
2017-02-07 19:46 ` [PATCH 05/18] HID: Improve two size determinations in hid_open_report() SF Markus Elfring
2017-02-07 19:48 ` [PATCH 06/18] HID: Improve another size determination in hid_scan_report() SF Markus Elfring
2017-02-07 19:49 ` [PATCH 07/18] HID: Improve another size determination in hid_register_report() SF Markus Elfring
2017-02-07 19:50 ` [PATCH 08/18] HID: Adjust five checks for null pointers SF Markus Elfring
2017-02-07 19:51 ` [PATCH 09/18] HID: Return an error code only as a constant in hid_allocate_device() SF Markus Elfring
2017-02-07 19:52 ` [PATCH 10/18] HID-debug: Replace five seq_printf() calls by seq_putc() SF Markus Elfring
2017-02-07 19:54 ` [PATCH 11/18] HID-debug: Delete an unnecessary seq_printf() call in hid_dump_device() SF Markus Elfring
2017-02-07 19:55 ` SF Markus Elfring [this message]
2017-02-07 19:56 ` [PATCH 13/18] HID-debug: Combine 11 seq_printf() calls into one call in hid_dump_field() SF Markus Elfring
2017-02-07 22:52   ` Joe Perches
2017-02-07 19:57 ` [PATCH 14/18] HID-debug: Adjust two function calls together with a variable assignment SF Markus Elfring
2017-02-07 19:58 ` [PATCH 15/18] HID-debug: Return an error code only as a constant in hid_debug_events_open() SF Markus Elfring
2017-02-07 19:59 ` [PATCH 16/18] HID-debug: Add some spaces for better code readability SF Markus Elfring
2017-02-07 20:00 ` [PATCH 17/18] HID-debug: Delete an unnecessary variable initialisation in hid_resolv_usage() SF Markus Elfring
2017-02-07 20:01 ` [PATCH 18/18] HID-picoLCD: Use seq_puts() in picolcd_debug_reset_show() SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e7692e4-b857-f708-080c-013ddcdcfe0f@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=benjamin.tissoires@redhat.com \
    --cc=bonbons@linux-vserver.org \
    --cc=jikos@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox