aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_gsm.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-04-25 19:46:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-29 17:17:46 -0400
commit0a77c4f9d451a6652f5536548df1b75f4b5b836c (patch)
tree4e13d8289b94fa5c12be2820a0fab78909729e0a /drivers/tty/n_gsm.c
parentdf43daaae926c3710eda911ec048808c904572fe (diff)
n_gsm: Use print_hex_dump_bytes
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> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty/n_gsm.c')
-rw-r--r--drivers/tty/n_gsm.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 6abc73598847..720160acd9dc 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)
526 return olen; 526 return olen;
527} 527}
528 528
529static void hex_packet(const unsigned char *p, int len)
530{
531 int i;
532 for (i = 0; i < len; i++) {
533 if (i && (i % 16) == 0) {
534 pr_cont("\n");
535 pr_debug("");
536 }
537 pr_cont("%02X ", *p++);
538 }
539 pr_cont("\n");
540}
541
542/** 529/**
543 * gsm_send - send a control frame 530 * gsm_send - send a control frame
544 * @gsm: our GSM mux 531 * @gsm: our GSM mux
@@ -685,10 +672,10 @@ static void gsm_data_kick(struct gsm_mux *gsm)
685 len = msg->len + 2; 672 len = msg->len + 2;
686 } 673 }
687 674
688 if (debug & 4) { 675 if (debug & 4)
689 pr_debug("gsm_data_kick:\n"); 676 print_hex_dump_bytes("gsm_data_kick: ",
690 hex_packet(gsm->txframe, len); 677 DUMP_PREFIX_OFFSET,
691 } 678 gsm->txframe, len);
692 679
693 if (gsm->output(gsm, gsm->txframe + skip_sof, 680 if (gsm->output(gsm, gsm->txframe + skip_sof,
694 len - skip_sof) < 0) 681 len - skip_sof) < 0)
@@ -2091,10 +2078,9 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
2091 set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags); 2078 set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags);
2092 return -ENOSPC; 2079 return -ENOSPC;
2093 } 2080 }
2094 if (debug & 4) { 2081 if (debug & 4)
2095 pr_debug("-->%d bytes out\n", len); 2082 print_hex_dump_bytes("gsmld_output: ", DUMP_PREFIX_OFFSET,
2096 hex_packet(data, len); 2083 data, len);
2097 }
2098 gsm->tty->ops->write(gsm->tty, data, len); 2084 gsm->tty->ops->write(gsm->tty, data, len);
2099 return len; 2085 return len;
2100} 2086}
@@ -2148,10 +2134,9 @@ static unsigned int gsmld_receive_buf(struct tty_struct *tty,
2148 char buf[64]; 2134 char buf[64];
2149 char flags; 2135 char flags;
2150 2136
2151 if (debug & 4) { 2137 if (debug & 4)
2152 pr_debug("Inbytes %dd\n", count); 2138 print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET,
2153 hex_packet(cp, count); 2139 cp, count);
2154 }
2155 2140
2156 for (i = count, dp = cp, f = fp; i; i--, dp++) { 2141 for (i = count, dp = cp, f = fp; i; i--, dp++) {
2157 flags = *f++; 2142 flags = *f++;