[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <IA3PR11MB8986D9DA1AD0A85991E97D3FE59EA@IA3PR11MB8986.namprd11.prod.outlook.com>
Date: Thu, 29 Jan 2026 10:34:06 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>, Jonathan Corbet
<corbet@....net>, Linux Doc Mailing List <linux-doc@...r.kernel.org>
CC: "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>, Mauro Carvalho Chehab
<mchehab@...nel.org>, Randy Dunlap <rdunlap@...radead.org>
Subject: RE: [Intel-wired-lan] [PATCH v3 26/30] docs: kdoc_parser: use the new
CFunction class
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@...osl.org> On Behalf
> Of Mauro Carvalho Chehab
> Sent: Thursday, January 29, 2026 9:08 AM
> To: Jonathan Corbet <corbet@....net>; Linux Doc Mailing List <linux-
> doc@...r.kernel.org>
> Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>;
> bpf@...r.kernel.org; intel-wired-lan@...ts.osuosl.org; linux-
> hardening@...r.kernel.org; linux-kernel@...r.kernel.org;
> netdev@...r.kernel.org; Mauro Carvalho Chehab <mchehab@...nel.org>;
> Randy Dunlap <rdunlap@...radead.org>
> 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 <mchehab+huawei@...nel.org>
> ---
> 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 <aleksandr.loktionov@...el.com>
Powered by blists - more mailing lists