Re: [PATCH] kgdb: remove custom hex_to_bin() implementation

From: Dongdong Deng
Date: Sun Jun 27 2010 - 22:22:54 EST


It is ok to me. :-)

Best Regards,
Dongdong

On Thu, Jun 17, 2010 at 5:33 PM, Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> From: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx>
>
> Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx>
> Cc: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>
> Cc: Martin Hicks <mort@xxxxxxx>
> Cc: kgdb-bugreport@xxxxxxxxxxxxxxxxxxxxx
> ---
> Â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 4b17b32..d721b1b 100644
> --- a/kernel/debug/gdbstub.c
> +++ b/kernel/debug/gdbstub.c
> @@ -52,17 +52,6 @@ static unsigned long     gdb_regs[(NUMREGBYTES +
> Â* GDB remote protocol parser:
> Â*/
>
> -static int hex(char ch)
> -{
> - Â Â Â if ((ch >= 'a') && (ch <= 'f'))
> - Â Â Â Â Â Â Â return ch - 'a' + 10;
> - Â Â Â if ((ch >= '0') && (ch <= '9'))
> - Â Â Â Â Â Â Â return ch - '0';
> - Â Â Â if ((ch >= 'A') && (ch <= 'F'))
> - Â Â Â Â Â Â Â return ch - 'A' + 10;
> - Â Â Â return -1;
> -}
> -
> Â#ifdef CONFIG_KGDB_KDB
> Âstatic int gdbstub_read_wait(void)
> Â{
> @@ -123,8 +112,8 @@ static void get_packet(char *buffer)
> Â Â Â Â Â Â Â Âbuffer[count] = 0;
>
> Â Â Â Â Â Â Â Âif (ch == '#') {
> - Â Â Â Â Â Â Â Â Â Â Â xmitcsum = hex(gdbstub_read_wait()) << 4;
> - Â Â Â Â Â Â Â Â Â Â Â xmitcsum += hex(gdbstub_read_wait());
> + Â Â Â Â Â Â Â Â Â Â Â xmitcsum = hex_to_bin(gdbstub_read_wait()) << 4;
> + Â Â Â Â Â Â Â Â Â Â Â xmitcsum += hex_to_bin(gdbstub_read_wait());
>
> Â Â Â Â Â Â Â Â Â Â Â Âif (checksum != xmitcsum)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â/* failed checksum */
> @@ -280,8 +269,8 @@ int kgdb_hex2mem(char *buf, char *mem, int count)
> Â Â Â Âtmp_hex = tmp_raw - 1;
> Â Â Â Âwhile (tmp_hex >= buf) {
> Â Â Â Â Â Â Â Âtmp_raw--;
> - Â Â Â Â Â Â Â *tmp_raw = hex(*tmp_hex--);
> - Â Â Â Â Â Â Â *tmp_raw |= hex(*tmp_hex--) << 4;
> + Â Â Â Â Â Â Â *tmp_raw = hex_to_bin(*tmp_hex--);
> + Â Â Â Â Â Â Â *tmp_raw |= hex_to_bin(*tmp_hex--) << 4;
> Â Â Â Â}
>
> Â Â Â Âreturn probe_kernel_write(mem, tmp_raw, count);
> @@ -304,7 +293,7 @@ int kgdb_hex2long(char **ptr, unsigned long *long_val)
> Â Â Â Â Â Â Â Â(*ptr)++;
> Â Â Â Â}
> Â Â Â Âwhile (**ptr) {
> - Â Â Â Â Â Â Â hex_val = hex(**ptr);
> + Â Â Â Â Â Â Â hex_val = hex_to_bin(**ptr);
> Â Â Â Â Â Â Â Âif (hex_val < 0)
> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
>
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
> Please read the FAQ at Âhttp://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/