aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.h
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-05-01 17:40:10 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2022-05-08 03:17:00 +0900
commit325eba05e8ab53a9182a2734f0986c15e5f87349 (patch)
treeb89301cee58214b36383f0d813dda02ab24dec57 /scripts/mod/modpost.h
parentmodpost: import include/linux/list.h (diff)
downloadlinux-dev-325eba05e8ab53a9182a2734f0986c15e5f87349.tar.xz
linux-dev-325eba05e8ab53a9182a2734f0986c15e5f87349.zip
modpost: traverse modules in order
Currently, modpost manages modules in a singly linked list; it adds a new node to the head, and traverses the list from new to old. It works, but the error messages are shown in the reverse order. If you have a Makefile like this: obj-m += foo.o bar.o then, modpost shows error messages in bar.o, foo.o, in this order. Use a doubly linked list to keep the order in modules.order; use list_add_tail() for the node addition and list_for_each_entry() for the list traverse. Now that the kernel's list macros have been imported to modpost, I will use them actively going forward. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to '')
-rw-r--r--scripts/mod/modpost.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 73c36dfbf0e1..69601f36d080 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -11,6 +11,7 @@
#include <unistd.h>
#include <elf.h>
+#include "list.h"
#include "elfconfig.h"
/* On BSD-alike OSes elf.h defines these according to host's word size */
@@ -111,7 +112,7 @@ void
buf_write(struct buffer *buf, const char *s, int len);
struct module {
- struct module *next;
+ struct list_head list;
bool is_gpl_compatible;
struct symbol *unres;
bool from_dump; /* true if module was loaded from *.symvers */