Skip to content

Commit

Permalink
scripts/nsdeps: get 'make nsdeps' working again
Browse files Browse the repository at this point in the history
Since commit cdd30eb ("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: cdd30eb ("module: Convert symbol namespace to string literal")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Masahiro Yamada authored and Linus Torvalds committed Dec 3, 2024
1 parent cdd30eb commit 62aa6f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/coccinelle/misc/add_namespace.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ virtual report
declarer name MODULE_IMPORT_NS;
identifier virtual.ns;
@@
MODULE_IMPORT_NS("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.
Expand All @@ -23,7 +23,7 @@ expression license;
identifier virtual.ns;
@@
MODULE_LICENSE(license);
+ MODULE_IMPORT_NS("ns");
+ MODULE_IMPORT_NS(ns);

// Dummy rule for report mode that would otherwise be empty and make spatch
// fail ("No rules apply.")
Expand Down
2 changes: 1 addition & 1 deletion scripts/nsdeps
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fi

generate_deps_for_ns() {
$SPATCH --very-quiet --in-place --sp-file \
$srctree/scripts/coccinelle/misc/add_namespace.cocci -D nsdeps -D ns=$1 $2
$srctree/scripts/coccinelle/misc/add_namespace.cocci -D nsdeps -D ns=\"$1\" $2
}

generate_deps() {
Expand Down

0 comments on commit 62aa6f2

Please sign in to comment.