[PATCH v3 27/30] docs: kdoc_parser: minimize differences with struct_group_tagged

Mauro Carvalho Chehab posted 30 patches 1 week, 3 days ago
There is a newer version of this series
[PATCH v3 27/30] docs: kdoc_parser: minimize differences with struct_group_tagged
Posted by Mauro Carvalho Chehab 1 week, 3 days ago
While the previous version does a better job representing
the actual struct, it ends losing documentation from each
member.

Change the replacements to minimize such changes. With that,
the only differences before/after using NestedMatch new
replacement logic are (at man page output):

    --- before.log  2026-01-29 06:14:20.163592584 +0100
    +++ after.log   2026-01-29 06:32:04.811370234 +0100
    @@ -1573701 +1573701 @@
    -.BI "    struct ice_health_tx_hang_buf  tx_hang_buf;"
    +.BI "    struct ice_health_tx_hang_buf tx_hang_buf;"
    @@ -4156451 +4156451 @@
    -.BI "    struct libeth_fq_fp  fp;"
    +.BI "    struct libeth_fq_fp fp;"
    @@ -4164041 +4164041 @@
    -.BI "    struct libeth_xskfq_fp  fp;"
    +.BI "    struct libeth_xskfq_fp fp;"
    @@ -4269434 +4269434 @@
    -.BI "    struct page_pool_params_fast  fast;"
    +.BI "    struct page_pool_params_fast fast;"
    @@ -4269452 +4269452 @@
    -.BI "    struct page_pool_params_slow  slow;"
    +.BI "    struct page_pool_params_slow slow;"
    @@ -4269454 +4269454 @@
    -.BI "    STRUCT_GROUP( struct net_device *netdev;"
    +.BI "    struct net_device *netdev;"

e.g. basically whitespaces, plus a fix NestedMatch to
better handle /* private */ comments.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 tools/lib/python/kdoc/kdoc_parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/python/kdoc/kdoc_parser.py b/tools/lib/python/kdoc/kdoc_parser.py
index 50d57c6799bb..1e8e156e2a9e 100644
--- a/tools/lib/python/kdoc/kdoc_parser.py
+++ b/tools/lib/python/kdoc/kdoc_parser.py
@@ -126,7 +126,7 @@ struct_xforms = [
     #
     (CFunction('struct_group'), r'\2'),
     (CFunction('struct_group_attr'), r'\3'),
-    (CFunction('struct_group_tagged'), r'struct \1 { \3 } \2;'),
+    (CFunction('struct_group_tagged'), r'struct \1 \2; \3'),
     (CFunction('__struct_group'), r'\4'),
 
     #
-- 
2.52.0
RE: [Intel-wired-lan] [PATCH v3 27/30] docs: kdoc_parser: minimize differences with struct_group_tagged
Posted by Loktionov, Aleksandr 1 week, 3 days ago

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Mauro Carvalho Chehab
> Sent: Thursday, January 29, 2026 9:08 AM
> To: Lobakin, Aleksander <aleksander.lobakin@intel.com>; Jonathan
> Corbet <corbet@lwn.net>; Linux Doc Mailing List <linux-
> doc@vger.kernel.org>
> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>;
> bpf@vger.kernel.org; intel-wired-lan@lists.osuosl.org; linux-
> hardening@vger.kernel.org; linux-kernel@vger.kernel.org;
> netdev@vger.kernel.org; Mauro Carvalho Chehab <mchehab@kernel.org>;
> Randy Dunlap <rdunlap@infradead.org>
> Subject: [Intel-wired-lan] [PATCH v3 27/30] docs: kdoc_parser:
> minimize differences with struct_group_tagged
> 
> While the previous version does a better job representing the actual
> struct, it ends losing documentation from each member.
> 
> Change the replacements to minimize such changes. With that, the only
> differences before/after using NestedMatch new replacement logic are
> (at man page output):
> 
>     --- before.log  2026-01-29 06:14:20.163592584 +0100
>     +++ after.log   2026-01-29 06:32:04.811370234 +0100
>     @@ -1573701 +1573701 @@
>     -.BI "    struct ice_health_tx_hang_buf  tx_hang_buf;"
>     +.BI "    struct ice_health_tx_hang_buf tx_hang_buf;"
>     @@ -4156451 +4156451 @@
>     -.BI "    struct libeth_fq_fp  fp;"
>     +.BI "    struct libeth_fq_fp fp;"
>     @@ -4164041 +4164041 @@
>     -.BI "    struct libeth_xskfq_fp  fp;"
>     +.BI "    struct libeth_xskfq_fp fp;"
>     @@ -4269434 +4269434 @@
>     -.BI "    struct page_pool_params_fast  fast;"
>     +.BI "    struct page_pool_params_fast fast;"
>     @@ -4269452 +4269452 @@
>     -.BI "    struct page_pool_params_slow  slow;"
>     +.BI "    struct page_pool_params_slow slow;"
>     @@ -4269454 +4269454 @@
>     -.BI "    STRUCT_GROUP( struct net_device *netdev;"
>     +.BI "    struct net_device *netdev;"
> 
> e.g. basically whitespaces, plus a fix NestedMatch to better handle /*
> private */ comments.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
>  tools/lib/python/kdoc/kdoc_parser.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/lib/python/kdoc/kdoc_parser.py
> b/tools/lib/python/kdoc/kdoc_parser.py
> index 50d57c6799bb..1e8e156e2a9e 100644
> --- a/tools/lib/python/kdoc/kdoc_parser.py
> +++ b/tools/lib/python/kdoc/kdoc_parser.py
> @@ -126,7 +126,7 @@ struct_xforms = [
>      #
>      (CFunction('struct_group'), r'\2'),
>      (CFunction('struct_group_attr'), r'\3'),
> -    (CFunction('struct_group_tagged'), r'struct \1 { \3 } \2;'),
> +    (CFunction('struct_group_tagged'), r'struct \1 \2; \3'),
>      (CFunction('__struct_group'), r'\4'),
> 
>      #
> --
> 2.52.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>