1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef __LINUX_KMOD_H__
3 #define __LINUX_KMOD_H__
10 #include <linux/gfp.h>
11 #include <linux/stddef.h>
12 #include <linux/errno.h>
13 #include <linux/compiler.h>
14 #include <linux/workqueue.h>
15 #include <linux/sysctl.h>
17 #define KMOD_PATH_LEN 256
20 extern char modprobe_path[]; /* for sysctl */
21 /* modprobe exit status on success, -ve on error. Return value
22 * usually useless though. */
24 int __request_module(bool wait, const char *name, ...);
25 #define request_module(mod...) __request_module(true, mod)
26 #define request_module_nowait(mod...) __request_module(false, mod)
27 #define try_then_request_module(x, mod...) \
28 ((x) ?: (__request_module(true, mod), (x)))
30 static inline int request_module(const char *name, ...) { return -ENOSYS; }
31 static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; }
32 #define try_then_request_module(x, mod...) (x)
35 #endif /* __LINUX_KMOD_H__ */