From: Joe Perches <joe@perches.com>
To: Emil Goode <emilgoode@gmail.com>
Cc: Randy Dunlap <rdunlap@infradead.org>,
Stepan Moskovchenko <stepanm@codeaurora.org>,
balbi@ti.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
Date: Sat, 01 Jun 2013 23:22:18 +0000 [thread overview]
Message-ID: <1370128938.2098.14.camel@joe-AO722> (raw)
In-Reply-To: <CA+0zTV-LtE0zZRBtOdqRm0bbT10XkGURvmddR6unWU0O0XutWQ@mail.gmail.com>
On Sun, 2013-06-02 at 01:06 +0200, Emil Goode wrote:
> Maybe there should be another format specifier %da and Randy's
> clarifying comment
maybe %pad but I think the whole thing isn't much necessary.
It seems there are a grand total of 3 uses of %pa today.
Maybe:
---
Documentation/printk-formats.txt | 7 +++++++
lib/vsprintf.c | 19 +++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 3af5ae6..fa48403 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -63,6 +63,13 @@ Physical addresses:
resource_size_t) which can vary based on build options, regardless of
the width of the CPU data path. Passed by reference.
+dma_addr_t addresses:
+
+ %pad 0x01234567 or 0x0123456789abcdef
+
+ For printing a dma_addr_t type which can vary based on build options,
+ regardless of the width of the CPU data path. Passed by reference.
+
Raw buffer as a hex string:
%*ph 00 01 02 ... 3f
%*phC 00:01:02: ... :3f
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 7d84676..b6b8390 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1039,6 +1039,7 @@ int kptr_restrict __read_mostly;
* The maximum supported length is 64 bytes of the input. Consider
* to use print_hex_dump() for the larger input.
* - 'a' For a phys_addr_t type and its derivative types (passed by reference)
+ * - 'ad' For a dma_addr_t type
*
* Note: The difference between 'S' and 'F' is that on ia64 and ppc64
* function pointers are really function descriptors, which contain a
@@ -1129,12 +1130,22 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
return netdev_feature_string(buf, end, ptr, spec);
}
break;
- case 'a':
+ case 'a': {
+ unsigned long long val;
spec.flags |= SPECIAL | SMALL | ZEROPAD;
- spec.field_width = sizeof(phys_addr_t) * 2 + 2;
spec.base = 16;
- return number(buf, end,
- (unsigned long long) *((phys_addr_t *)ptr), spec);
+ switch (fmt[1]) {
+ case 'd':
+ spec.field_width = sizeof(dma_addr_t) * 2 + 2;
+ val = (unsigned long long)*((dma_addr_t *)ptr);
+ break;
+ default:
+ spec.field_width = sizeof(phys_addr_t) * 2 + 2;
+ val = (unsigned long long)*((phys_addr_t *)ptr);
+ break;
+ }
+ return number(buf, end, val, spec);
+ }
}
spec.flags |= SMALL;
if (spec.field_width = -1) {
next prev parent reply other threads:[~2013-06-01 23:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-01 18:02 [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t Emil Goode
2013-06-01 18:29 ` Joe Perches
2013-06-01 19:09 ` Emil Goode
2013-06-01 20:31 ` Joe Perches
2013-06-01 21:56 ` Randy Dunlap
2013-06-01 22:16 ` Joe Perches
2013-06-01 23:06 ` Emil Goode
2013-06-01 23:22 ` Joe Perches [this message]
2013-06-02 13:32 ` Emil Goode
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=1370128938.2098.14.camel@joe-AO722 \
--to=joe@perches.com \
--cc=balbi@ti.com \
--cc=emilgoode@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=stepanm@codeaurora.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