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().
Unified · Split
| @@ -2241,15 +2241,15 @@ static int add_versions(struct buffer *b, struct module *mod) · 2240 unmodified lines | |||
| 2241 | return err; | 2241 | return err; |
| 2242 | } | 2242 | } |
| 2243 | 2243 | ||
| 2244 | static void add_depends(struct buffer *b, struct module *mod, | 2244 | static void add_depends(struct buffer *b, struct module *mod) |
| 2245 | struct module *modules) | ||
| 2246 | { | 2245 | { |
| 2247 | struct symbol *s; | 2246 | struct symbol *s; |
| 2248 | struct module *m; | ||
| 2249 | int first = 1; | 2247 | int first = 1; |
| 2250 | 2248 | ||
| 2251 | for (m = modules; m; m = m->next) | 2249 | /* Clear ->seen flag of modules that own symbols needed by this. */ |
| 2252 | m->seen = is_vmlinux(m->name); | 2250 | for (s = mod->unres; s; s = s->next) |
| 2251 | if (s->module) | ||
| 2252 | s->module->seen = is_vmlinux(s->module->name); | ||
| 2253 | 2253 | ||
| 2254 | buf_printf(b, "\n"); | 2254 | buf_printf(b, "\n"); |
| 2255 | buf_printf(b, "static const char __module_depends[]\n"); | 2255 | buf_printf(b, "static const char __module_depends[]\n"); |
| @@ -2518,7 +2518,7 @@ int main(int argc, char **argv) · 262 unmodified lines | |||
| 2518 | add_retpoline(&buf); | 2518 | add_retpoline(&buf); |
| 2519 | add_staging_flag(&buf, mod->name); | 2519 | add_staging_flag(&buf, mod->name); |
| 2520 | err |= add_versions(&buf, mod); | 2520 | err |= add_versions(&buf, mod); |
| 2521 | add_depends(&buf, mod, modules); | 2521 | add_depends(&buf, mod); |
| 2522 | add_moddevtable(&buf, mod); | 2522 | add_moddevtable(&buf, mod); |
| 2523 | add_srcversion(&buf, mod); | 2523 | add_srcversion(&buf, mod); |
| 2524 | 2524 | ||