> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf
> Of Mauro Carvalho Chehab
> Sent: Thursday, January 29, 2026 9:08 AM
> To: Jonathan Corbet <[email protected]>; Linux Doc Mailing List <linux-
> [email protected]>
> Cc: Mauro Carvalho Chehab <[email protected]>;
> [email protected]; [email protected]; linux-
> [email protected]; [email protected];
> [email protected]; Mauro Carvalho Chehab <[email protected]>;
> Randy Dunlap <[email protected]>
> Subject: [Intel-wired-lan] [PATCH v3 26/30] docs: kdoc_parser: use the
> new CFunction class
> 
> The match logic for transforms becomes a lot clearer if we use
> CFunction convenient alias class instead of NestedMatch.
> 
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
> ---
>  tools/lib/python/kdoc/kdoc_parser.py | 38 ++++++++++++++-------------
> -
>  1 file changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/tools/lib/python/kdoc/kdoc_parser.py
> b/tools/lib/python/kdoc/kdoc_parser.py
> index d2eb93f9d489..50d57c6799bb 100644
> --- a/tools/lib/python/kdoc/kdoc_parser.py
> +++ b/tools/lib/python/kdoc/kdoc_parser.py
> @@ -13,7 +13,7 @@ import sys
>  import re
>  from pprint import pformat
> 
> -from kdoc.kdoc_re import NestedMatch, KernRe
> +from kdoc.kdoc_re import CFunction, KernRe
>  from kdoc.kdoc_item import KdocItem
> 
>  #
> @@ -119,22 +119,22 @@ struct_xforms = [
>      #
>      # As it doesn't properly match the end parenthesis on some cases.
>      #
> -    # So, a better solution was crafted: there's now a NestedMatch
> +    # So, a better solution was crafted: there's now a CFunction
>      # class that ensures that delimiters after a search are properly
>      # matched. So, the implementation to drop STRUCT_GROUP() will be
>      # handled in separate.
>      #
> -    (NestedMatch(r'\bstruct_group\s*\('), r'\2'),
> -    (NestedMatch(r'\bstruct_group_attr\s*\('), r'\3'),
> -    (NestedMatch(r'\bstruct_group_tagged\s*\('), r'struct \1 { \3 }
> \2;'),
> -    (NestedMatch(r'\b__struct_group\s*\('), r'\4'),
> +    (CFunction('struct_group'), r'\2'),
> +    (CFunction('struct_group_attr'), r'\3'),
> +    (CFunction('struct_group_tagged'), r'struct \1 { \3 } \2;'),
> +    (CFunction('__struct_group'), r'\4'),
> 
>      #
>      # Replace macros
>      #
> -    # TODO: use NestedMatch for FOO($1, $2, ...) matches
> +    # TODO: use CFunction on all FOO($1, $2, ...) matches
>      #
> -    # it is better to also move those to the NestedMatch logic,
> +    # it is better to also move those to the CFunction logic,
>      # to ensure that parentheses will be properly matched.
>      #
>      (KernRe(r'__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)',
> re.S), @@ -185,17 +185,17 @@ function_xforms = [
>      (KernRe(r"DECL_BUCKET_PARAMS\s*\(\s*(\S+)\s*,\s*(\S+)\s*\)"),
> r"\1, \2"),
>      (KernRe(r"__no_context_analysis\s*"), ""),
>      (KernRe(r"__attribute_const__ +"), ""),
> -    (NestedMatch(r"__cond_acquires\s*\("), ""),
> -    (NestedMatch(r"__cond_releases\s*\("), ""),
> -    (NestedMatch(r"__acquires\s*\("), ""),
> -    (NestedMatch(r"__releases\s*\("), ""),
> -    (NestedMatch(r"__must_hold\s*\("), ""),
> -    (NestedMatch(r"__must_not_hold\s*\("), ""),
> -    (NestedMatch(r"__must_hold_shared\s*\("), ""),
> -    (NestedMatch(r"__cond_acquires_shared\s*\("), ""),
> -    (NestedMatch(r"__acquires_shared\s*\("), ""),
> -    (NestedMatch(r"__releases_shared\s*\("), ""),
> -    (NestedMatch(r"__attribute__\s*\("), ""),
> +    (CFunction("__cond_acquires"), ""),
> +    (CFunction("__cond_releases"), ""),
> +    (CFunction("__acquires"), ""),
> +    (CFunction("__releases"), ""),
> +    (CFunction("__must_hold"), ""),
> +    (CFunction("__must_not_hold"), ""),
> +    (CFunction("__must_hold_shared"), ""),
> +    (CFunction("__cond_acquires_shared"), ""),
> +    (CFunction("__acquires_shared"), ""),
> +    (CFunction("__releases_shared"), ""),
> +    (CFunction("__attribute__"), ""),
>  ]
> 
>  #
> --
> 2.52.0

Reviewed-by: Aleksandr Loktionov <[email protected]>

Reply via email to