summaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/modpost.c17
-rw-r--r--scripts/mod/modpost.h3
2 files changed, 10 insertions, 10 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 25066dc25790..1b9dcb44621c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -165,16 +165,17 @@ char *get_line(char **stringp)
}
/* A list of all modules we processed */
-static struct module *modules;
+LIST_HEAD(modules);
static struct module *find_module(const char *modname)
{
struct module *mod;
- for (mod = modules; mod; mod = mod->next)
+ list_for_each_entry(mod, &modules, list) {
if (strcmp(mod->name, modname) == 0)
- break;
- return mod;
+ return mod;
+ }
+ return NULL;
}
static struct module *new_module(const char *modname)
@@ -184,7 +185,6 @@ static struct module *new_module(const char *modname)
mod = NOFAIL(malloc(sizeof(*mod) + strlen(modname) + 1));
memset(mod, 0, sizeof(*mod));
- /* add to list */
strcpy(mod->name, modname);
mod->is_vmlinux = (strcmp(modname, "vmlinux") == 0);
@@ -195,8 +195,7 @@ static struct module *new_module(const char *modname)
*/
mod->is_gpl_compatible = true;
- mod->next = modules;
- modules = mod;
+ list_add_tail(&mod->list, &modules);
return mod;
}
@@ -2477,7 +2476,7 @@ static void write_namespace_deps_files(const char *fname)
struct namespace_list *ns;
struct buffer ns_deps_buf = {};
- for (mod = modules; mod; mod = mod->next) {
+ list_for_each_entry(mod, &modules, list) {
if (mod->from_dump || !mod->missing_namespaces)
continue;
@@ -2568,7 +2567,7 @@ int main(int argc, char **argv)
if (files_source)
read_symbols_from_files(files_source);
- for (mod = modules; mod; mod = mod->next) {
+ list_for_each_entry(mod, &modules, list) {
char fname[PATH_MAX];
int ret;
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 */