mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Fix false positive check for dt-binding docs and include
@ 2025-12-25  1:41 Alex Tran
  2026-01-03  9:24 ` Bagas Sanjaya
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Tran @ 2025-12-25  1:41 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
  Cc: linux-kernel, Alex Tran

The check for when to display a DT_SPLIT_BINDING_PATCH warning
is performed on all files that are not MAINTAINERS files.
This causes issues, specifically when checking against a
patch that only touches docs/dt-bindings or a patch that
only touches include/dt-bindings. The warning is still
displayed when it should not be, giving false positives.

The check for when to issue a DT_SPLIT_BINDING_PATCH warning
is currently too pervasive and should only be performed when
a change under docs/dt-bindings is detected or include/dt-bindings.
If the current changed file is under include/dt-bindings or
docs/dt-bindings then it is compared to the last file detected
under include/dt-bindings or docs/dt-bindings. If there is a
difference then a warning is issued.

Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
---
 scripts/checkpatch.pl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c0250244cf7a3cb5e289b04fa4a9f644692dc278..fe3499bc9adda158c88231b48b3b0100f3af0ee1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2668,7 +2668,7 @@ sub process {
 	my $authorsignoff = 0;
 	my $author_sob = '';
 	my $is_patch = 0;
-	my $is_binding_patch = -1;
+	my $is_doc_binding_patch = -1;
 	my $in_header_lines = $file ? 0 : 1;
 	my $in_commit_log = 0;		#Scanning lines before patch
 	my $has_patch_separator = 0;	#Found a --- line
@@ -2924,13 +2924,13 @@ sub process {
 			}
 			$checklicenseline = 1;
 
-			if ($realfile !~ /^MAINTAINERS/) {
-				my $last_binding_patch = $is_binding_patch;
+			if ($realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@) {
+				my $last_binding_patch_is_doc = $is_doc_binding_patch;
 
-				$is_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@;
+				$is_doc_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/)@;
 
-				if (($last_binding_patch != -1) &&
-				    ($last_binding_patch ^ $is_binding_patch)) {
+				if (($last_binding_patch_is_doc != -1) &&
+				    ($last_binding_patch_is_doc ^ $is_doc_binding_patch)) {
 					WARN("DT_SPLIT_BINDING_PATCH",
 					     "DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst\n");
 				}

---
base-commit: fa084c35afa13ab07a860ef0936cd987f9aa0460
change-id: 20251224-checkscript_dt_bindings_fp-0e5938f6d274

Best regards,
-- 
Alex Tran <alex.t.tran@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: Fix false positive check for dt-binding docs and include
  2025-12-25  1:41 [PATCH] checkpatch: Fix false positive check for dt-binding docs and include Alex Tran
@ 2026-01-03  9:24 ` Bagas Sanjaya
  2026-01-04 11:34   ` Alex Tran
  0 siblings, 1 reply; 3+ messages in thread
From: Bagas Sanjaya @ 2026-01-03  9:24 UTC (permalink / raw)
  To: Alex Tran, Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
  Cc: linux-kernel, devicetree, Rob Herring, Krzysztof Kozlowski, Conor Dooley

[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]

[CC'ing devicetree people]

On Wed, Dec 24, 2025 at 05:41:17PM -0800, Alex Tran wrote:
> The check for when to display a DT_SPLIT_BINDING_PATCH warning
> is performed on all files that are not MAINTAINERS files.
> This causes issues, specifically when checking against a
> patch that only touches docs/dt-bindings or a patch that
> only touches include/dt-bindings. The warning is still
> displayed when it should not be, giving false positives.
> 
> The check for when to issue a DT_SPLIT_BINDING_PATCH warning
> is currently too pervasive and should only be performed when
> a change under docs/dt-bindings is detected or include/dt-bindings.
> If the current changed file is under include/dt-bindings or
> docs/dt-bindings then it is compared to the last file detected
> under include/dt-bindings or docs/dt-bindings. If there is a
> difference then a warning is issued.

Can you elaborate on example of where this issue occurs?
I'm still confused...

> 
> Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
> ---
>  scripts/checkpatch.pl | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index c0250244cf7a3cb5e289b04fa4a9f644692dc278..fe3499bc9adda158c88231b48b3b0100f3af0ee1 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2668,7 +2668,7 @@ sub process {
>  	my $authorsignoff = 0;
>  	my $author_sob = '';
>  	my $is_patch = 0;
> -	my $is_binding_patch = -1;
> +	my $is_doc_binding_patch = -1;
>  	my $in_header_lines = $file ? 0 : 1;
>  	my $in_commit_log = 0;		#Scanning lines before patch
>  	my $has_patch_separator = 0;	#Found a --- line
> @@ -2924,13 +2924,13 @@ sub process {
>  			}
>  			$checklicenseline = 1;
>  
> -			if ($realfile !~ /^MAINTAINERS/) {
> -				my $last_binding_patch = $is_binding_patch;
> +			if ($realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@) {
> +				my $last_binding_patch_is_doc = $is_doc_binding_patch;
>  
> -				$is_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@;
> +				$is_doc_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/)@;
>  
> -				if (($last_binding_patch != -1) &&
> -				    ($last_binding_patch ^ $is_binding_patch)) {
> +				if (($last_binding_patch_is_doc != -1) &&
> +				    ($last_binding_patch_is_doc ^ $is_doc_binding_patch)) {
>  					WARN("DT_SPLIT_BINDING_PATCH",
>  					     "DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst\n");
>  				}
> 

I can't say for the actuall diff, though.

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: Fix false positive check for dt-binding docs and include
  2026-01-03  9:24 ` Bagas Sanjaya
@ 2026-01-04 11:34   ` Alex Tran
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Tran @ 2026-01-04 11:34 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn,
	linux-kernel, devicetree, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley

On Sat, Jan 3, 2026 at 1:24 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
>
> [CC'ing devicetree people]
>
> On Wed, Dec 24, 2025 at 05:41:17PM -0800, Alex Tran wrote:
> > The check for when to display a DT_SPLIT_BINDING_PATCH warning
> > is performed on all files that are not MAINTAINERS files.
> > This causes issues, specifically when checking against a
> > patch that only touches docs/dt-bindings or a patch that
> > only touches include/dt-bindings. The warning is still
> > displayed when it should not be, giving false positives.
> >
> > The check for when to issue a DT_SPLIT_BINDING_PATCH warning
> > is currently too pervasive and should only be performed when
> > a change under docs/dt-bindings is detected or include/dt-bindings.
> > If the current changed file is under include/dt-bindings or
> > docs/dt-bindings then it is compared to the last file detected
> > under include/dt-bindings or docs/dt-bindings. If there is a
> > difference then a warning is issued.
>
> Can you elaborate on example of where this issue occurs?
> I'm still confused...

I recently submitted a patch that converted a dt-binding from txt to
yaml format. The patch included the deletion of a txt file and the
addition of a yaml file under Documentation/devicetree. No files were
edited under the include/dt-bindings directory and yet the warning:
"DT binding docs and includes should be a separate patch.", was still
issued when running the checkpatch script.

> >
> > Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
> > ---
> >  scripts/checkpatch.pl | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index c0250244cf7a3cb5e289b04fa4a9f644692dc278..fe3499bc9adda158c88231b48b3b0100f3af0ee1 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -2668,7 +2668,7 @@ sub process {
> >       my $authorsignoff = 0;
> >       my $author_sob = '';
> >       my $is_patch = 0;
> > -     my $is_binding_patch = -1;
> > +     my $is_doc_binding_patch = -1;
> >       my $in_header_lines = $file ? 0 : 1;
> >       my $in_commit_log = 0;          #Scanning lines before patch
> >       my $has_patch_separator = 0;    #Found a --- line
> > @@ -2924,13 +2924,13 @@ sub process {
> >                       }
> >                     > > +                             my $last_binding_patch_is_doc = $is_doc_binding_patch;  $checklicenseline = 1;
> >
> > -                     if ($realfile !~ /^MAINTAINERS/) {
> > -                             my $last_binding_patch = $is_binding_patch;
> > +                     if ($realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@) {
> > +                             my $last_binding_patch_is_doc = $is_doc_binding_patch;
> >
> > -                             $is_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@;
> > +                             $is_doc_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/)@;
> >
> > -                             if (($last_binding_patch != -1) &&
> > -                                 ($last_binding_patch ^ $is_binding_patch)) {
> > +                             if (($last_binding_patch_is_doc != -1) &&
> > +                                 ($last_binding_patch_is_doc ^ $is_doc_binding_patch)) {
> >                                       WARN("DT_SPLIT_BINDING_PATCH",
> >                                            "DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst\n");
> >                               }
> >
>
> I can't say for the actuall diff, though.
The diff is changing when the warning should be issued; If the current
file is under docs/dt-bindings or include/dt-bindings then it checks
if the last bindings file was a docs dt-binding file. And compares it
with the current file. If there is a mismatch then the current file
must be under include/dt-bindings and the warning should be issued,
otherwise not.

--
Yours,
Alex Tran

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-04 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-25  1:41 [PATCH] checkpatch: Fix false positive check for dt-binding docs and include Alex Tran
2026-01-03  9:24 ` Bagas Sanjaya
2026-01-04 11:34   ` Alex Tran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®