Thread (11 messages) 11 messages, 1 author, 2012-06-28
STALE5101d

[PATCH 05/11] qca-swiss-army-knife: add a macro for de-duplicating initval tables

From: Felix Fietkau <hidden>
Date: 2012-06-28 00:26:42
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Felix Fietkau <redacted>
---
 tools/initvals/initvals.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/tools/initvals/initvals.c b/tools/initvals/initvals.c
index 437dfc5..b655a4c 100644
--- a/tools/initvals/initvals.c
+++ b/tools/initvals/initvals.c
@@ -296,6 +296,22 @@ typedef long long unsigned int u64;
 
 #endif /* ATHEROS */
 
+#define INI_PRINT_DUP(_array, _ref) do { \
+	if (check) { \
+		char *sha1sum; \
+		sha1sum = ath9k_hw_check_initval((const u32 *) &_array,\
+						ARRAY_SIZE(_array), ARRAY_SIZE((_array)[0])); \
+		printf("%s        "#_array"\n", sha1sum); \
+	} else { \
+		if (sizeof(_ref) == sizeof(_array) && !memcmp(&_ref, &_array, sizeof(_ref))) { \
+			printf("#define " #_array " " #_ref "\n\n"); \
+			break; \
+		} \
+		ath9k_hw_print_initval(#_array, (const u32 *) _array, \
+				       ARRAY_SIZE(_array), ARRAY_SIZE((_array)[0]), false); \
+	} \
+    } while (0)
+
 #define INI_PRINT(_array) do { \
 	if (check) { \
 		char *sha1sum; \
-- 
1.7.3.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help