[PATCH v2 3/4] scripts/kernel-doc: ensure that comments are using our coding style

Mauro Carvalho Chehab posted 4 patches 3 weeks, 5 days ago
There is a newer version of this series
[PATCH v2 3/4] scripts/kernel-doc: ensure that comments are using our coding style
Posted by Mauro Carvalho Chehab 3 weeks, 5 days ago
Along kernel-doc libs, we opted to have all comments starting/ending
with a blank comment line. Use the same style here.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/kernel-doc.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py
index 5d2f29e90ebe..7ccee4626478 100755
--- a/scripts/kernel-doc.py
+++ b/scripts/kernel-doc.py
@@ -197,7 +197,9 @@ def main():
     parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
                                      description=DESC)
 
+    #
     # Normal arguments
+    #
 
     parser.add_argument("-v", "-verbose", "--verbose", action="store_true",
                         help="Verbose output, more warnings and other information.")
@@ -213,7 +215,9 @@ def main():
                         action="store_true",
                         help="Enable line number output (only in ReST mode)")
 
+    #
     # Arguments to control the warning behavior
+    #
 
     parser.add_argument("-Wreturn", "--wreturn", action="store_true",
                         help="Warns about the lack of a return markup on functions.")
@@ -235,7 +239,9 @@ def main():
     parser.add_argument("-export-file", "--export-file", action='append',
                         help=EXPORT_FILE_DESC)
 
+    #
     # Output format mutually-exclusive group
+    #
 
     out_group = parser.add_argument_group("Output format selection (mutually exclusive)")
 
@@ -248,7 +254,9 @@ def main():
     out_fmt.add_argument("-N", "-none", "--none", action="store_true",
                          help="Do not output documentation, only warnings.")
 
+    #
     # Output selection mutually-exclusive group
+    #
 
     sel_group = parser.add_argument_group("Output selection (mutually exclusive)")
     sel_mut = sel_group.add_mutually_exclusive_group()
@@ -262,7 +270,9 @@ def main():
     sel_mut.add_argument("-s", "-function", "--symbol", action='append',
                          help=FUNCTION_DESC)
 
+    #
     # Those are valid for all 3 types of filter
+    #
     parser.add_argument("-n", "-nosymbol", "--nosymbol", action='append',
                         help=NOSYMBOL_DESC)
 
@@ -295,9 +305,11 @@ def main():
 
     python_ver = sys.version_info[:2]
     if python_ver < (3,6):
+        #
         # Depending on Kernel configuration, kernel-doc --none is called at
         # build time. As we don't want to break compilation due to the
         # usage of an old Python version, return 0 here.
+        #
         if args.none:
             logger.error("Python 3.6 or later is required by kernel-doc. skipping checks")
             sys.exit(0)
@@ -307,7 +319,9 @@ def main():
     if python_ver < (3,7):
         logger.warning("Python 3.7 or later is required for correct results")
 
+    #
     # Import kernel-doc libraries only after checking Python version
+    #
     from kdoc.kdoc_files import KernelFiles             # pylint: disable=C0415
     from kdoc.kdoc_output import RestFormat, ManFormat  # pylint: disable=C0415
 
@@ -346,6 +360,8 @@ def main():
 
     sys.exit(0)
 
+#
 # Call main method
+#
 if __name__ == "__main__":
     main()
-- 
2.52.0
Re: [PATCH v2 3/4] scripts/kernel-doc: ensure that comments are using our coding style
Posted by Jonathan Corbet 3 weeks, 5 days ago
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:

> Along kernel-doc libs, we opted to have all comments starting/ending
> with a blank comment line. Use the same style here.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
>  scripts/kernel-doc.py | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py
> index 5d2f29e90ebe..7ccee4626478 100755
> --- a/scripts/kernel-doc.py
> +++ b/scripts/kernel-doc.py
> @@ -197,7 +197,9 @@ def main():
>      parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
>                                       description=DESC)
>  
> +    #
>      # Normal arguments
> +    #
>  
>      parser.add_argument("-v", "-verbose", "--verbose", action="store_true",
>                          help="Verbose output, more warnings and other information.")

[nit] I approve of this kind of change, but I would get rid of the extra
blank lines, just like we do with C code.

(I wouldn't redo the series just for this).

Thanks,

jon
Re: [PATCH v2 3/4] scripts/kernel-doc: ensure that comments are using our coding style
Posted by Mauro Carvalho Chehab 3 weeks, 5 days ago
On Mon, Jan 12, 2026 at 08:43:28AM -0700, Jonathan Corbet wrote:
> Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:
> 
> > Along kernel-doc libs, we opted to have all comments starting/ending
> > with a blank comment line. Use the same style here.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > ---
> >  scripts/kernel-doc.py | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py
> > index 5d2f29e90ebe..7ccee4626478 100755
> > --- a/scripts/kernel-doc.py
> > +++ b/scripts/kernel-doc.py
> > @@ -197,7 +197,9 @@ def main():
> >      parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
> >                                       description=DESC)
> >  
> > +    #
> >      # Normal arguments
> > +    #
> >  
> >      parser.add_argument("-v", "-verbose", "--verbose", action="store_true",
> >                          help="Verbose output, more warnings and other information.")
> 
> [nit] I approve of this kind of change, but I would get rid of the extra
> blank lines, just like we do with C code.

Ok. FYI, this is mostly to preserve the same coding style everywhere,
and we did a similar change at kdoc libs. At the initial versions of patch 2,
I wrote a new comment about why we needed to avoid error code > 255.

At v2, we're using a different approach, so no new comments are needed.

> (I wouldn't redo the series just for this).

Patch 4 depends on it, so what I can do - assuming that v2 doesn't need
rebase - is to send you a new patch to drop it extra blank lines.
Or, if this series needs another rebase, I'll fold such changes on it
for the next version.

> 
> Thanks,
> 
> jon

-- 
Thanks,
Mauro