git: c81f51651211 - stable/15 - linuxkpi: Implement `module_*()` APIs as static functions

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Thu, 07 May 2026 11:16:28 UTC
The branch stable/15 has been updated by dumbbell:

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

commit c81f516512111fa5ac8d5a9f3f7e64c2fb5ab5a3
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-05-07 11:16:09 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-05-07 11:16:09 +0000

    linuxkpi: Implement `module_*()` APIs as static functions
    
    This fixes an "unused variable" warning when building DRM drivers.
    
    Reviewed by:    emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D56780
    
    (cherry picked from commit 658bb99db9c7872f92ccb86ed2674c72636436d2)
---
 sys/compat/linuxkpi/common/include/linux/module.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/module.h b/sys/compat/linuxkpi/common/include/linux/module.h
index fbe57cbbed82..de4be1e9ebe9 100644
--- a/sys/compat/linuxkpi/common/include/linux/module.h
+++ b/sys/compat/linuxkpi/common/include/linux/module.h
@@ -136,9 +136,14 @@ _module_run(void *arg)
 #define	module_exit_order(fn, order)				\
 	SYSUNINIT(fn, SI_SUB_OFED_MODINIT, (order), _module_run, (fn))
 
-#define	module_get(module)
-#define	module_put(module)
-#define	try_module_get(module)	1
+static inline void module_get(struct module *module) {}
+static inline void module_put(struct module *module) {}
+
+static inline bool
+try_module_get(struct module *module)
+{
+	return (true);
+}
 
 #define	postcore_initcall(fn)	module_init(fn)