* fdtdump: properly handle multi-string properties
@ 2013-01-04 19:12 Pantelis Antoniou
2013-01-04 23:38 ` David Gibson
[not found] ` <1357326766-12691-1-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
0 siblings, 2 replies; 3+ messages in thread
From: Pantelis Antoniou @ 2013-01-04 19:12 UTC (permalink / raw)
To: Jon Loeliger
Cc: Grant Likely, Rob Herring, devicetree-discuss, linux-kernel,
Matt Porter, Russ Dill, Pantelis Antoniou
Device tree can store multiple strings in a single property.
We didn't handle that case properly.
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
fdtdump.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/fdtdump.c b/fdtdump.c
index 207a46d..d4fa6d7 100644
--- a/fdtdump.c
+++ b/fdtdump.c
@@ -21,13 +21,23 @@ static void print_data(const char *data, int len)
{
int i;
const char *p = data;
+ const char *s;
/* no data, don't print */
if (len == 0)
return;
if (util_is_printable_string(data, len)) {
- printf(" = \"%s\"", (const char *)data);
+ printf(" = ");
+
+ s = data;
+ do {
+ printf("\"%s\"", s);
+ s += strlen(s) + 1;
+ if (s < data + len)
+ printf(", ");
+ } while (s < data + len);
+
} else if ((len % 4) == 0) {
printf(" = <");
for (i = 0; i < len; i += 4)
--
1.7.12
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: fdtdump: properly handle multi-string properties
2013-01-04 19:12 fdtdump: properly handle multi-string properties Pantelis Antoniou
@ 2013-01-04 23:38 ` David Gibson
[not found] ` <1357326766-12691-1-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2013-01-04 23:38 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Jon Loeliger, Matt Porter, devicetree-discuss, linux-kernel,
Rob Herring, Russ Dill
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
On Fri, Jan 04, 2013 at 09:12:46PM +0200, Pantelis Antoniou wrote:
> Device tree can store multiple strings in a single property.
> We didn't handle that case properly.
>
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <1357326766-12691-1-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>]
end of thread, other threads:[~2013-01-06 21:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-04 19:12 fdtdump: properly handle multi-string properties Pantelis Antoniou
2013-01-04 23:38 ` David Gibson
[not found] ` <1357326766-12691-1-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-01-06 21:35 ` Jon Loeliger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).