]> git.ipfire.org Git - thirdparty/linux.git/commit
scripts/misc-check: check missing #include <linux/export.h> when W=1
authorMasahiro Yamada <masahiroy@kernel.org>
Sun, 1 Jun 2025 13:31:29 +0000 (22:31 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Thu, 5 Jun 2025 20:40:25 +0000 (05:40 +0900)
commita934a57a42f64a40705202f84144b1a29b29f910
tree70cb07a3cbd80fa40d038282ed616c22081a24f2
parent3a44052b728e5d96ea425f908e71926364a12f11
scripts/misc-check: check missing #include <linux/export.h> when W=1

The problem was described in commit 5b20755b7780 ("init: move THIS_MODULE
from <linux/export.h> to <linux/init.h>").

To summarize it again here: <linux/export.h> is included by most C files,
even though only some of them actually export symbols. This is because
some headers, such as include/linux/{module.h,linkage}, needlessly
include <linux/export.h>.

I have added a more detailed explanation in the comments of
scripts/misc-check.

This problem will be fixed in two steps:

 1. Add #include <linux/export.h> directly to C files that use
    EXPORT_SYMBOL()
 2. Remove #include <linux/export.h> from header files that do not use
    EXPORT_SYMBOL()

This commit addresses step 1; scripts/misc-check will warn about *.[ch]
files that use EXPORT_SYMBOL() but do not include <linux/export.h>.
This check is only triggered when the kernel is built with W=1.

We need to fix 4000+ files. I hope others will help with this effort.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/misc-check