[PATCH 1/9] docs: kdoc: simplify the PROTO continuation logic

Jonathan Corbet posted 9 patches 8 months, 1 week ago
[PATCH 1/9] docs: kdoc: simplify the PROTO continuation logic
Posted by Jonathan Corbet 8 months, 1 week ago
Remove the unneeded "cont" variable and tighten up the code slightly.

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

diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
index 062453eefc7a..b193cf9dc0d1 100644
--- a/scripts/lib/kdoc/kdoc_parser.py
+++ b/scripts/lib/kdoc/kdoc_parser.py
@@ -1680,7 +1680,6 @@ class KernelDoc:
         Besides parsing kernel-doc tags, it also parses export symbols.
         """
 
-        cont = False
         prev = ""
         prev_ln = None
         export_table = set()
@@ -1696,18 +1695,14 @@ class KernelDoc:
                     if self.state == state.PROTO:
                         if line.endswith("\\"):
                             prev += line.rstrip("\\")
-                            cont = True
-
                             if not prev_ln:
                                 prev_ln = ln
-
                             continue
 
-                        if cont:
+                        if prev:
                             ln = prev_ln
                             line = prev + line
                             prev = ""
-                            cont = False
                             prev_ln = None
 
                     self.config.log.debug("%d %s%s: %s",
-- 
2.49.0
Re: [PATCH 1/9] docs: kdoc: simplify the PROTO continuation logic
Posted by Mauro Carvalho Chehab 8 months, 1 week ago
Em Fri,  6 Jun 2025 10:34:30 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> Remove the unneeded "cont" variable and tighten up the code slightly.
> 
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>

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

> ---
>  scripts/lib/kdoc/kdoc_parser.py | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index 062453eefc7a..b193cf9dc0d1 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -1680,7 +1680,6 @@ class KernelDoc:
>          Besides parsing kernel-doc tags, it also parses export symbols.
>          """
>  
> -        cont = False
>          prev = ""
>          prev_ln = None
>          export_table = set()
> @@ -1696,18 +1695,14 @@ class KernelDoc:
>                      if self.state == state.PROTO:
>                          if line.endswith("\\"):
>                              prev += line.rstrip("\\")
> -                            cont = True
> -
>                              if not prev_ln:
>                                  prev_ln = ln
> -
>                              continue
>  
> -                        if cont:
> +                        if prev:
>                              ln = prev_ln
>                              line = prev + line
>                              prev = ""
> -                            cont = False
>                              prev_ln = None
>  
>                      self.config.log.debug("%d %s%s: %s",



Thanks,
Mauro