From: Harvey Harrison <harvey.harrison@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 08/12] sh: kgdb-stub.c, sh-sci.c use the common ascii hex helpers
Date: Fri, 02 May 2008 12:01:54 -0700 [thread overview]
Message-ID: <1209754914.26173.33.camel@brick> (raw)
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
arch/sh/kernel/kgdb_stub.c | 16 ++++++++--------
drivers/serial/sh-sci.c | 8 ++++----
include/asm-sh/kgdb.h | 14 --------------
3 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
index d453c3a..98cdb2b 100644
--- a/arch/sh/kernel/kgdb_stub.c
+++ b/arch/sh/kernel/kgdb_stub.c
@@ -274,8 +274,8 @@ static char *mem_to_hex(const char *mem, char *buf, const int count)
}
for (i = 0; i < count; i++) {
ch = *mem++;
- *buf++ = highhex(ch);
- *buf++ = lowhex(ch);
+ *buf++ = hex_asc_hi(ch);
+ *buf++ = hex_asc_lo(ch);
}
*buf = 0;
return (buf);
@@ -333,8 +333,8 @@ static char *ebin_to_mem(const char *buf, char *mem, int count)
/* Pack a hex byte */
static char *pack_hex_byte(char *pkt, int byte)
{
- *pkt++ = hexchars[(byte >> 4) & 0xf];
- *pkt++ = hexchars[(byte & 0xf)];
+ *pkt++ = hex_asc_hi(byte);
+ *pkt++ = hex_asc_lo(byte);
return pkt;
}
@@ -435,8 +435,8 @@ static void put_packet(char *buffer)
/* '#' Separator, put high and low components of checksum */
put_debug_char('#');
- put_debug_char(highhex(checksum));
- put_debug_char(lowhex(checksum));
+ put_debug_char(hex_asc_hi(checksum));
+ put_debug_char(hex_asc_lo(checksum));
}
while ((get_debug_char()) != '+'); /* While no ack */
}
@@ -658,8 +658,8 @@ static void undo_single_step(void)
static void send_signal_msg(const int signum)
{
out_buffer[0] = 'S';
- out_buffer[1] = highhex(signum);
- out_buffer[2] = lowhex(signum);
+ out_buffer[1] = hex_asc_hi(signum);
+ out_buffer[2] = hex_asc_lo(signum);
out_buffer[3] = 0;
put_packet(out_buffer);
}
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 9691061..6c1d3fc 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -186,15 +186,15 @@ static void put_string(struct sci_port *sci_port, const char *buffer, int count)
int h, l;
c = *p++;
- h = highhex(c);
- l = lowhex(c);
+ h = hex_asc_hi(c);
+ l = hex_asc_lo(c);
put_char(port, h);
put_char(port, l);
checksum += h + l;
}
put_char(port, '#');
- put_char(port, highhex(checksum));
- put_char(port, lowhex(checksum));
+ put_char(port, hex_asc_hi(checksum));
+ put_char(port, hex_asc_lo(checksum));
} while (get_char(port) != '+');
} else
#endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 4bc8cb1..24e4207 100644
--- a/include/asm-sh/kgdb.h
+++ b/include/asm-sh/kgdb.h
@@ -66,18 +66,4 @@ extern int setjmp(jmp_buf __jmpb);
/* Forced breakpoint */
#define breakpoint() __asm__ __volatile__("trapa #0x3c")
-/* Taken from sh-stub.c of GDB 4.18 */
-static const char hexchars[] = "0123456789abcdef";
-
-/* Get high hex bits */
-static inline char highhex(const int x)
-{
- return hexchars[(x >> 4) & 0xf];
-}
-
-/* Get low hex bits */
-static inline char lowhex(const int x)
-{
- return hexchars[x & 0xf];
-}
#endif
--
1.5.5.1.350.gbbbf
reply other threads:[~2008-05-02 19:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1209754914.26173.33.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.