Move sym_name() to modpost.h so it can be used in other source files. Also, add the 'const' qualifier to the function arguments. Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx> --- scripts/mod/modpost.c | 8 -------- scripts/mod/modpost.h | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 973b5e5ae2dd..896ecfa8483f 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -710,14 +710,6 @@ static char *get_modinfo(struct elf_info *info, const char *tag) return get_next_modinfo(info, tag, NULL); } -static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) -{ - if (sym) - return elf->strtab + sym->st_name; - else - return "(unknown)"; -} - /* * Check whether the 'string' argument matches one of the 'patterns', * an array of shell wildcard patterns (glob). diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 1392afec118c..9834ac44846d 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -156,6 +156,15 @@ static inline unsigned int get_secindex(const struct elf_info *info, return index; } +static inline const char *sym_name(const struct elf_info *elf, + const Elf_Sym *sym) +{ + if (sym) + return elf->strtab + sym->st_name; + else + return "(unknown)"; +} + /* * If there's no name there, ignore it; likewise, ignore it if it's * one of the magic symbols emitted used by current tools. -- 2.40.1