Skip to content

Commit 6e7611c

Browse files
committed
modpost: squash sym_update_namespace() into sym_add_exported()
Pass a set of the name, license, and namespace to sym_add_exported(). sym_update_namespace() is unneeded. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
1 parent 6d62b1c commit 6e7611c

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

scripts/mod/modpost.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -355,26 +355,8 @@ static const char *sec_name(const struct elf_info *info, unsigned int secindex)
355355

356356
#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
357357

358-
static void sym_update_namespace(const char *symname, const char *namespace)
359-
{
360-
struct symbol *s = find_symbol(symname);
361-
362-
/*
363-
* That symbol should have been created earlier and thus this is
364-
* actually an assertion.
365-
*/
366-
if (!s) {
367-
error("Could not update namespace(%s) for symbol %s\n",
368-
namespace, symname);
369-
return;
370-
}
371-
372-
free(s->namespace);
373-
s->namespace = namespace[0] ? NOFAIL(strdup(namespace)) : NULL;
374-
}
375-
376358
static struct symbol *sym_add_exported(const char *name, struct module *mod,
377-
bool gpl_only)
359+
bool gpl_only, const char *namespace)
378360
{
379361
struct symbol *s = find_symbol(name);
380362

@@ -387,6 +369,7 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
387369
s = alloc_symbol(name);
388370
s->module = mod;
389371
s->is_gpl_only = gpl_only;
372+
s->namespace = namespace[0] ? NOFAIL(strdup(namespace)) : NULL;
390373
list_add_tail(&s->list, &mod->exported_symbols);
391374
hash_add_symbol(s);
392375

@@ -1236,8 +1219,7 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf,
12361219
}
12371220

12381221
data += strlen(data) + 1; /* namespace */
1239-
s = sym_add_exported(name, mod, is_gpl);
1240-
sym_update_namespace(name, data);
1222+
s = sym_add_exported(name, mod, is_gpl, data);
12411223

12421224
/*
12431225
* We need to be aware whether we are exporting a function or
@@ -2180,9 +2162,8 @@ static void read_dump(const char *fname)
21802162
mod = new_module(modname, strlen(modname));
21812163
mod->from_dump = true;
21822164
}
2183-
s = sym_add_exported(symname, mod, gpl_only);
2165+
s = sym_add_exported(symname, mod, gpl_only, namespace);
21842166
sym_set_crc(s, crc);
2185-
sym_update_namespace(symname, namespace);
21862167
}
21872168
free(buf);
21882169
return;

0 commit comments

Comments
 (0)