From 9521dc5ecc66c158cd6853cabba2c29f545780f6 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 20 Nov 2007 13:35:46 +1100 Subject: libfdt: Abolish _typed() variants, add _cell() variants In a number of places through libfdt and its tests, we have *_typed() macro variants on functions which use gcc's typeof and statement expression extensions to allow passing literals where the underlying function takes a buffer and size. These seemed like a good idea at the time, but in fact they have some problems. They use typeof and statement expressions, extensions I'd prefer to avoid for portability. Plus, they have potential gotchas - although they'll deal with the size of the thing passed, they won't deal with other representation issues (like endianness) and results could be very strange if the type of the expression passed isn't what you think it is. In fact, the only users of these _typed() macros were when the value passed is a single cell (32-bit integer). Therefore, this patch removes all these _typed() macros and replaces them with explicit _cell() variants which handle a single 32-bit integer, and which also perform endian convesions as appropriate. With this in place, it now becomes easy to use standardized big-endian representation for integer valued properties in the testcases, regardless of the platform we're running on. We therefore do that, which has the additional advantage that all the example trees created during a test run are now byte-for-byte identical regardless of platform. Signed-off-by: David Gibson --- tests/trees.S | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/trees.S') diff --git a/tests/trees.S b/tests/trees.S index 8ecae27..e3c5d47 100644 --- a/tests/trees.S +++ b/tests/trees.S @@ -50,8 +50,7 @@ tree##_rsvmap_end: ; #define PROP_INT(tree, name, val) \ PROPHDR(tree, name, 4) \ - /* For ease of testing the property values go in native-endian */ \ - .long val ; + FDTLONG(val) ; #define PROP_STR(tree, name, str) \ PROPHDR(tree, name, 55f - 54f) \ @@ -100,11 +99,11 @@ test_tree1_struct: END_NODE BEGIN_NODE("subnode@2") - PROP_INT(test_tree1, phandle, cell_to_fdt(PHANDLE_1)) + PROP_INT(test_tree1, phandle, PHANDLE_1) PROP_INT(test_tree1, prop_int, TEST_VALUE_2) BEGIN_NODE("subsubnode@0") - PROP_INT(test_tree1, phandle, cell_to_fdt(PHANDLE_2)) + PROP_INT(test_tree1, phandle, PHANDLE_2) PROP_STR(test_tree1, compatible, "subsubnode2\0subsubnode") PROP_INT(test_tree1, prop_int, TEST_VALUE_2) END_NODE -- cgit v1.1