diff options
-rw-r--r-- | arch/sh/kernel/kgdb_stub.c | 8 | ||||
-rw-r--r-- | drivers/pnp/support.c | 8 | ||||
-rw-r--r-- | include/linux/kernel.h | 12 | ||||
-rw-r--r-- | kernel/kgdb.c | 8 | ||||
-rw-r--r-- | lib/hexdump.c | 7 |
5 files changed, 20 insertions, 23 deletions
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c index d453c3a1c79f..832641bbd47d 100644 --- a/arch/sh/kernel/kgdb_stub.c +++ b/arch/sh/kernel/kgdb_stub.c | |||
@@ -330,14 +330,6 @@ static char *ebin_to_mem(const char *buf, char *mem, int count) | |||
330 | return mem; | 330 | return mem; |
331 | } | 331 | } |
332 | 332 | ||
333 | /* Pack a hex byte */ | ||
334 | static char *pack_hex_byte(char *pkt, int byte) | ||
335 | { | ||
336 | *pkt++ = hexchars[(byte >> 4) & 0xf]; | ||
337 | *pkt++ = hexchars[(byte & 0xf)]; | ||
338 | return pkt; | ||
339 | } | ||
340 | |||
341 | /* Scan for the start char '$', read the packet and check the checksum */ | 333 | /* Scan for the start char '$', read the packet and check the checksum */ |
342 | static void get_packet(char *buffer, int buflen) | 334 | static void get_packet(char *buffer, int buflen) |
343 | { | 335 | { |
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c index 3eba85ed729c..95b076c18c07 100644 --- a/drivers/pnp/support.c +++ b/drivers/pnp/support.c | |||
@@ -45,10 +45,10 @@ void pnp_eisa_id_to_string(u32 id, char *str) | |||
45 | str[0] = 'A' + ((id >> 26) & 0x3f) - 1; | 45 | str[0] = 'A' + ((id >> 26) & 0x3f) - 1; |
46 | str[1] = 'A' + ((id >> 21) & 0x1f) - 1; | 46 | str[1] = 'A' + ((id >> 21) & 0x1f) - 1; |
47 | str[2] = 'A' + ((id >> 16) & 0x1f) - 1; | 47 | str[2] = 'A' + ((id >> 16) & 0x1f) - 1; |
48 | str[3] = hex_asc((id >> 12) & 0xf); | 48 | str[3] = hex_asc_hi(id >> 8); |
49 | str[4] = hex_asc((id >> 8) & 0xf); | 49 | str[4] = hex_asc_lo(id >> 8); |
50 | str[5] = hex_asc((id >> 4) & 0xf); | 50 | str[5] = hex_asc_hi(id); |
51 | str[6] = hex_asc((id >> 0) & 0xf); | 51 | str[6] = hex_asc_lo(id); |
52 | str[7] = '\0'; | 52 | str[7] = '\0'; |
53 | } | 53 | } |
54 | 54 | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 4d46e299afb5..792bf0aa779b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -276,7 +276,17 @@ extern void print_hex_dump(const char *level, const char *prefix_str, | |||
276 | const void *buf, size_t len, bool ascii); | 276 | const void *buf, size_t len, bool ascii); |
277 | extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, | 277 | extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, |
278 | const void *buf, size_t len); | 278 | const void *buf, size_t len); |
279 | #define hex_asc(x) "0123456789abcdef"[x] | 279 | |
280 | extern const char hex_asc[]; | ||
281 | #define hex_asc_lo(x) hex_asc[((x) & 0x0f)] | ||
282 | #define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] | ||
283 | |||
284 | static inline char *pack_hex_byte(char *buf, u8 byte) | ||
285 | { | ||
286 | *buf++ = hex_asc_hi(byte); | ||
287 | *buf++ = hex_asc_lo(byte); | ||
288 | return buf; | ||
289 | } | ||
280 | 290 | ||
281 | #define pr_emerg(fmt, arg...) \ | 291 | #define pr_emerg(fmt, arg...) \ |
282 | printk(KERN_EMERG fmt, ##arg) | 292 | printk(KERN_EMERG fmt, ##arg) |
diff --git a/kernel/kgdb.c b/kernel/kgdb.c index 39e31a036f5b..14787de568b3 100644 --- a/kernel/kgdb.c +++ b/kernel/kgdb.c | |||
@@ -346,14 +346,6 @@ static void put_packet(char *buffer) | |||
346 | } | 346 | } |
347 | } | 347 | } |
348 | 348 | ||
349 | static char *pack_hex_byte(char *pkt, u8 byte) | ||
350 | { | ||
351 | *pkt++ = hexchars[byte >> 4]; | ||
352 | *pkt++ = hexchars[byte & 0xf]; | ||
353 | |||
354 | return pkt; | ||
355 | } | ||
356 | |||
357 | /* | 349 | /* |
358 | * Convert the memory pointed to by mem into hex, placing result in buf. | 350 | * Convert the memory pointed to by mem into hex, placing result in buf. |
359 | * Return a pointer to the last char put in buf (null). May return an error. | 351 | * Return a pointer to the last char put in buf (null). May return an error. |
diff --git a/lib/hexdump.c b/lib/hexdump.c index 343546550dc9..f07c0db81d26 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c | |||
@@ -12,6 +12,9 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | 14 | ||
15 | const char hex_asc[] = "0123456789abcdef"; | ||
16 | EXPORT_SYMBOL(hex_asc); | ||
17 | |||
15 | /** | 18 | /** |
16 | * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory | 19 | * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory |
17 | * @buf: data blob to dump | 20 | * @buf: data blob to dump |
@@ -93,8 +96,8 @@ void hex_dump_to_buffer(const void *buf, size_t len, int rowsize, | |||
93 | for (j = 0; (j < rowsize) && (j < len) && (lx + 4) < linebuflen; | 96 | for (j = 0; (j < rowsize) && (j < len) && (lx + 4) < linebuflen; |
94 | j++) { | 97 | j++) { |
95 | ch = ptr[j]; | 98 | ch = ptr[j]; |
96 | linebuf[lx++] = hex_asc(ch >> 4); | 99 | linebuf[lx++] = hex_asc_hi(ch); |
97 | linebuf[lx++] = hex_asc(ch & 0x0f); | 100 | linebuf[lx++] = hex_asc_lo(ch); |
98 | linebuf[lx++] = ' '; | 101 | linebuf[lx++] = ' '; |
99 | } | 102 | } |
100 | ascii_column = 3 * rowsize + 2; | 103 | ascii_column = 3 * rowsize + 2; |