From: Jani Nikula <jani.nikula@linux.intel.com>
To: Shuicheng Lin <shuicheng.lin@intel.com>,
linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org
Cc: Shuicheng Lin <shuicheng.lin@intel.com>, linux-doc@vger.kernel.org
Subject: Re: [PATCH] scripts/kernel-doc: Detect mismatched inline member documentation tags
Date: Tue, 28 Apr 2026 11:12:23 +0300 [thread overview]
Message-ID: <0cd899be469b13ed4e6738ce8eb8716081c22d8c@intel.com> (raw)
In-Reply-To: <20260415215032.3398330-1-shuicheng.lin@intel.com>
On Wed, 15 Apr 2026, Shuicheng Lin <shuicheng.lin@intel.com> wrote:
> Add validation in check_sections() to verify that inline member
> documentation tags (/** @member: description */) match actual struct/union
> member names. Previously, kernel-doc only validated section headers against
> the parameter list, but inline doc tags stored in parameterdescs were never
> cross-checked, allowing stale or mistyped member names to go undetected.
>
> The new check iterates over parameterdescs keys and warns about any that
> don't appear in the parameter list, catching issues like renamed struct
> members where the documentation tag was not updated to match.
>
> This catches real issues such as:
> - xe_bo_types.h: @atomic_access (missing struct prefix, should be
> @attr.atomic_access)
> - xe_device_types.h: @usm.asid (member is actually asid_to_vm)
>
> Assisted-by: Claude:claude-opus-4.6
> Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Cc: linux-doc@vger.kernel.org
> ---
> tools/lib/python/kdoc/kdoc_parser.py | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/tools/lib/python/kdoc/kdoc_parser.py b/tools/lib/python/kdoc/kdoc_parser.py
> index ca00695b47b3..f21f06c0a9b0 100644
> --- a/tools/lib/python/kdoc/kdoc_parser.py
> +++ b/tools/lib/python/kdoc/kdoc_parser.py
> @@ -673,6 +673,31 @@ class KernelDoc:
> self.emit_msg(ln,
> f"Excess {dname} '{section}' description in '{decl_name}'")
>
> + #
> + # Check that documented parameter names (from doc comments, including
> + # inline ``/** @member: */`` tags) actually match real members in
> + # the declaration. This catches mismatched or stale kernel-doc
> + # member tags that don't correspond to any actual struct/union
> + # member or function parameter.
> + #
> + for param_name, desc in self.entry.parameterdescs.items():
> + # Skip auto-generated entries from push_parameter()
> + if desc == self.undescribed:
> + continue
> + if desc in ("no arguments", "anonymous\n", "variable arguments"):
> + continue
> + if param_name.startswith("{unnamed_"):
> + continue
> + if param_name in self.entry.parameterlist:
> + continue
> +
> + if decl_type == 'function':
> + dname = f"{decl_type} parameter"
> + else:
> + dname = f"{decl_type} member"
> + self.emit_msg(ln,
> + f"Excess {dname} '{param_name}' description in '{decl_name}'")
> +
> def check_return_section(self, ln, declaration_name, return_type):
> """
> If the function doesn't return void, warns about the lack of a
--
Jani Nikula, Intel
next prev parent reply other threads:[~2026-04-28 8:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 21:50 [PATCH] scripts/kernel-doc: Detect mismatched inline member documentation tags Shuicheng Lin
2026-04-15 22:50 ` ✗ CI.checkpatch: warning for " Patchwork
2026-04-15 22:51 ` ✓ CI.KUnit: success " Patchwork
2026-04-16 1:01 ` ✗ CI.checkpatch: warning for scripts/kernel-doc: Detect mismatched inline member documentation tags (rev2) Patchwork
2026-04-16 1:02 ` ✓ CI.KUnit: success " Patchwork
2026-04-17 2:31 ` ✗ CI.checkpatch: warning for scripts/kernel-doc: Detect mismatched inline member documentation tags (rev3) Patchwork
2026-04-17 2:33 ` ✓ CI.KUnit: success " Patchwork
2026-04-17 3:55 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-17 6:21 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-28 8:12 ` Jani Nikula [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-04-19 17:28 [PATCH] scripts/kernel-doc: Detect mismatched inline member documentation tags kernel test robot
2026-04-20 1:44 kernel test robot
2026-04-20 1:44 kernel test robot
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=0cd899be469b13ed4e6738ce8eb8716081c22d8c@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shuicheng.lin@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.