diff options
author | Andy Shevchenko <ext-andriy.shevchenko@nokia.com> | 2010-08-05 10:22:19 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-08-05 10:22:19 -0400 |
commit | a9fa20a7af1f152d2d89c44c274a310ac654e3ad (patch) | |
tree | bc6f6ef6c3081a7ae4bbc27b21d146e2b82a8279 /kernel/debug | |
parent | 9fe6206f400646a2322096b56c59891d530e8d51 (diff) |
kgdb: remove custom hex_to_bin()implementation
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'kernel/debug')
-rw-r--r-- | kernel/debug/gdbstub.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c index e8fd6868682d..3517fd719635 100644 --- a/kernel/debug/gdbstub.c +++ b/kernel/debug/gdbstub.c | |||
@@ -52,17 +52,6 @@ static unsigned long gdb_regs[(NUMREGBYTES + | |||
52 | * GDB remote protocol parser: | 52 | * GDB remote protocol parser: |
53 | */ | 53 | */ |
54 | 54 | ||
55 | static int hex(char ch) | ||
56 | { | ||
57 | if ((ch >= 'a') && (ch <= 'f')) | ||
58 | return ch - 'a' + 10; | ||
59 | if ((ch >= '0') && (ch <= '9')) | ||
60 | return ch - '0'; | ||
61 | if ((ch >= 'A') && (ch <= 'F')) | ||
62 | return ch - 'A' + 10; | ||
63 | return -1; | ||
64 | } | ||
65 | |||
66 | #ifdef CONFIG_KGDB_KDB | 55 | #ifdef CONFIG_KGDB_KDB |
67 | static int gdbstub_read_wait(void) | 56 | static int gdbstub_read_wait(void) |
68 | { | 57 | { |
@@ -123,8 +112,8 @@ static void get_packet(char *buffer) | |||
123 | buffer[count] = 0; | 112 | buffer[count] = 0; |
124 | 113 | ||
125 | if (ch == '#') { | 114 | if (ch == '#') { |
126 | xmitcsum = hex(gdbstub_read_wait()) << 4; | 115 | xmitcsum = hex_to_bin(gdbstub_read_wait()) << 4; |
127 | xmitcsum += hex(gdbstub_read_wait()); | 116 | xmitcsum += hex_to_bin(gdbstub_read_wait()); |
128 | 117 | ||
129 | if (checksum != xmitcsum) | 118 | if (checksum != xmitcsum) |
130 | /* failed checksum */ | 119 | /* failed checksum */ |
@@ -280,8 +269,8 @@ int kgdb_hex2mem(char *buf, char *mem, int count) | |||
280 | tmp_hex = tmp_raw - 1; | 269 | tmp_hex = tmp_raw - 1; |
281 | while (tmp_hex >= buf) { | 270 | while (tmp_hex >= buf) { |
282 | tmp_raw--; | 271 | tmp_raw--; |
283 | *tmp_raw = hex(*tmp_hex--); | 272 | *tmp_raw = hex_to_bin(*tmp_hex--); |
284 | *tmp_raw |= hex(*tmp_hex--) << 4; | 273 | *tmp_raw |= hex_to_bin(*tmp_hex--) << 4; |
285 | } | 274 | } |
286 | 275 | ||
287 | return probe_kernel_write(mem, tmp_raw, count); | 276 | return probe_kernel_write(mem, tmp_raw, count); |
@@ -304,7 +293,7 @@ int kgdb_hex2long(char **ptr, unsigned long *long_val) | |||
304 | (*ptr)++; | 293 | (*ptr)++; |
305 | } | 294 | } |
306 | while (**ptr) { | 295 | while (**ptr) { |
307 | hex_val = hex(**ptr); | 296 | hex_val = hex_to_bin(**ptr); |
308 | if (hex_val < 0) | 297 | if (hex_val < 0) |
309 | break; | 298 | break; |
310 | 299 | ||