From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Input: atkbd - simplify atkbd_show_force_release()
Date: Wed, 21 Apr 2021 22:16:39 +0200 [thread overview]
Message-ID: <20210421201639.1541945-1-linux@rasmusvillemoes.dk> (raw)
We can just include the newline in the format string, and scnprintf()
guarantees nul-termination. These days, sysfs_emit() is
preferred in sysfs ->show methods, so switch to that.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/input/keyboard/atkbd.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index edc613efc158..b146a3ec631a 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -1492,13 +1492,8 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
static ssize_t atkbd_show_force_release(struct atkbd *atkbd, char *buf)
{
- size_t len = scnprintf(buf, PAGE_SIZE - 1, "%*pbl",
- ATKBD_KEYMAP_SIZE, atkbd->force_release_mask);
-
- buf[len++] = '\n';
- buf[len] = '\0';
-
- return len;
+ return sysfs_emit(buf, "%*pbl\n",
+ ATKBD_KEYMAP_SIZE, atkbd->force_release_mask);
}
static ssize_t atkbd_set_force_release(struct atkbd *atkbd,
--
2.29.2
next reply other threads:[~2021-04-21 20:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 20:16 Rasmus Villemoes [this message]
2021-04-25 2:27 ` Dmitry Torokhov
2021-04-26 7:06 ` Rasmus Villemoes
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=20210421201639.1541945-1-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=dmitry.torokhov@gmail.com \
--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
all inboxes | Powered by JetHome®