From: Simon Glass <simon.glass@canonical.com> Create include/linux/module.h with stub definitions for kernel module support. U-Boot doesn't use loadable modules, so these are no-ops. Includes: - THIS_MODULE, try_module_get(), module_put() - module_init(), module_exit() - module_param() and variants - MODULE_* macros (LICENSE, AUTHOR, DESCRIPTION, etc.) Update compat.h to include module.h and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- include/linux/compat.h | 16 +--------------- include/linux/module.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 include/linux/module.h diff --git a/include/linux/compat.h b/include/linux/compat.h index 28207fb96b8..3bba18d637d 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -14,6 +14,7 @@ #include <linux/export.h> #include <linux/freezer.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/slab.h> #include <linux/uaccess.h> #include <linux/vmalloc.h> @@ -126,21 +127,6 @@ typedef unsigned long sector_t; typedef unsigned long blkcnt_t; #endif -/* module */ -#define THIS_MODULE 0 -#define try_module_get(...) 1 -#define module_put(...) do { } while (0) -#define module_init(...) -#define module_exit(...) -#define module_param(...) -#define module_param_call(...) -#define MODULE_PARM_DESC(...) -#define MODULE_VERSION(...) -#define MODULE_DESCRIPTION(...) -#define MODULE_AUTHOR(...) -#define MODULE_LICENSE(...) -#define MODULE_ALIAS(...) -#define __module_get(...) /* character device */ #define MKDEV(...) 0 diff --git a/include/linux/module.h b/include/linux/module.h new file mode 100644 index 00000000000..ba226652144 --- /dev/null +++ b/include/linux/module.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Dynamic loading of modules into the kernel. + * + * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996 + * Rewritten again by Rusty Russell, 2002 + * + * Stub definitions for Linux kernel module support. + * U-Boot doesn't use loadable modules. + */ +#ifndef _LINUX_MODULE_H +#define _LINUX_MODULE_H + +struct module; + +#define THIS_MODULE ((struct module *)0) +#define try_module_get(...) 1 +#define module_put(...) do { } while (0) +#define __module_get(...) do { } while (0) + +#define module_init(fn) +#define module_exit(fn) + +#define module_param(name, type, perm) +#define module_param_call(name, set, get, arg, perm) +#define module_param_named(name, var, type, perm) + +#define MODULE_PARM_DESC(name, desc) +#define MODULE_VERSION(ver) +#define MODULE_DESCRIPTION(desc) +#define MODULE_AUTHOR(author) +#define MODULE_LICENSE(license) +#define MODULE_ALIAS(alias) +#define MODULE_SOFTDEP(dep) +#define MODULE_INFO(tag, info) + +#endif /* _LINUX_MODULE_H */ -- 2.43.0