From: Joe Perches <joe@perches.com>
To: Randy Dunlap <randy.dunlap@oracle.com>,
Greg Kroah-Hartman <gregkh@suse.de>
Cc: Jiri Kosina <trivial@kernel.org>, linux-kernel@vger.kernel.org
Subject: [PATCH] n_gsm: Use print_hex_dump_bytes
Date: Mon, 25 Apr 2011 16:46:49 -0700 [thread overview]
Message-ID: <1303775210.23494.6.camel@Joe-Laptop> (raw)
In-Reply-To: <20110425082230.6d656ed0.randy.dunlap@oracle.com>
Use the standard mechanism to print a hex buffer
to eliminate empty printf warning.
A couple % smaller text and data too.
$ size drivers/tty/n_gsm.o*
text data bss dec hex filename
23543 312 6376 30231 7617 drivers/tty/n_gsm.o.new
24051 408 6496 30955 78eb drivers/tty/n_gsm.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/tty/n_gsm.c | 35 ++++++++++-------------------------
1 files changed, 10 insertions(+), 25 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 74273e6..b0fcffc 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -526,19 +526,6 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len)
return olen;
}
-static void hex_packet(const unsigned char *p, int len)
-{
- int i;
- for (i = 0; i < len; i++) {
- if (i && (i % 16) == 0) {
- pr_cont("\n");
- pr_debug("");
- }
- pr_cont("%02X ", *p++);
- }
- pr_cont("\n");
-}
-
/**
* gsm_send - send a control frame
* @gsm: our GSM mux
@@ -685,10 +672,10 @@ static void gsm_data_kick(struct gsm_mux *gsm)
len = msg->len + 2;
}
- if (debug & 4) {
- pr_debug("gsm_data_kick:\n");
- hex_packet(gsm->txframe, len);
- }
+ if (debug & 4)
+ print_hex_dump_bytes("gsm_data_kick: ",
+ DUMP_PREFIX_OFFSET,
+ gsm->txframe, len);
if (gsm->output(gsm, gsm->txframe + skip_sof,
len - skip_sof) < 0)
@@ -2095,10 +2082,9 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags);
return -ENOSPC;
}
- if (debug & 4) {
- pr_debug("-->%d bytes out\n", len);
- hex_packet(data, len);
- }
+ if (debug & 4)
+ print_hex_dump_bytes("gsmld_output: ", DUMP_PREFIX_OFFSET,
+ data, len);
gsm->tty->ops->write(gsm->tty, data, len);
return len;
}
@@ -2152,10 +2138,9 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
char buf[64];
char flags;
- if (debug & 4) {
- pr_debug("Inbytes %dd\n", count);
- hex_packet(cp, count);
- }
+ if (debug & 4)
+ print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET,
+ cp, count);
for (i = count, dp = cp, f = fp; i; i--, dp++) {
flags = *f++;
--
1.7.5.rc3.dirty
next prev parent reply other threads:[~2011-04-25 23:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-24 3:38 [TRIVIAL PATCH] treewide: Cleanup continuations and remove logging message whitespace Joe Perches
2011-04-25 15:22 ` Randy Dunlap
2011-04-25 23:46 ` Joe Perches [this message]
2011-04-26 1:15 ` [PATCH] n_gsm: Use print_hex_dump_bytes Randy Dunlap
2011-04-26 2:48 ` [TRIVIAL PATCH] treewide: Cleanup continuations and remove logging message whitespace Harry Wei
2011-04-26 16:34 ` Randy Dunlap
2011-04-27 1:37 ` Harry Wei
2011-04-26 8:25 ` Jiri Kosina
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=1303775210.23494.6.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
--cc=trivial@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
Powered by JetHome