From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 01/10] memory_display: Use consistent types
Date: Thu, 28 May 2015 12:34:35 +0200 [thread overview]
Message-ID: <1432809284-17362-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1432809284-17362-1-git-send-email-s.hauer@pengutronix.de>
memory_display uses three different types for 32bit variables, three
types for 16bit variables and three types for 8bit variables. Clean up
this mess and use one type per variable width.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/memory_display.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/common/memory_display.c b/common/memory_display.c
index 7b1d35e..1ad0f05 100644
--- a/common/memory_display.c
+++ b/common/memory_display.c
@@ -6,8 +6,8 @@
int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int swab)
{
- ulong linebytes, i;
- u_char *cp;
+ unsigned long linebytes, i;
+ unsigned char *cp;
/* Print the lines.
*
@@ -15,10 +15,10 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
* once, and all accesses are with the specified bus width.
*/
do {
- char linebuf[DISP_LINE_LEN];
- uint32_t *uip = (uint *)linebuf;
- uint16_t *usp = (ushort *)linebuf;
- uint8_t *ucp = (u_char *)linebuf;
+ unsigned char linebuf[DISP_LINE_LEN];
+ uint32_t *uip = (uint32_t *)linebuf;
+ uint16_t *usp = (uint16_t *)linebuf;
+ uint8_t *ucp = (uint8_t *)linebuf;
unsigned count = 52;
printf("%08llx:", offs);
@@ -26,9 +26,9 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
for (i = 0; i < linebytes; i += size) {
if (size == 4) {
- u32 res;
+ uint32_t res;
data_abort_mask();
- res = *((uint *)addr);
+ res = *((uint32_t *)addr);
if (swab)
res = __swab32(res);
if (data_abort_unmask()) {
@@ -39,9 +39,9 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
}
*uip++ = res;
} else if (size == 2) {
- u16 res;
+ uint16_t res;
data_abort_mask();
- res = *((ushort *)addr);
+ res = *((uint16_t *)addr);
if (swab)
res = __swab16(res);
if (data_abort_unmask()) {
@@ -52,9 +52,9 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
}
*usp++ = res;
} else {
- u8 res;
+ uint8_t res;
data_abort_mask();
- res = *((u_char *)addr);
+ res = *((uint8_t *)addr);
if (data_abort_unmask()) {
res = 0xff;
count -= printf(" xx");
@@ -70,7 +70,7 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
while (count--)
putchar(' ');
- cp = (uint8_t *)linebuf;
+ cp = linebuf;
for (i = 0; i < linebytes; i++) {
if ((*cp < 0x20) || (*cp > 0x7e))
putchar('.');
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-05-28 10:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 10:34 Add 64bit support to mem commands Sascha Hauer
2015-05-28 10:34 ` Sascha Hauer [this message]
2015-05-28 10:34 ` [PATCH 02/10] memory_display: Add 64bit support Sascha Hauer
2015-05-28 10:34 ` [PATCH 03/10] fs: Add O_RWSIZE_8 Sascha Hauer
2015-05-28 10:34 ` [PATCH 04/10] mem commands: suppport parsing 'q' option Sascha Hauer
2015-05-28 10:34 ` [PATCH 05/10] md command: Add 64bit support Sascha Hauer
2015-05-28 10:34 ` [PATCH 06/10] memcmp " Sascha Hauer
2015-05-28 10:34 ` [PATCH 07/10] memcpy " Sascha Hauer
2015-05-28 10:34 ` [PATCH 08/10] memset " Sascha Hauer
2015-05-28 10:34 ` [PATCH 09/10] mm " Sascha Hauer
2015-05-28 10:34 ` [PATCH 10/10] mw " Sascha Hauer
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=1432809284-17362-2-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox