[PATCH] checkpatch: don't warn about complex macros in i.MX pin header

Peng Fan (OSS) posted 1 patch 1 month, 3 weeks ago
scripts/checkpatch.pl | 1 +
1 file changed, 1 insertion(+)
[PATCH] checkpatch: don't warn about complex macros in i.MX pin header
Posted by Peng Fan (OSS) 1 month, 3 weeks ago
From: Peng Fan <peng.fan@nxp.com>

The pin function ID in i.MX pin headers is a tuple of <mux_reg conf_reg
input_reg mux_mode input_val>, as below:
"#define IMX95_PAD_DAP_TDI__JTAG_MUX_TDI  0x0000 0x0204 0x0610 0x00 0x00"
The pin headers are used by device trees, not drivers.

checkpatch erroneously flags it as error:
  ERROR: Macros with complex values should be enclosed in parentheses

Bypass the check for pin header files with file names imx[*]-pinfunc.h.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c0250244cf7a3cb5e289b04fa4a9f644692dc278..5e91698cb90751ae1f575b3d8094a3f6aa4ee3c6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5937,6 +5937,7 @@ sub process {
 # (0) loop.  Grab the first statement and ensure its the whole macro
 # if its not enclosed in a known good container
 		if ($realfile !~ m@/vmlinux.lds.h$@ &&
+		    $realfile !~ m@/imx\d+-pinfunc\.h$@ &&
 		    $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
 			my $ln = $linenr;
 			my $cnt = $realcnt;

---
base-commit: 563c8dd425b59e44470e28519107b1efc99f4c7b
change-id: 20251216-checkpatch-45226f317299

Best regards,
-- 
Peng Fan <peng.fan@nxp.com>
Re: [PATCH] checkpatch: don't warn about complex macros in i.MX pin header
Posted by Joe Perches 1 month, 3 weeks ago
On 2025-12-16 15:32, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> The pin function ID in i.MX pin headers is a tuple of <mux_reg conf_reg
> input_reg mux_mode input_val>, as below:
> "#define IMX95_PAD_DAP_TDI__JTAG_MUX_TDI  0x0000 0x0204 0x0610 0x00 
> 0x00"
> The pin headers are used by device trees, not drivers.

Nak.  Just ignore the message instead.

There would be _far_ too many exceptions to add individually to 
checkpatch.