aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-05-09 05:50:37 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-05-17 09:44:58 -0400
commitbca2ccee4c4ac69496d3c8655d7869122fe5aeab (patch)
tree6347212949bd36d8a32f2dead582a0f60e573a2f /scripts/mod
parenta6b04f0ed5e931d4be5bf466ad469e2ac25ad6da (diff)
modpost: pass struct elf_info pointer to get_modinfo()
get_(next_)modinfo takes a pointer and length pair of the .modinfo section. Instead, pass struct elf_info pointer to reduce the number of function arguments. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/modpost.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index bc71925d4e9b..37a6a0b42846 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -724,16 +724,17 @@ static char *next_string(char *string, unsigned long *secsize)
724 return string; 724 return string;
725} 725}
726 726
727static char *get_next_modinfo(void *modinfo, unsigned long modinfo_len, 727static char *get_next_modinfo(struct elf_info *info, const char *tag,
728 const char *tag, char *info) 728 char *prev)
729{ 729{
730 char *p; 730 char *p;
731 unsigned int taglen = strlen(tag); 731 unsigned int taglen = strlen(tag);
732 unsigned long size = modinfo_len; 732 char *modinfo = info->modinfo;
733 unsigned long size = info->modinfo_len;
733 734
734 if (info) { 735 if (prev) {
735 size -= info - (char *)modinfo; 736 size -= prev - modinfo;
736 modinfo = next_string(info, &size); 737 modinfo = next_string(prev, &size);
737 } 738 }
738 739
739 for (p = modinfo; p; p = next_string(p, &size)) { 740 for (p = modinfo; p; p = next_string(p, &size)) {
@@ -743,11 +744,10 @@ static char *get_next_modinfo(void *modinfo, unsigned long modinfo_len,
743 return NULL; 744 return NULL;
744} 745}
745 746
746static char *get_modinfo(void *modinfo, unsigned long modinfo_len, 747static char *get_modinfo(struct elf_info *info, const char *tag)
747 const char *tag)
748 748
749{ 749{
750 return get_next_modinfo(modinfo, modinfo_len, tag, NULL); 750 return get_next_modinfo(info, tag, NULL);
751} 751}
752 752
753/** 753/**
@@ -1951,7 +1951,7 @@ static void read_symbols(char *modname)
1951 mod->skip = 1; 1951 mod->skip = 1;
1952 } 1952 }
1953 1953
1954 license = get_modinfo(info.modinfo, info.modinfo_len, "license"); 1954 license = get_modinfo(&info, "license");
1955 if (!license && !is_vmlinux(modname)) 1955 if (!license && !is_vmlinux(modname))
1956 warn("modpost: missing MODULE_LICENSE() in %s\n" 1956 warn("modpost: missing MODULE_LICENSE() in %s\n"
1957 "see include/linux/module.h for " 1957 "see include/linux/module.h for "
@@ -1963,8 +1963,7 @@ static void read_symbols(char *modname)
1963 mod->gpl_compatible = 0; 1963 mod->gpl_compatible = 0;
1964 break; 1964 break;
1965 } 1965 }
1966 license = get_next_modinfo(info.modinfo, info.modinfo_len, 1966 license = get_next_modinfo(&info, "license", license);
1967 "license", license);
1968 } 1967 }
1969 1968
1970 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { 1969 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
@@ -1977,7 +1976,7 @@ static void read_symbols(char *modname)
1977 (is_vmlinux(modname) && vmlinux_section_warnings)) 1976 (is_vmlinux(modname) && vmlinux_section_warnings))
1978 check_sec_ref(mod, modname, &info); 1977 check_sec_ref(mod, modname, &info);
1979 1978
1980 version = get_modinfo(info.modinfo, info.modinfo_len, "version"); 1979 version = get_modinfo(&info, "version");
1981 if (version) 1980 if (version)
1982 maybe_frob_rcs_version(modname, version, info.modinfo, 1981 maybe_frob_rcs_version(modname, version, info.modinfo,
1983 version - (char *)info.hdr); 1982 version - (char *)info.hdr);