diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-03-27 05:54:14 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-27 12:48:33 -0400 |
commit | 167bfa71844a7a7415da0fa8c75e672f3bd438c8 (patch) | |
tree | 20d492fd7588c78f3f870336bb7f8c7c9905554a /drivers/net/ppp/ppp_synctty.c | |
parent | 5a048e3b59fb4211b7978f78217878071c344379 (diff) | |
download | linux-stable-167bfa71844a7a7415da0fa8c75e672f3bd438c8.tar.gz linux-stable-167bfa71844a7a7415da0fa8c75e672f3bd438c8.tar.bz2 linux-stable-167bfa71844a7a7415da0fa8c75e672f3bd438c8.zip |
ppp: reuse print_hex_dump_bytes
There is a native function to dump hex buffers.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ppp/ppp_synctty.c')
-rw-r--r-- | drivers/net/ppp/ppp_synctty.c | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c index 1a12033d2efa..090c834d7dbd 100644 --- a/drivers/net/ppp/ppp_synctty.c +++ b/drivers/net/ppp/ppp_synctty.c @@ -105,64 +105,15 @@ static const struct ppp_channel_ops sync_ops = { }; /* - * Utility procedures to print a buffer in hex/ascii + * Utility procedure to print a buffer in hex/ascii */ static void -ppp_print_hex (register __u8 * out, const __u8 * in, int count) -{ - register __u8 next_ch; - static const char hex[] = "0123456789ABCDEF"; - - while (count-- > 0) { - next_ch = *in++; - *out++ = hex[(next_ch >> 4) & 0x0F]; - *out++ = hex[next_ch & 0x0F]; - ++out; - } -} - -static void -ppp_print_char (register __u8 * out, const __u8 * in, int count) -{ - register __u8 next_ch; - - while (count-- > 0) { - next_ch = *in++; - - if (next_ch < 0x20 || next_ch > 0x7e) - *out++ = '.'; - else { - *out++ = next_ch; - if (next_ch == '%') /* printk/syslogd has a bug !! */ - *out++ = '%'; - } - } - *out = '\0'; -} - -static void ppp_print_buffer (const char *name, const __u8 *buf, int count) { - __u8 line[44]; - if (name != NULL) printk(KERN_DEBUG "ppp_synctty: %s, count = %d\n", name, count); - while (count > 8) { - memset (line, 32, 44); - ppp_print_hex (line, buf, 8); - ppp_print_char (&line[8 * 3], buf, 8); - printk(KERN_DEBUG "%s\n", line); - count -= 8; - buf += 8; - } - - if (count > 0) { - memset (line, 32, 44); - ppp_print_hex (line, buf, count); - ppp_print_char (&line[8 * 3], buf, count); - printk(KERN_DEBUG "%s\n", line); - } + print_hex_dump_bytes("", DUMP_PREFIX_NONE, buf, count); } |