From 00f69564c5fa1bc9ead59a4412aa852f6f06c241 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 16 Oct 2024 15:58:58 +0200 Subject: [PATCH] xfree86: common: unexport UnloadModule() and UnloadSubModule() Not used by any driver/module, so no need to keep it exported. Also making them type-safe. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- hw/xfree86/common/xf86Helper.c | 1 + hw/xfree86/common/xf86Init.c | 1 + hw/xfree86/common/xf86Module.h | 2 -- hw/xfree86/common/xf86Module_priv.h | 22 ++++++++++++++++++++++ hw/xfree86/common/xf86Xinput.c | 1 + hw/xfree86/loader/loadmod.c | 9 +++------ 6 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 hw/xfree86/common/xf86Module_priv.h diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 09cbac6f1..9839622f0 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -61,6 +61,7 @@ #include "xf86InPriv.h" #include "xf86Config.h" #include "mivalidate.h" +#include "xf86Module_priv.h" /* For xf86GetClocks */ #if defined(CSRG_BASED) || defined(__GNU__) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index bcfaf8d1d..a21afe04b 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -66,6 +66,7 @@ #include "systemd-logind.h" #include "loaderProcs.h" +#include "xf86Module_priv.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86Config.h" diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 8db6ad6de..6c25c4bd1 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -151,8 +151,6 @@ typedef struct { extern _X_EXPORT void *LoadSubModule(void *, const char *, const char **, const char **, void *, const XF86ModReqInfo *, int *, int *); -extern _X_EXPORT void UnloadSubModule(void *); -extern _X_EXPORT void UnloadModule(void *); extern _X_EXPORT void *LoaderSymbol(const char *); extern _X_EXPORT void *LoaderSymbolFromModule(void *, const char *); extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int); diff --git a/hw/xfree86/common/xf86Module_priv.h b/hw/xfree86/common/xf86Module_priv.h new file mode 100644 index 000000000..8a5995382 --- /dev/null +++ b/hw/xfree86/common/xf86Module_priv.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2024 Enrico Weigelt, metux IT consult + */ +#ifndef _XORG_XF86MODULE_PRIV_H +#define _XORG_XF86MODULE_PRIV_H + +/* + * unload a previously loaded module + * + * @param mod the module to unload + */ +void UnloadModule(ModuleDescPtr mod); + +/* + * unload a previously loaded sun-module + * + * @param mod the sub-module to unload + */ +void UnloadSubModule(ModuleDescPtr mod); + +#endif /* _XORG_XF86MODULE_PRIV_H */ diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 2d310cc58..d0f9db52e 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -76,6 +76,7 @@ #include "eventstr.h" #include "inpututils.h" #include "optionstr.h" +#include "xf86Module_priv.h" #ifdef HAVE_FNMATCH_H #include diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index cca11028c..39763453c 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -55,6 +55,7 @@ #include "loaderProcs.h" #include "xf86Module.h" #include "loader.h" +#include "xf86Module_priv.h" #include #include @@ -840,10 +841,8 @@ LoadModule(const char *module, void *options, const XF86ModReqInfo *modreq, } void -UnloadModule(void *_mod) +UnloadModule(ModuleDescPtr mod) { - ModuleDescPtr mod = _mod; - if (mod == (ModuleDescPtr) 1) return; @@ -873,10 +872,8 @@ UnloadModule(void *_mod) } void -UnloadSubModule(void *_mod) +UnloadSubModule(ModuleDescPtr mod) { - ModuleDescPtr mod = (ModuleDescPtr) _mod; - /* Some drivers are calling us on built-in submodules, ignore them */ if (mod == (ModuleDescPtr) 1) return;