git: f3fc80b1b2c4 - stable/15 - linuxkpi: Define `sort_r()`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 29 Apr 2026 21:42:47 UTC
The branch stable/15 has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=f3fc80b1b2c4eab259e6f610ac0a241b71b520f4

commit f3fc80b1b2c4eab259e6f610ac0a241b71b520f4
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-04-11 12:42:14 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-04-29 21:03:15 +0000

    linuxkpi: Define `sort_r()`
    
    Like Linux `sort()` and FreeBSD `qsort()`, `sort_r()` is a wrapper
    around FreeBSD `qsort_r()`.
    
    The i915 DRM driver started to use it in Linux 6.12.
    
    Reviewed by:    bz
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 4dab15e96d40352e1a0b161a2a1cd763176108b6)
---
 sys/compat/linuxkpi/common/include/linux/sort.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/sort.h b/sys/compat/linuxkpi/common/include/linux/sort.h
index 361b37c587c8..972c8514e6fb 100644
--- a/sys/compat/linuxkpi/common/include/linux/sort.h
+++ b/sys/compat/linuxkpi/common/include/linux/sort.h
@@ -38,4 +38,9 @@
 	qsort(base, num, size, cmp);			\
 } while (0)
 
+#define	sort_r(base, num, size, cmp, swap, priv) do {	\
+	BUILD_BUG_ON(swap);				\
+	qsort_r(base, num, size, cmp, priv);		\
+} while (0)
+
 #endif	/* _LINUXKPI_LINUX_SORT_H_ */