[PATCH 1/2] Revert dts output formatting changes of spaces around brackets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Commit 32b9c6130762 ("Preserve datatype markers when emitting dts format")
add spaces between <> and [] and the encapsulated numbers. Fix this to
keep the prior formatting and not break some users needlessly.

Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts format")
Reported-by: Stewart Smith <stewart@xxxxxxxxxxxxx>
Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
---
This is going to conflict badly with Grant's patch to fix labels.

 tests/type-preservation.dts | 24 ++++++++++++------------
 treesource.c                | 18 ++++++++++--------
 2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/tests/type-preservation.dts b/tests/type-preservation.dts
index 62c0c235087a..06d5778e3265 100644
--- a/tests/type-preservation.dts
+++ b/tests/type-preservation.dts
@@ -1,27 +1,27 @@
 /dts-v1/;
 
 / {
-	#address-cells = < 0x01 >;
-	#size-cells = < 0x00 >;
+	#address-cells = <0x01>;
+	#size-cells = <0x00>;
 
 	sub1: subnode@1 {
 		prop_label: compatible = value_label: "subnode1";
-		reg = < 0x01 >;
-		int-array = < 0x00 0x01 >, int_value_label: < 0x02 0x03 >;
-		int8 = [ 56 ];
-		int8-array = [ 00 12 34 56 label: ];
-		int16 = /bits/ 16 < 0x3210 >;
-		int16-array = /bits/ 16 < 0x1234 0x5678 0x90ab 0xcdef >;
-		int16-matrix = /bits/ 16 < 0x1234 0x5678 >, < 0x90ab 0xcdef >;
-		int64 = /bits/ 64 < 0x200000000 >;
-		int64-array = /bits/ 64 < 0x100000000 0x00 int64_array_label_end: >;
+		reg = <0x01>;
+		int-array = <0x00 0x01>, int_value_label: <0x02 0x03>;
+		int8 = [56];
+		int8-array = [00 12 34 56 label:];
+		int16 = /bits/ 16 <0x3210>;
+		int16-array = /bits/ 16 <0x1234 0x5678 0x90ab 0xcdef>;
+		int16-matrix = /bits/ 16 <0x1234 0x5678>, <0x90ab 0xcdef>;
+		int64 = /bits/ 64 <0x200000000>;
+		int64-array = /bits/ 64 <0x100000000 0x00 int64_array_label_end:>;
 		a-string-with-nulls = "foo\0bar", "baz";
 
 		subsub1: subsubnode {
 			compatible = "subsubnode1", "subsubnode";
 
 			subsubsub1: subsubsubnode {
-				compatible = "subsubsubnode1", < 0x1234 >, valuea: valueb: "subsubsubnode";
+				compatible = "subsubsubnode1", <0x1234>, valuea: valueb: "subsubsubnode";
 			};
 		};
 	};
diff --git a/treesource.c b/treesource.c
index f2874f1d1465..28cd1354f2d3 100644
--- a/treesource.c
+++ b/treesource.c
@@ -118,18 +118,20 @@ static void write_propval_int(FILE *f, const char *p, size_t len, size_t width)
 	for (; p < end; p += width) {
 		switch (width) {
 		case 1:
-			fprintf(f, " %02"PRIx8, *(const uint8_t*)p);
+			fprintf(f, "%02"PRIx8, *(const uint8_t*)p);
 			break;
 		case 2:
-			fprintf(f, " 0x%02"PRIx16, fdt16_to_cpu(*(const fdt16_t*)p));
+			fprintf(f, "0x%02"PRIx16, fdt16_to_cpu(*(const fdt16_t*)p));
 			break;
 		case 4:
-			fprintf(f, " 0x%02"PRIx32, fdt32_to_cpu(*(const fdt32_t*)p));
+			fprintf(f, "0x%02"PRIx32, fdt32_to_cpu(*(const fdt32_t*)p));
 			break;
 		case 8:
-			fprintf(f, " 0x%02"PRIx64, fdt64_to_cpu(*(const fdt64_t*)p));
+			fprintf(f, "0x%02"PRIx64, fdt64_to_cpu(*(const fdt64_t*)p));
 			break;
 		}
+		if (p + width < end)
+			fputc(' ', f);
 	}
 }
 
@@ -162,10 +164,10 @@ static const char *delim_start[] = {
 	[TYPE_STRING] = "",
 };
 static const char *delim_end[] = {
-	[TYPE_UINT8] = " ]",
-	[TYPE_UINT16] = " >",
-	[TYPE_UINT32] = " >",
-	[TYPE_UINT64] = " >",
+	[TYPE_UINT8] = "]",
+	[TYPE_UINT16] = ">",
+	[TYPE_UINT32] = ">",
+	[TYPE_UINT64] = ">",
 	[TYPE_STRING] = "",
 };
 
-- 
2.17.1




[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux