[PATCH 3/9] docs: kdoc: remove the section_intro variable

Jonathan Corbet posted 9 patches 8 months, 1 week ago
[PATCH 3/9] docs: kdoc: remove the section_intro variable
Posted by Jonathan Corbet 8 months, 1 week ago
It is only used in one place, so just put the constant string
"Introduction" there so people don't have to go looking for it.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
 scripts/lib/kdoc/kdoc_parser.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
index 37b7e501af7c..90b53b70cfee 100644
--- a/scripts/lib/kdoc/kdoc_parser.py
+++ b/scripts/lib/kdoc/kdoc_parser.py
@@ -203,7 +203,6 @@ class KernelDoc:
 
     # Section names
 
-    section_intro = "Introduction"
     section_context = "Context"
     section_return = "Return"
 
@@ -1207,7 +1206,7 @@ class KernelDoc:
             self.entry.new_start_line = ln
 
             if not doc_block.group(1):
-                self.entry.section = self.section_intro
+                self.entry.section = "Introduction"
             else:
                 self.entry.section = doc_block.group(1)
 
-- 
2.49.0
Re: [PATCH 3/9] docs: kdoc: remove the section_intro variable
Posted by Mauro Carvalho Chehab 8 months, 1 week ago
Em Fri,  6 Jun 2025 10:34:32 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> It is only used in one place, so just put the constant string
> "Introduction" there so people don't have to go looking for it.

Good catch! There were other places using it, but it sounds I
already cleanup its redundancy.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

> 
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
> ---
>  scripts/lib/kdoc/kdoc_parser.py | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index 37b7e501af7c..90b53b70cfee 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -203,7 +203,6 @@ class KernelDoc:
>  
>      # Section names
>  
> -    section_intro = "Introduction"
>      section_context = "Context"
>      section_return = "Return"
>  
> @@ -1207,7 +1206,7 @@ class KernelDoc:
>              self.entry.new_start_line = ln
>  
>              if not doc_block.group(1):
> -                self.entry.section = self.section_intro
> +                self.entry.section = "Introduction"
>              else:
>                  self.entry.section = doc_block.group(1)
>  



Thanks,
Mauro