From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] print out resource_size_t correctly
Date: Mon, 25 Jun 2012 14:47:19 +0200 [thread overview]
Message-ID: <1340628439-18605-1-git-send-email-s.hauer@pengutronix.de> (raw)
resource_size_t can be 32bit or 64bit depending on the architecture.
Add a define for it to be able to printf a resource_size_t correctly
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
commands/iomem.c | 3 ++-
drivers/base/driver.c | 3 ++-
include/linux/ioport.h | 6 ++++++
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/commands/iomem.c b/commands/iomem.c
index 96b03ba..70355fd 100644
--- a/commands/iomem.c
+++ b/commands/iomem.c
@@ -30,7 +30,8 @@ static void __print_resources(struct resource *res, int indent)
for (i = 0; i < indent; i++)
printf(" ");
- printf("0x%08x - 0x%08x (size 0x%08x) %s\n", res->start,
+ printf(PRINTF_CONVERSION_RESOURCE " - " PRINTF_CONVERSION_RESOURCE
+ " (size " PRINTF_CONVERSION_RESOURCE ") %s\n", res->start,
res->start + res->size - 1,
res->size, res->name);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 547d684..3be4b99 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -388,7 +388,8 @@ static int do_devinfo(int argc, char *argv[])
printf("num : %d\n", i);
if (res->name)
printf("name : %s\n", res->name);
- printf("start : 0x%08x\nsize : 0x%08x\n",
+ printf("start : " PRINTF_CONVERSION_RESOURCE "\nsize : "
+ PRINTF_CONVERSION_RESOURCE "\n",
res->start, res->size);
}
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index c837b53..3f95ddd 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -25,6 +25,12 @@ struct resource {
struct list_head sibling;
};
+#ifdef CONFIG_PHYS_ADDR_T_64BIT
+#define PRINTF_CONVERSION_RESOURCE "0x%016llx"
+#else
+#define PRINTF_CONVERSION_RESOURCE "0x%08x"
+#endif
+
/*
* IO resources have these defined flags.
*/
--
1.7.10
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2012-06-25 12:47 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=1340628439-18605-1-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