summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiezhu Yang <yangtiezhu@loongson.cn>2026-08-17 22:07:14 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2026-08-17 22:07:14 +0800
commit4b5b0b79d1f8ef9a683b6572267867d5d9755338 (patch)
treec2cc6935e1352f5eeed4a5e41989bf693f3e72cb
parent18210a104bb97e28c26dc31fd9fc7b5c381fec62 (diff)
LoongArch: Use generic cmp_int() instead of custom cmp_3way()
Currently, the module-sections.c file defines a custom cmp_3way() macro to perform a three-way comparison. There is already a generic cmp_int() macro to do the same thing in linux/sort.h, thus remove the custom macro and use the generic interface. This is similar with commit 3e17a4b443bb ("riscv: module: Use generic cmp_int() instead of custom cmp_3way()"). Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
-rw-r--r--arch/loongarch/kernel/module-sections.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/loongarch/kernel/module-sections.c b/arch/loongarch/kernel/module-sections.c
index 9fa1c9814fcc..0259d9c7ea30 100644
--- a/arch/loongarch/kernel/module-sections.c
+++ b/arch/loongarch/kernel/module-sections.c
@@ -62,16 +62,14 @@ Elf_Addr module_emit_plt_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr v
return (Elf_Addr)&plt[nr];
}
-#define cmp_3way(a, b) ((a) < (b) ? -1 : (a) > (b))
-
static int compare_rela(const void *x, const void *y)
{
int ret;
const Elf_Rela *rela_x = x, *rela_y = y;
- ret = cmp_3way(rela_x->r_info, rela_y->r_info);
+ ret = cmp_int(rela_x->r_info, rela_y->r_info);
if (ret == 0)
- ret = cmp_3way(rela_x->r_addend, rela_y->r_addend);
+ ret = cmp_int(rela_x->r_addend, rela_y->r_addend);
return ret;
}