Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scripts/nsdeps: get 'make nsdeps' working again

Since commit cdd30ebb1b9f ("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: cdd30ebb1b9f ("module: Convert symbol namespace to string literal")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Masahiro Yamada and committed by
Linus Torvalds
62aa6f2e cdd30ebb

+3 -3
+2 -2
scripts/coccinelle/misc/add_namespace.cocci
··· 13 13 declarer name MODULE_IMPORT_NS; 14 14 identifier virtual.ns; 15 15 @@ 16 - MODULE_IMPORT_NS("ns"); 16 + MODULE_IMPORT_NS(ns); 17 17 18 18 // Add missing imports, but only adjacent to a MODULE_LICENSE statement. 19 19 // That ensures we are adding it only to the main module source file. ··· 23 23 identifier virtual.ns; 24 24 @@ 25 25 MODULE_LICENSE(license); 26 - + MODULE_IMPORT_NS("ns"); 26 + + MODULE_IMPORT_NS(ns); 27 27 28 28 // Dummy rule for report mode that would otherwise be empty and make spatch 29 29 // fail ("No rules apply.")
+1 -1
scripts/nsdeps
··· 21 21 22 22 generate_deps_for_ns() { 23 23 $SPATCH --very-quiet --in-place --sp-file \ 24 - $srctree/scripts/coccinelle/misc/add_namespace.cocci -D nsdeps -D ns=$1 $2 24 + $srctree/scripts/coccinelle/misc/add_namespace.cocci -D nsdeps -D ns=\"$1\" $2 25 25 } 26 26 27 27 generate_deps() {