Commit 0a77c4f9 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

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: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent df43daaa
...@@ -526,19 +526,6 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len) ...@@ -526,19 +526,6 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len)
return olen; 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_send - send a control frame
* @gsm: our GSM mux * @gsm: our GSM mux
...@@ -685,10 +672,10 @@ static void gsm_data_kick(struct gsm_mux *gsm) ...@@ -685,10 +672,10 @@ static void gsm_data_kick(struct gsm_mux *gsm)
len = msg->len + 2; len = msg->len + 2;
} }
if (debug & 4) { if (debug & 4)
pr_debug("gsm_data_kick:\n"); print_hex_dump_bytes("gsm_data_kick: ",
hex_packet(gsm->txframe, len); DUMP_PREFIX_OFFSET,
} gsm->txframe, len);
if (gsm->output(gsm, gsm->txframe + skip_sof, if (gsm->output(gsm, gsm->txframe + skip_sof,
len - skip_sof) < 0) len - skip_sof) < 0)
...@@ -2091,10 +2078,9 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len) ...@@ -2091,10 +2078,9 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags); set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags);
return -ENOSPC; return -ENOSPC;
} }
if (debug & 4) { if (debug & 4)
pr_debug("-->%d bytes out\n", len); print_hex_dump_bytes("gsmld_output: ", DUMP_PREFIX_OFFSET,
hex_packet(data, len); data, len);
}
gsm->tty->ops->write(gsm->tty, data, len); gsm->tty->ops->write(gsm->tty, data, len);
return len; return len;
} }
...@@ -2148,10 +2134,9 @@ static unsigned int gsmld_receive_buf(struct tty_struct *tty, ...@@ -2148,10 +2134,9 @@ static unsigned int gsmld_receive_buf(struct tty_struct *tty,
char buf[64]; char buf[64];
char flags; char flags;
if (debug & 4) { if (debug & 4)
pr_debug("Inbytes %dd\n", count); print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET,
hex_packet(cp, count); cp, count);
}
for (i = count, dp = cp, f = fp; i; i--, dp++) { for (i = count, dp = cp, f = fp; i; i--, dp++) {
flags = *f++; flags = *f++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment