summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <florian.schmaus@codasip.com>2026-06-06 20:17:53 -0600
committerPaul Walmsley <pjw@kernel.org>2026-06-06 20:17:53 -0600
commit3e17a4b443bbaecc723a2d51faeaa1a0097e43e9 (patch)
tree243200414b9f1ab107ecc3180ce2c84c364890b3
parentecbf894165a2e86b0830eb82be49f861da2a9e0b (diff)
downloadlinux-3e17a4b443bbaecc723a2d51faeaa1a0097e43e9.tar.gz
linux-3e17a4b443bbaecc723a2d51faeaa1a0097e43e9.zip
riscv: module: Use generic cmp_int() instead of custom cmp_3way()
The module-sections.c file defines a custom cmp_3way() macro to perform 3-way comparisons during relocation sorting. Instead of maintaining our own implementation, use the generic cmp_int() macro provided by the already included <linux/sort.h>. This removes redundant code and relies on standard kernel interfaces. Signed-off-by: Florian Schmaus <florian.schmaus@codasip.com> Link: https://patch.msgid.link/20260512063231.708256-1-florian.schmaus@codasip.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
-rw-r--r--arch/riscv/kernel/module-sections.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/riscv/kernel/module-sections.c b/arch/riscv/kernel/module-sections.c
index 98eaac6f6606..b3b11b7f7ed9 100644
--- a/arch/riscv/kernel/module-sections.c
+++ b/arch/riscv/kernel/module-sections.c
@@ -56,17 +56,15 @@ unsigned long module_emit_plt_entry(struct module *mod, unsigned long val)
return (unsigned long)&plt[i];
}
-#define cmp_3way(a, b) ((a) < (b) ? -1 : (a) > (b))
-
static int cmp_rela(const void *a, const void *b)
{
const Elf_Rela *x = a, *y = b;
int i;
/* sort by type, symbol index and addend */
- i = cmp_3way(x->r_info, y->r_info);
+ i = cmp_int(x->r_info, y->r_info);
if (i == 0)
- i = cmp_3way(x->r_addend, y->r_addend);
+ i = cmp_int(x->r_addend, y->r_addend);
return i;
}