Skip to content

Commit

Permalink
modpost: refactor seen flag clearing in add_depends()
Browse files Browse the repository at this point in the history
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 <yamada.masahiro@socionext.com>
  • Loading branch information
Masahiro Yamada committed Dec 1, 2018
1 parent f880eea commit d2665ca
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -2241,15 +2241,15 @@ static int add_versions(struct buffer *b, struct module *mod)
return err;
}

static void add_depends(struct buffer *b, struct module *mod,
struct module *modules)
static void add_depends(struct buffer *b, struct module *mod)
{
struct symbol *s;
struct module *m;
int first = 1;

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

buf_printf(b, "\n");
buf_printf(b, "static const char __module_depends[]\n");
Expand Down Expand Up @@ -2518,7 +2518,7 @@ int main(int argc, char **argv)
add_retpoline(&buf);
add_staging_flag(&buf, mod->name);
err |= add_versions(&buf, mod);
add_depends(&buf, mod, modules);
add_depends(&buf, mod);
add_moddevtable(&buf, mod);
add_srcversion(&buf, mod);

Expand Down

0 comments on commit d2665ca

Please sign in to comment.