Move identical definitions of `EXPORT_SYMBOL_RUST_GPL` to `include/linux/export.h` from:
- `rust/exports.c` - `drivers/gpu/nova-core/nova_core_exports.c` Both files already include `<linux/export.h>`. Signed-off-by: Giuliano Procida <[email protected]> --- drivers/gpu/nova-core/nova_core_exports.c | 2 -- include/linux/export.h | 13 +++++++++++++ rust/exports.c | 12 +----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/nova-core/nova_core_exports.c b/drivers/gpu/nova-core/nova_core_exports.c index 6e80ca9792ee..480472b039db 100644 --- a/drivers/gpu/nova-core/nova_core_exports.c +++ b/drivers/gpu/nova-core/nova_core_exports.c @@ -10,6 +10,4 @@ #include <linux/export.h> -#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym) - #include "exports_nova_core_generated.h" diff --git a/include/linux/export.h b/include/linux/export.h index a686fd0ba406..4aeb422d86af 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -93,4 +93,17 @@ #define EXPORT_SYMBOL_FOR_MODULES(sym, mods) __EXPORT_SYMBOL(sym, "GPL", "module:" mods) +/* + * A hack to export Rust symbols for loadable modules without having to redo + * the entire `EXPORT_SYMBOL_GPL` logic in Rust. + * + * This requires Rust's new/future `v0` mangling scheme because the default one + * ("legacy") uses invalid characters for C identifiers (thus we cannot use the + * `EXPORT_SYMBOL_*` macros). + * + * All symbols are exported as GPL-only to guarantee no GPL-only feature is + * accidentally exposed. + */ +#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym) + #endif /* _LINUX_EXPORT_H */ diff --git a/rust/exports.c b/rust/exports.c index 1b52460b0f4e..8b2dd4aa1f92 100644 --- a/rust/exports.c +++ b/rust/exports.c @@ -1,20 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 /* - * A hack to export Rust symbols for loadable modules without having to redo - * the entire `include/linux/export.h` logic in Rust. - * - * This requires Rust's new/future `v0` mangling scheme because the default one - * ("legacy") uses invalid characters for C identifiers (thus we cannot use the - * `EXPORT_SYMBOL_*` macros). - * - * All symbols are exported as GPL-only to guarantee no GPL-only feature is - * accidentally exposed. + * Export symbols from the `rust/` crates and C helpers for loadable modules. */ #include <linux/export.h> -#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym) - #include "exports_core_generated.h" #include "exports_bindings_generated.h" #include "exports_kernel_generated.h" -- 2.56.0.218.g1ec904b173-goog
