devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dtc: fdtdump, properly handle multi-string properties
@ 2013-01-03 22:32 Pantelis Antoniou
  2013-01-03 23:34 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Pantelis Antoniou @ 2013-01-03 22:32 UTC (permalink / raw)
  To: Grant Likely
  Cc: Matt Porter, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	Pantelis Antoniou, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Rob Herring, Russ Dill

Device tree can store multiple strings in a single property.
We didn't handle that case properly.

Signed-off-by: Pantelis Antoniou <panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
---
 scripts/dtc/fdtdump.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/dtc/fdtdump.c b/scripts/dtc/fdtdump.c
index 207a46d..d4fa6d7 100644
--- a/scripts/dtc/fdtdump.c
+++ b/scripts/dtc/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] 2+ messages in thread

* Re: [PATCH] dtc: fdtdump, properly handle multi-string properties
  2013-01-03 22:32 [PATCH] dtc: fdtdump, properly handle multi-string properties Pantelis Antoniou
@ 2013-01-03 23:34 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2013-01-03 23:34 UTC (permalink / raw)
  To: Pantelis Antoniou
  Cc: Grant Likely, devicetree-discuss, linux-kernel, Matt Porter,
	Russ Dill, Jon Loeliger

On 01/03/2013 04:32 PM, 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>
> ---
>  scripts/dtc/fdtdump.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

These need to be posted against the upstream dtc sources and to the dtc
maintainer Jon Loeliger.

Rob

> 
> diff --git a/scripts/dtc/fdtdump.c b/scripts/dtc/fdtdump.c
> index 207a46d..d4fa6d7 100644
> --- a/scripts/dtc/fdtdump.c
> +++ b/scripts/dtc/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)
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-03 23:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03 22:32 [PATCH] dtc: fdtdump, properly handle multi-string properties Pantelis Antoniou
2013-01-03 23:34 ` Rob Herring

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).