[PATCH] linker_lists: Update the alignment using CONFIG_LINKER_LIST_ALIGN

1425075683 at qq.com 1425075683 at qq.com
Tue Jan 14 08:09:41 CET 2025


From: Liya Huang <1425075683 at qq.com>

This patch updates the alignment of linker lists to use the
CONFIG_LINKER_LIST_ALIGN macro instead of a hardcoded value.
This ensures that the alignment is consistent with the configuration.
Replace __attribute__((unused)) with __maybe_unused and
__always_unused to eliminate the warning of checkpatch.pl.

Reviewed-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Liya Huang <1425075683 at qq.com>
---

 include/linker_lists.h | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index f9a2ee0c76..e8791430d7 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -68,8 +68,9 @@
  *   };
  */
 #define ll_entry_declare(_type, _name, _list)				\
-	_type _u_boot_list_2_##_list##_2_##_name __aligned(4)		\
-			__attribute__((unused))				\
+	_type _u_boot_list_2_##_list##_2_##_name		\
+			__aligned(CONFIG_LINKER_LIST_ALIGN)		\
+			__maybe_unused							\
 			__section("__u_boot_list_2_"#_list"_2_"#_name)
 
 /**
@@ -91,8 +92,9 @@
  *   };
  */
 #define ll_entry_declare_list(_type, _name, _list)			\
-	_type _u_boot_list_2_##_list##_2_##_name[] __aligned(4)		\
-			__attribute__((unused))				\
+	_type _u_boot_list_2_##_list##_2_##_name[]		\
+			__aligned(CONFIG_LINKER_LIST_ALIGN)		\
+			__maybe_unused							\
 			__section("__u_boot_list_2_"#_list"_2_"#_name)
 
 /*
@@ -125,7 +127,7 @@
 #define ll_entry_start(_type, _list)					\
 ({									\
 	static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN)	\
-		__attribute__((unused))					\
+		__always_unused			\
 		__section("__u_boot_list_2_"#_list"_1");			\
 	_type * tmp = (_type *)&start;					\
 	asm("":"+r"(tmp));						\
@@ -153,7 +155,8 @@
  */
 #define ll_entry_end(_type, _list)					\
 ({									\
-	static char end[0] __aligned(4) __attribute__((unused))		\
+	static char end[0] __aligned(CONFIG_LINKER_LIST_ALIGN)	\
+		__always_unused			\
 		__section("__u_boot_list_2_"#_list"_3");			\
 	_type * tmp = (_type *)&end;					\
 	asm("":"+r"(tmp));						\
@@ -249,7 +252,8 @@
  */
 #define ll_start(_type)							\
 ({									\
-	static char start[0] __aligned(4) __attribute__((unused))	\
+	static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN)	\
+		__always_unused								\
 		__section("__u_boot_list_1");				\
 	_type * tmp = (_type *)&start;					\
 	asm("":"+r"(tmp));						\
@@ -274,7 +278,8 @@
  */
 #define ll_end(_type)							\
 ({									\
-	static char end[0] __aligned(4) __attribute__((unused))		\
+	static char end[0] __aligned(CONFIG_LINKER_LIST_ALIGN)	\
+		__always_unused								\
 		__section("__u_boot_list_3");				\
 	_type * tmp = (_type *)&end;					\
 	asm("":"+r"(tmp));						\
-- 
2.25.1



More information about the U-Boot mailing list