From: Christopher Heiny <cheiny@synaptics.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Linux Input <linux-input@vger.kernel.org>,
Christopher Heiny <cheiny@synaptics.com>,
Andrew Duggan <aduggan@synaptics.com>,
Vincent Huang <vincent.huang@tw.synaptics.com>,
Vivian Ly <vly@synaptics.com>,
Daniel Rosenberg <daniel.rosenberg@synaptics.com>,
Jean Delvare <khali@linux-fr.org>,
Joerie de Gram <j.de.gram@gmail.com>,
Linus Walleij <linus.walleij@stericsson.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Subject: [PATCH v2] input: synaptics-rmi4 - use snprintf instead of sprintf in rmi_i2c.c
Date: Wed, 8 Jan 2014 17:18:39 -0800 [thread overview]
Message-ID: <1389230319-4737-1-git-send-email-cheiny@synaptics.com> (raw)
This is a trivial change to replace the sprintf loop with snprintf using
up-to-date format capability.
Signed-off-by: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/input/rmi4/rmi_i2c.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index d94114b..8a93dad 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -138,9 +138,6 @@ static int rmi_set_page(struct rmi_transport_dev *xport, u8 page)
static int copy_to_debug_buf(struct device *dev, struct rmi_i2c_data *data,
const u8 *buf, const int len) {
- int i;
- int n = 0;
- char *temp;
int dbg_size = 3 * len + 1;
if (!data->debug_buf || data->debug_buf_size < dbg_size) {
@@ -154,12 +151,8 @@ static int copy_to_debug_buf(struct device *dev, struct rmi_i2c_data *data,
return -ENOMEM;
}
}
- temp = data->debug_buf;
- for (i = 0; i < len; i++) {
- n = sprintf(temp, " %02x", buf[i]);
- temp += n;
- }
+ snprintf(data->debug_buf, data->debug_buf_size, "%*ph", len, buf);
return 0;
}
next reply other threads:[~2014-01-09 1:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 1:18 Christopher Heiny [this message]
2014-01-09 8:04 ` [PATCH v2] input: synaptics-rmi4 - use snprintf instead of sprintf in rmi_i2c.c Dmitry Torokhov
2014-01-09 8:28 ` Dmitry Torokhov
2014-01-09 20:29 ` Christopher Heiny
2014-01-09 20:48 ` Dmitry Torokhov
2014-01-09 21:02 ` Christopher Heiny
2014-01-09 21:23 ` Christopher Heiny
2014-01-09 21:29 ` Dmitry Torokhov
2014-01-09 21:38 ` Christopher Heiny
2014-01-09 22:11 ` Christopher Heiny
2014-01-09 22:25 ` Dmitry Torokhov
2014-01-09 22:47 ` Christopher Heiny
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=1389230319-4737-1-git-send-email-cheiny@synaptics.com \
--to=cheiny@synaptics.com \
--cc=aduggan@synaptics.com \
--cc=benjamin.tissoires@redhat.com \
--cc=daniel.rosenberg@synaptics.com \
--cc=dmitry.torokhov@gmail.com \
--cc=j.de.gram@gmail.com \
--cc=khali@linux-fr.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-input@vger.kernel.org \
--cc=vincent.huang@tw.synaptics.com \
--cc=vly@synaptics.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.