[PATCH 22/38] docs: kdoc_re: fix a parse bug on struct page_pool_params

Mauro Carvalho Chehab
2026-02-18T10:13:26Z

The struct page_pool_params definition has a private
definition on it:

struct page_pool_params {
struct_group_tagged(page_pool_params_fast, fast,
unsigned int order;
unsigned int pool_size;
int nid;
struct device *dev;
struct napi_struct *napi;
enum dma_data_direction dma_dir;
unsigned int max_len;
unsigned int offset;
);
struct_group_tagged(page_pool_params_slow, slow,
struct net_device *netdev;
unsigned int queue_idx;
unsigned int flags;
/* private: used by test code only */
void (*init_callback)(netmem_ref netmem, void *arg);
void *init_arg;
);
};

This makes kernel-doc parser to miss the end parenthesis of
the second struct_group_tagged, causing documentation issues.

Address it by ensuring that, if are there anything at the stack,
it will be placed as the last part of the argument.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
tools/lib/python/kdoc/kdoc_re.py | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/tools/lib/python/kdoc/kdoc_re.py b/tools/lib/python/kdoc/kdoc_re.py
index 05f36d665b70..cdc842f5fc8f 100644
--- a/tools/lib/python/kdoc/kdoc_re.py
+++ b/tools/lib/python/kdoc/kdoc_re.py
@@ -201,6 +201,9 @@ class NestedMatch:
"""

stack = []
+ start = 0
+ offset = 0
+ pos = 0

for match_re in self.regex.finditer(line):
start = match_re.start()
@@ -250,6 +253,11 @@ class NestedMatch:
yield start, offset, pos + 1
break

+ # When /* private */ is used, it may end the end delimiterq
+ if stack:
+ stack.pop()
+ yield start, offset, len(line) + 1
+
def search(self, line):
"""
This is similar to re.search:
--
2.52.0