mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00

Since commitcdd30ebb1b
("module: Convert symbol namespace to string literal"), when MODULE_IMPORT_NS() is missing, 'make nsdeps' inserts pointless code: MODULE_IMPORT_NS("ns"); Here, "ns" is not a namespace, but the variable in the semantic patch. It must not be quoted. Instead, a string literal must be passed to Coccinelle. Fixes:cdd30ebb1b
("module: Convert symbol namespace to string literal") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
32 lines
837 B
Plaintext
32 lines
837 B
Plaintext
// SPDX-License-Identifier: GPL-2.0-only
|
|
//
|
|
/// Adds missing MODULE_IMPORT_NS statements to source files
|
|
///
|
|
/// This script is usually called from scripts/nsdeps with -D ns=<namespace> to
|
|
/// add a missing namespace tag to a module source file.
|
|
///
|
|
|
|
virtual nsdeps
|
|
virtual report
|
|
|
|
@has_ns_import@
|
|
declarer name MODULE_IMPORT_NS;
|
|
identifier virtual.ns;
|
|
@@
|
|
MODULE_IMPORT_NS(ns);
|
|
|
|
// Add missing imports, but only adjacent to a MODULE_LICENSE statement.
|
|
// That ensures we are adding it only to the main module source file.
|
|
@do_import depends on !has_ns_import && nsdeps@
|
|
declarer name MODULE_LICENSE;
|
|
expression license;
|
|
identifier virtual.ns;
|
|
@@
|
|
MODULE_LICENSE(license);
|
|
+ MODULE_IMPORT_NS(ns);
|
|
|
|
// Dummy rule for report mode that would otherwise be empty and make spatch
|
|
// fail ("No rules apply.")
|
|
@script:python depends on report@
|
|
@@
|