Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] rust: missing scripts/misc-check update for EXPORT_SYMBOL_RUST_GPL()
--

commit 9207c761154db27eab7d2644afb940dea51e432c
Author: Giuliano Procida <[email protected]>

rust: move EXPORT_SYMBOL_RUST_GPL to include/linux/export.h

This commit moves the duplicate definitions of EXPORT_SYMBOL_RUST_GPL from
rust/exports.c and drivers/gpu/nova-core/nova_core_exports.c into
include/linux/export.h.

> diff --git a/drivers/gpu/nova-core/nova_core_exports.c 
> b/drivers/gpu/nova-core/nova_core_exports.c
> index 6e80ca9792ee5..480472b039db2 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 a686fd0ba4065..4aeb422d86afc 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 1b52460b0f4ee..8b2dd4aa1f928 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"

[Severity: Low]
Does moving EXPORT_SYMBOL_RUST_GPL into include/linux/export.h cause
scripts/misc-check to emit false-positive warnings during W=2 builds?

In scripts/misc-check, check_missing_include_linux_export_h() and
check_unnecessary_include_linux_export_h() match export macros against
tracked files using:

scripts/misc-check:check_unnecessary_include_linux_export_h() {
        git -C "${srctree:-.}" grep --files-with-matches 
'#include[[:space:]]*<linux/export\.h>' \
            -- '*.[c]' :^tools/ |
        xargs -r git -C "${srctree:-.}" grep --files-without-match -E 
'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' |
        xargs -r printf "%s: warning: EXPORT_SYMBOL() is not used, but #include 
<linux/export.h> is present\n" >&2
}

Previously, the local macro definition in both rust/exports.c and
drivers/gpu/nova-core/nova_core_exports.c contained EXPORT_SYMBOL_GPL(sym),
which satisfied that regular expression.

With the macro definition moved to include/linux/export.h, rust/exports.c
only contains EXPORT_SYMBOL_RUST_GPL(rust_build_error), and
drivers/gpu/nova-core/nova_core_exports.c only includes
exports_nova_core_generated.h without any direct EXPORT_SYMBOL* calls in the
tracked .c file. As a result, running make W=2 warns on both files:

  drivers/gpu/nova-core/nova_core_exports.c: warning: EXPORT_SYMBOL() is not 
used, but #include <linux/export.h> is present
  rust/exports.c: warning: EXPORT_SYMBOL() is not used, but #include 
<linux/export.h> is present

Should scripts/misc-check also be updated to recognize
EXPORT_SYMBOL_RUST_GPL() and handle C export files that only invoke it via
generated headers?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to