From b12fa0d85b21d84cdf4509c5048c67e17914eb28 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Mon, 30 Mar 2020 17:12:44 +0200 Subject: [PATCH] module: add MODULE_HARDDEP Currently we have no way to express a hard dependency that is not a symbol-based dependency (symbol defined in module A is used in module B). Use case: Network driver ND uses callbacks in the dedicated PHY driver DP for the integrated PHY. If DP can't be loaded (e.g. because ND is in initramfs but DP is not), then phylib will load the generic PHY driver GP. GP doesn't implement certain callbacks that are used by ND, therefore ND's probe has to bail out with an error once it detects that DP is not loaded. This patch allows to express this hard dependency of ND from DP. depmod will read this dependency information and treat it like a symbol-based dependency. As a result tools e.g. populating initramfs can consider the dependency and place DP in initramfs if ND is in initramfs. Signed-off-by: Heiner Kallweit --- include/linux/module.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/module.h b/include/linux/module.h index 1ad393e62..f38d4107f 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -169,6 +169,11 @@ extern void cleanup_module(void); */ #define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep) +/* Hard module dependencies that are not code dependencies + * Example: MODULE_HARDDEP("module-foo module-bar") + */ +#define MODULE_HARDDEP(_harddep) MODULE_INFO(harddep, _harddep) + /* * MODULE_FILE is used for generating modules.builtin * So, make it no-op when this is being built as a module -- 2.26.0