[PATCH v4 11/21] modpost: rename find_elf_symbol() and find_elf_symbol2()

Masahiro Yamada
2023-05-13T20:46:22Z

find_elf_symbol() and find_elf_symbol2() are not good names.

Rename them to find_better_symbol(), find_nearest_symbol(),
respectively.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

scripts/mod/modpost.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index b4fa9e0be4d1..d2a9c655f6ea 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1118,8 +1118,8 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
}

/* Look up the nearest symbol based on the section and the address */
-static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
- unsigned int secndx)
+static Elf_Sym *find_nearest_symbol(struct elf_info *elf, Elf_Addr addr,
+ unsigned int secndx)
{
Elf_Sym *sym;
Elf_Sym *near = NULL;
@@ -1140,14 +1140,14 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
return near;
}

-static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym)
+static Elf_Sym *find_better_symbol(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym)
{
/* If the supplied symbol is valid, return it */
if (sym->st_name != 0)
return sym;

/* Otherwise, look up a better symbol */
- return find_elf_symbol2(elf, addr, get_secindex(elf, sym));
+ return find_nearest_symbol(elf, addr, get_secindex(elf, sym));
}

static bool is_executable_section(struct elf_info *elf, unsigned int secndx)
@@ -1169,10 +1169,10 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
const char *tosym;
const char *fromsym;

- from = find_elf_symbol2(elf, r->r_offset, fsecndx);
+ from = find_nearest_symbol(elf, r->r_offset, fsecndx);
fromsym = sym_name(elf, from);

- to = find_elf_symbol(elf, r->r_addend, sym);
+ to = find_better_symbol(elf, r->r_addend, sym);
tosym = sym_name(elf, to);

/* check whitelist - we may ignore it */
--
2.39.2