Skip to content

Commit d2665ca

Browse files
committed
modpost: refactor seen flag clearing in add_depends()
You do not need to iterate over all modules for resetting ->seen flag because add_depends() is only interested in modules that export symbols referenced from the given 'mod'. This also avoids shadowing the 'modules' parameter of add_depends(). Signed-off-by: Masahiro Yamada <[email protected]>
1 parent f880eea commit d2665ca

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts/mod/modpost.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,15 +2241,15 @@ static int add_versions(struct buffer *b, struct module *mod)
22412241
return err;
22422242
}
22432243

2244-
static void add_depends(struct buffer *b, struct module *mod,
2245-
struct module *modules)
2244+
static void add_depends(struct buffer *b, struct module *mod)
22462245
{
22472246
struct symbol *s;
2248-
struct module *m;
22492247
int first = 1;
22502248

2251-
for (m = modules; m; m = m->next)
2252-
m->seen = is_vmlinux(m->name);
2249+
/* Clear ->seen flag of modules that own symbols needed by this. */
2250+
for (s = mod->unres; s; s = s->next)
2251+
if (s->module)
2252+
s->module->seen = is_vmlinux(s->module->name);
22532253

22542254
buf_printf(b, "\n");
22552255
buf_printf(b, "static const char __module_depends[]\n");
@@ -2518,7 +2518,7 @@ int main(int argc, char **argv)
25182518
add_retpoline(&buf);
25192519
add_staging_flag(&buf, mod->name);
25202520
err |= add_versions(&buf, mod);
2521-
add_depends(&buf, mod, modules);
2521+
add_depends(&buf, mod);
25222522
add_moddevtable(&buf, mod);
25232523
add_srcversion(&buf, mod);
25242524

0 commit comments

Comments
 (0)