From 4b5b0b79d1f8ef9a683b6572267867d5d9755338 Mon Sep 17 00:00:00 2001 From: Tiezhu Yang Date: Mon, 17 Aug 2026 22:07:14 +0800 Subject: [PATCH] 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 Signed-off-by: Huacai Chen --- arch/loongarch/kernel/module-sections.c | 6 ++---- 1 file 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; }