[1/7] modpost: move sym_name() to modpost.h
Commit Message
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@kernel.org>
---
scripts/mod/modpost.c | 8 --------
scripts/mod/modpost.h | 9 +++++++++
2 files changed, 9 insertions(+), 8 deletions(-)
@@ -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).
@@ -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.