mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
modpost: use sym_get_data() to get module device_table data
Use sym_get_data() to replace the long code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
This commit is contained in:
parent
5764f6626f
commit
abe864b8e1
3 changed files with 3 additions and 4 deletions
|
@ -1571,9 +1571,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
|
||||||
zeros = calloc(1, sym->st_size);
|
zeros = calloc(1, sym->st_size);
|
||||||
symval = zeros;
|
symval = zeros;
|
||||||
} else {
|
} else {
|
||||||
symval = (void *)info->hdr
|
symval = sym_get_data(info, sym);
|
||||||
+ info->sechdrs[get_secindex(info, sym)].sh_offset
|
|
||||||
+ sym->st_value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First handle the "special" cases */
|
/* First handle the "special" cases */
|
||||||
|
|
|
@ -324,7 +324,7 @@ static void *sym_get_data_by_offset(const struct elf_info *info,
|
||||||
return (void *)info->hdr + sechdr->sh_offset + offset;
|
return (void *)info->hdr + sechdr->sh_offset + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
|
void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
|
||||||
{
|
{
|
||||||
return sym_get_data_by_offset(info, get_secindex(info, sym),
|
return sym_get_data_by_offset(info, get_secindex(info, sym),
|
||||||
sym->st_value);
|
sym->st_value);
|
||||||
|
|
|
@ -187,6 +187,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen);
|
||||||
/* from modpost.c */
|
/* from modpost.c */
|
||||||
char *read_text_file(const char *filename);
|
char *read_text_file(const char *filename);
|
||||||
char *get_line(char **stringp);
|
char *get_line(char **stringp);
|
||||||
|
void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym);
|
||||||
|
|
||||||
enum loglevel {
|
enum loglevel {
|
||||||
LOG_WARN,
|
LOG_WARN,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue