Skip to contentSkip to conversation

scripts/checkpatch.pl: Resync with v6.17

PATCH In review Kory Maincent 2 participants 3 messages Sep 29, 2025 – Oct 9, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/checkpatch.pl: Resync with v6.17

This resyncs us with the version found in v6.17 of the Linux kernel with the following exceptions:
- Keep our u-boot specific tests / code area.
- Keep the location of our checkpatch.rst
- Change the "use strscpy" test as we don't have that to strlcpy
- Keep debug/printf in the list for $logFunctions
- Keep checks to "env" files

This also syncs the spdxcheck.py tool and all the associated documentation.

---
 doc/develop/checkpatch.rst |  54 ++--
 scripts/checkpatch.pl      | 525 +++++++++++++++++++++++++++++--------
 scripts/spdxcheck.py       | 186 ++++++++++++-
 3 files changed, 616 insertions(+), 149 deletions(-)
doc/develop/checkpatch.rst +32 -22
index b52452bc296..d5c47e56032 100644
@@ -168,7 +168,7 @@ Available options:
 
  - --fix
 
-   This is an EXPERIMENTAL feature.  If correctable errors exists, a file
+   This is an EXPERIMENTAL feature.  If correctable errors exist, a file
    <inputfile>.EXPERIMENTAL-checkpatch-fixes is created which has the
    automatically fixable errors corrected.
 
@@ -181,7 +181,7 @@ Available options:
 
  - --ignore-perl-version
 
-   Override checking of perl version.  Runtime errors maybe encountered after
+   Override checking of perl version.  Runtime errors may be encountered after
    enabling this flag if the perl version does not meet the minimum specified.
 
  - --codespell
@@ -342,24 +342,6 @@ API usage
 
     See: https://www.kernel.org/doc/html/latest/RCU/whatisRCU.html#full-list-of-rcu-apis
 
-  **DEPRECATED_VARIABLE**
-    EXTRA_{A,C,CPP,LD}FLAGS are deprecated and should be replaced by the new
-    flags added via commit f77bf01425b1 ("kbuild: introduce ccflags-y,
-    asflags-y and ldflags-y").
-
-    The following conversion scheme maybe used::
-
-      EXTRA_AFLAGS    ->  asflags-y
-      EXTRA_CFLAGS    ->  ccflags-y
-      EXTRA_CPPFLAGS  ->  cppflags-y
-      EXTRA_LDFLAGS   ->  ldflags-y
-
-    See:
-
-      1. https://lore.kernel.org/lkml/[email protected]/
-      2. https://lore.kernel.org/lkml/[email protected]/
-      3. https://www.kernel.org/doc/html/latest/kbuild/makefiles.html#compilation-flags
-
   **DEVICE_ATTR_FUNCTIONS**
     The function names used in DEVICE_ATTR is unusual.
     Typically, the store and show functions are used with <attr>_store and
@@ -470,8 +452,6 @@ API usage
     usleep_range() should be preferred over udelay(). The proper way of
     using usleep_range() is mentioned in the kernel docs.
 
-    See: https://www.kernel.org/doc/html/latest/timers/timers-howto.html#delays-information-on-the-various-kernel-delay-sleep-mechanisms
-
 
 Comments
 --------
@@ -515,6 +495,15 @@ Comments
 
     See: https://lore.kernel.org/lkml/20131006222342.GT19510@leaf/
 
+  **UNCOMMENTED_RGMII_MODE**
+    Historically, the RGMII PHY modes specified in Device Trees have been
+    used inconsistently, often referring to the usage of delays on the PHY
+    side rather than describing the board.
+
+    PHY modes "rgmii", "rgmii-rxid" and "rgmii-txid" modes require the clock
+    signal to be delayed on the PCB; this unusual configuration should be
+    described in a comment. If they are not (meaning that the delay is realized
+    internally in the MAC or PHY), "rgmii-id" is the correct PHY mode.
 
 Commit message
 --------------
@@ -612,6 +601,13 @@ Commit message
 
     See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
 
+  **BAD_FIXES_TAG**
+    The Fixes: tag is malformed or does not follow the community conventions.
+    This can occur if the tag have been split into multiple lines (e.g., when
+    pasted in an email program with word wrapping enabled).
+
+    See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
+
 
 Comparison style
 ----------------
@@ -899,6 +895,20 @@ Macros, Attributes and Symbols
 
     See: https://lore.kernel.org/lkml/1399671106.2912.21.camel@joe-AO725/
 
+  **MACRO_ARG_UNUSED**
+    If function-like macros do not utilize a parameter, it might result
+    in a build warning. We advocate for utilizing static inline functions
+    to replace such macros.
+    For example, for a macro such as the one below::
+
+      #define test(a) do { } while (0)
+
+    there would be a warning like below::
+
+      WARNING: Argument 'a' is not used in function-like macro.
+
+    See: https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl
+
   **SINGLE_STATEMENT_DO_WHILE_MACRO**
     For the multi-statement macros, it is necessary to use the do-while
     loop to avoid unpredictable code paths. The do-while loop helps to
scripts/checkpatch.pl +411 -114

972 lines not on this page · raw message

scripts/spdxcheck.py +173 -13

277 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw
Quoted 8 lines · Kory Maincent

This resyncs us with the version found in v6.17 of the Linux kernel with the following exceptions:
- Keep our u-boot specific tests / code area.
- Keep the location of our checkpatch.rst
- Change the "use strscpy" test as we don't have that to strlcpy
- Keep debug/printf in the list for $logFunctions
- Keep checks to "env" files

Quoted 4 lines

This also syncs the spdxcheck.py tool and all the associated documentation.

I forgot to mention:
commit 0fd7ee0306a88bd99d3820167fa45a7ee6fbc1e1

Author: Tom Rini <[email protected]>
Date:   Wed Feb 26 09:33:45 2025 -0600

scripts/checkpatch.pl: Upgrade IS_ENABLED_CONFIG to error for U-Boot

A problem we have today is that some instances of IS_ENABLED(FOO) have crept in to the code. This is in turn because with checkpatch.pl this is only a warning and not an error, so they were overlooked. And looking deeper, in the Linux kernel this pattern is allowed because IS_ENABLED(DEFINED_FLAG) is allowed if discouraged and a quick skim of the instances I saw in the current kernel follow this pattern. In U-Boot however, this is not allowed, so bump to an error.

earlier, sorry. But it's easy to not undo this change, so barring other comments I'll just fix that when applying.

Thanks for doing the resync!

Signature · 1 line
Tom
#2 lore raw
In reply to Kory Maincent
Quoted 9 lines · Kory Maincent

This resyncs us with the version found in v6.17 of the Linux kernel with the following exceptions:
- Keep our u-boot specific tests / code area.
- Keep the location of our checkpatch.rst
- Change the "use strscpy" test as we don't have that to strlcpy
- Keep debug/printf in the list for $logFunctions
- Keep checks to "env" files

[...]

Applied to u-boot/master, thanks!

[1/1] scripts/checkpatch.pl: Resync with v6.17

      commit: ddde9ac63d71a4336e27cb49d011b67c7e5255c5
Signature · 1 line
Tom