From: Randy Dunlap <rdunlap@infradead.org>
To: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
Cc: corbet@lwn.net, skhan@linuxfoundation.org, mchehab@kernel.org,
aleksander.lobakin@intel.com, aleksandr.loktionov@intel.com,
tudor.ambarus@linaro.org, bvanassche@acm.org, takano32@gmail.com
Subject: Re: [PATCH v3] docs: kdoc: fix struct_group_tagged() parsing regression
Date: Sun, 29 Nov 2026 21:13:02 -0800 [thread overview]
Message-ID: <c3ca578f-042d-4343-a87d-2e0456c65c86@infradead.org> (raw)
In-Reply-To: <20261129114700.12614-1-emmaonana18@gmail.com>
On 11/29/26 3:46 AM, Omokefe Emmanuel Onanaroghene wrote:
> kernel-doc reports struct_group_tagged() members as excess because
> the macro transformation rewrites it to an anonymous struct and drops their
> member names.
>
> Keep the tag and member name when transforming struct_group_tagged(). The
> nested members are then recorded as names such as fast.order; accept the
> existing unqualified @order documentation tag during validation.
>
> Add a regression test based on struct page_pool_params.
>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Link: https://lore.kernel.org/all/0cf8ea5f-418f-45f0-907c-3d1ed4f03e9f@infradead.org/
> Fixes: 2f07ddbd5793 ("docs: xforms_lists: better evaluate struct_group macros")
> Assisted-by: LLM
> Tested-by: TAKANO Mitsuhiro <takano32@gmail.com>
> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
WorksForMe. Thanks.
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
>
> ---
> tools/lib/python/kdoc/kdoc_parser.py | 4 ++-
> tools/lib/python/kdoc/xforms_lists.py | 2 +-
> tools/unittests/test_kdoc_parser.py | 37 +++++++++++++++++++++++++++
> 3 files changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/python/kdoc/kdoc_parser.py b/tools/lib/python/kdoc/kdoc_parser.py
> index 80d4245acd172..54b4b7bb32de4 100644
> --- a/tools/lib/python/kdoc/kdoc_parser.py
> +++ b/tools/lib/python/kdoc/kdoc_parser.py
> @@ -635,7 +635,9 @@ class KernelDoc:
> continue
> if param_name.startswith("{unnamed_"):
> continue
> - if param_name in self.entry.parameterlist:
> + if param_name in self.entry.parameterlist or \
> + any(actual.endswith('.' + param_name)
> + for actual in self.entry.parameterlist):
> continue
>
> hint = self.get_suggestions_hint(param_name, self.entry.parameterlist)
> diff --git a/tools/lib/python/kdoc/xforms_lists.py b/tools/lib/python/kdoc/xforms_lists.py
> index db23fb650ea85..a4c5b111d191f 100644
> --- a/tools/lib/python/kdoc/xforms_lists.py
> +++ b/tools/lib/python/kdoc/xforms_lists.py
> @@ -62,7 +62,7 @@ class CTransforms:
> #
> (CMatch("struct_group"), r"struct { \2+ };"),
> (CMatch("struct_group_attr"), r"struct { \3+ };"),
> - (CMatch("struct_group_tagged"), r"struct { \3+ };"),
> + (CMatch("struct_group_tagged"), r"struct \1 { \3+ } \2;"),
> (CMatch("__struct_group"), r"struct { \4+ };"),
> (CMatch("context_lock_struct"), r"struct \1"),
> ]
> diff --git a/tools/unittests/test_kdoc_parser.py b/tools/unittests/test_kdoc_parser.py
> index 4baa78ca02b3f..d31967262d639 100755
> --- a/tools/unittests/test_kdoc_parser.py
> +++ b/tools/unittests/test_kdoc_parser.py
> @@ -444,6 +444,43 @@ class TestContextLockStruct(GenerateKdocItem):
> self.assertEqual(entries[0].name, "debugfs_cancellation")
> self.assertEqual(entries[0].warnings, [])
>
> +
> +class TestStructGroupTagged(GenerateKdocItem):
> + def test_nested_struct_group_tagged_members(self):
> + source = """
> + /**
> + * struct page_pool_params - page pool parameters
> + * @fast: Fast path parameters.
> + * @order: Order of pages.
> + * @pool_size: Number of pages.
> + * @slow: Slow path parameters.
> + * @netdev: Net device pointer.
> + * @queue_idx: Queue index.
> + * @flags: Flags.
> + */
> + struct page_pool_params {
> + struct_group_tagged(page_pool_params_fast, fast,
> + unsigned int order;
> + unsigned int pool_size;
> + );
> + struct_group_tagged(page_pool_params_slow, slow,
> + struct net_device *netdev;
> + unsigned int queue_idx;
> + unsigned int flags;
> + );
> + };
> + """
> +
> + kernel_doc = KernelDoc(self.config, "test.c", self.xforms)
> + patcher = patch('builtins.open', new_callable=mock_open,
> + read_data=dedent(source))
> + with patcher:
> + _, entries = kernel_doc.parse_kdoc()
> +
> + self.assertEqual(len(entries), 1)
> + self.assertEqual(entries[0].warnings, [])
> +
> +
> #
> # Class and logic to create dynamic tests from YAML
> #
>
> base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
--
~Randy
next prev parent reply other threads:[~2026-11-30 5:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 11:46 Omokefe Emmanuel Onanaroghene
2026-11-30 5:13 ` Randy Dunlap [this message]
2026-12-02 19:47 ` Jonathan Corbet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3ca578f-042d-4343-a87d-2e0456c65c86@infradead.org \
--to=rdunlap@infradead.org \
--cc=aleksander.lobakin@intel.com \
--cc=aleksandr.loktionov@intel.com \
--cc=bvanassche@acm.org \
--cc=corbet@lwn.net \
--cc=emmaonana18@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=takano32@gmail.com \
--cc=tudor.ambarus@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®