| 46d9c161 | 07-May-2026 |
Shuicheng Lin <shuicheng.lin@intel.com> |
scripts/kernel-doc: Detect mismatched inline member documentation tags
Add validation in check_sections() to verify that inline member documentation tags (/** @member: description */) match actual s
scripts/kernel-doc: Detect mismatched inline member documentation tags
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)
While at it, fix two long-standing issues with named variadic parameters (macros like ``#define foo(fmt, args...)``) that the new check exposed:
1. A description provided via the ``@args...:`` doc form was stored in parameterdescs under the unstripped key ``args...``, while push_parameter() stripped the trailing ``...`` and only added ``args`` to parameterlist. As a result the user-supplied description was orphaned, parameterdescs[``args``] was auto- populated with the generic "variable arguments" text, and the user's actual description was silently discarded by the output stage. Migrate the description from the unstripped to the stripped key inside push_parameter() so the user's text reaches the output and the new check does not flag the orphaned key.
2. push_parameter() always auto-populated parameterdescs[param] with "variable arguments" for variadic parameters, which bypassed the existing "parameter not described" warning at line 549. As a consequence, a named variadic with no matching ``@<name>:`` doc tag (or a mistyped one such as ``@args:`` for a parameter named ``arg``) went undetected. Emit the standard "not described" warning for named variadics before applying the auto-fill, so missing or mistyped variadic docs are reported just like missing docs for any other parameter. The bare ``@...:`` form is unaffected because it has no natural name for the user to document.
This second hunk surfaces one real pre-existing documentation gap in include/linux/hashtable.h: hash_for_each_possible_rcu()'s ``cond...`` parameter has no matching ``@cond:`` doc entry. No false positives were observed across include/linux, kernel/, or drivers/gpu/drm.
v2: Skip variadic parameters whose documented key ends with ``...`` and whose stripped name is in parameterlist, to avoid false-positive "Excess function parameter 'args...'" warnings on macros like ``#define foo(fmt, args...)`` documented with ``@args...:``.
v3: The v2 special case in check_sections() only suppressed the warning while still letting the user's description be silently dropped from the generated output. Replace it with a fix in push_parameter() that migrates the description from ``args...`` to ``args`` when the name is stripped, so the user's text is preserved end-to-end and the new excess-parameter check naturally finds nothing to flag.
v4: Also emit the standard "parameter not described" warning for named variadics that have no matching ``@<name>:`` doc tag. Previously push_parameter()'s unconditional auto-fill bypassed that warning, so a missing or mistyped variadic doc went undetected. (Randy)
Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com> Tested-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <20260507023232.4108680-1-shuicheng.lin@intel.com>
show more ...
|
| 026d7010 | 06-May-2026 |
Randy Dunlap <rdunlap@infradead.org> |
kdoc: xforms: move context attrs to function_xforms list
The context analysis macros are function attributes that should be in the function_xforms list. Somewhere along the way they were inserted in
kdoc: xforms: move context attrs to function_xforms list
The context analysis macros are function attributes that should be in the function_xforms list. Somewhere along the way they were inserted into the struct_xforms list instead. This causes docs build warnings to continue to be emitted for context macros.
Move the context analysis macros to the function_xforms list where they should be to eliminate these warnings.
Documentation/core-api/kref:328: ../include/linux/kref.h:72: WARNING: Invalid C declaration: Expected end of definition. [error at 96] int kref_put_mutex (struct kref *kref, void (*release)(struct kref *kref), struct mutex *mutex) __cond_acquires(true# mutex) Documentation/core-api/kref:328: ../include/linux/kref.h:94: WARNING: Invalid C declaration: Expected end of definition. [error at 92] int kref_put_lock (struct kref *kref, void (*release)(struct kref *kref), spinlock_t *lock) __cond_acquires(true# lock)
Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <20260505221548.163751-1-rdunlap@infradead.org>
show more ...
|
| d642acfd | 27-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
doc tools: better handle KBUILD_VERBOSE
As reported by Jacob, there are troubles when KBUILD_VERBOSE is set at the environment.
Fix it on both kernel-doc and sphinx-build-wrapper.
Reported-by: Jac
doc tools: better handle KBUILD_VERBOSE
As reported by Jacob, there are troubles when KBUILD_VERBOSE is set at the environment.
Fix it on both kernel-doc and sphinx-build-wrapper.
Reported-by: Jacob Keller <jacob.e.keller@intel.com> Closes: https://lore.kernel.org/linux-doc/9367d899-53af-4d9c-9320-22fc4dbadca5@intel.com/ Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Tested-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <7a99788db75630fb14828d612c0fd77c45ec1891.1774591065.git.mchehab+huawei@kernel.org>
show more ...
|
| 2ca0b54d | 23-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: c_lex.py: store logger on its data
By having the logger stored there, any code using CTokenizer can log messages there.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed
docs: c_lex.py: store logger on its data
By having the logger stored there, any code using CTokenizer can log messages there.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <467979dc18149e4b2a7113c178e0cb07919632f2.1774256269.git.mchehab+huawei@kernel.org>
show more ...
|
| 9c391181 | 23-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_output: raise an error if full_proto not available for var
This is mandatory, but if it is missing, we need to know what symbol had problems.
Signed-off-by: Mauro Carvalho Chehab <mcheha
docs: kdoc_output: raise an error if full_proto not available for var
This is mandatory, but if it is missing, we need to know what symbol had problems.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <0c3d9dd25889784b999efdb354ade48264c0e03c.1774256269.git.mchehab+huawei@kernel.org>
show more ...
|
| e786fab2 | 23-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_yaml_file: use a better name for the tests
Instead of always using a name with a number on it, use the name of the object directly whenever possible.
When the name is already used, appen
docs: kdoc_yaml_file: use a better name for the tests
Instead of always using a name with a number on it, use the name of the object directly whenever possible.
When the name is already used, append a number prefix at the end.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <d1c4cd94547d843af0debf9e317e006d55d705f1.1774256269.git.mchehab+huawei@kernel.org>
show more ...
|
| 99ec67a9 | 23-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc: better handle source when producing YAML output
The current logic was storing symbols source code on a list, not linked to the actual KdocItem. While this works fine when kernel-doc mark
docs: kdoc: better handle source when producing YAML output
The current logic was storing symbols source code on a list, not linked to the actual KdocItem. While this works fine when kernel-doc markups are OK, on places where there is a "/**" without a valid kernel-doc markup, it ends that the 1:1 match between source code and KdocItem doesn't happen, causing problems to generate the YAML output.
Fix it by storing the source code directly into the KdocItem structure.
This shouldn't affect performance or memory footprint, except when --yaml option is used.
While here, add a __repr__() function for KdocItem, as it helps debugging it.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <77902dafabb5c3250486aa2dc1568d5fafa95c5b.1774256269.git.mchehab+huawei@kernel.org>
show more ...
|
| 8326e4a2 | 23-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_output: fix handling of simple tables
Fix check for simple table delimiters.
ReST simple tables use "=" instead of "-". I ended testing it with a table modified from a complex one, using
docs: kdoc_output: fix handling of simple tables
Fix check for simple table delimiters.
ReST simple tables use "=" instead of "-". I ended testing it with a table modified from a complex one, using "--- --- ---", instead of searching for a real Kernel example.
Only noticed when adding an unit test and seek for an actual example from kernel-doc markups.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <dea95337c05040f95e5a95ae41d69ddef0aaa8d6.1774256269.git.mchehab+huawei@kernel.org>
show more ...
|
| 6e0d7b63 | 23-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_yaml_file: add a representer to make strings look nicer
The strings representation is not ok, currently. Add a helper function to improve it, and drop blank lines at beginning and at the
docs: kdoc_yaml_file: add a representer to make strings look nicer
The strings representation is not ok, currently. Add a helper function to improve it, and drop blank lines at beginning and at the end of the dumps
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <422041a8b49b2609de5749092fe074b7948c32a6.1774256269.git.mchehab+huawei@kernel.org>
show more ...
|
| 01d6d7bf | 18-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kernel-doc: add support to store output on a YAML file
Add a command line parameter and library support to optionally store: - KdocItem intermediate format after parsing; - man pages output; -
docs: kernel-doc: add support to store output on a YAML file
Add a command line parameter and library support to optionally store: - KdocItem intermediate format after parsing; - man pages output; - rst output.
inside a YAML file.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <ba54277b3c909867153b9547dfa33c1831ca35d9.1773823995.git.mchehab+huawei@kernel.org>
show more ...
|
| e394855f | 18-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_item: fix a typo on sections_start_lines
Currently, there are 15 occurrences of section?_start_lines, with 10 using the plural way.
This is an issue, as, while kdoc_output works with Kdo
docs: kdoc_item: fix a typo on sections_start_lines
Currently, there are 15 occurrences of section?_start_lines, with 10 using the plural way.
This is an issue, as, while kdoc_output works with KdocItem, the term doesn't match its init value.
The variable sections_start_lines stores multiple sections, so placing it in plural is its correct way.
So, ensure that, on all parts of kdoc, this will be referred as sections_start_lines.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <d1e0f1d3f80df41c11a1bbde6a12fd9468bc3813.1773823995.git.mchehab+huawei@kernel.org>
show more ...
|
| 99364ba7 | 18-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_item: add support to generate a KdocItem from a dict
When reading the contents on a KdocItem using YAML, the data will be imported into a dict.
Add a method to create a new KdocItem from
docs: kdoc_item: add support to generate a KdocItem from a dict
When reading the contents on a KdocItem using YAML, the data will be imported into a dict.
Add a method to create a new KdocItem from a dict to allow converting such input into a real KdocItem.
While here, address an issue that, if the class is initialized with an internal parameter outside the 4 initial arguments, it would end being added inside other_stuff, which breaks initializing it from a dict.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <fafeac23d1577927e1a3c32cddfbec1e0209ac73.1773823995.git.mchehab+huawei@kernel.org>
show more ...
|
| 01c41b99 | 18-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_item: fix initial value for parameterdesc_start_lines
Ensure that parameterdesc_start_lines is a dict at init time, as this is how it will be set later on at the parser.
Signed-off-by: M
docs: kdoc_item: fix initial value for parameterdesc_start_lines
Ensure that parameterdesc_start_lines is a dict at init time, as this is how it will be set later on at the parser.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <1b4ea24dd4cd82e6711e9be80168684427d74c30.1773823995.git.mchehab+huawei@kernel.org>
show more ...
|
| 9ab2ca3d | 18-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_files: move output symbols logic to kdoc_output
When writing unittests for kdoc_output, it became clear that the logic with handles a series of KdocItem symbols from a single file belons
docs: kdoc_files: move output symbols logic to kdoc_output
When writing unittests for kdoc_output, it became clear that the logic with handles a series of KdocItem symbols from a single file belons to kdoc_output, and not to kdoc_files.
Move the code to it.
While here, also ensure that self.config will be placed together with set.out_style.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <4ebc26e37a0b544c50d50b8077760f147fa6a535.1773823995.git.mchehab+huawei@kernel.org>
show more ...
|
| e0ebee44 | 18-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_files: use a class to group config parameters
Instead of abusing argparse.Namespace, define a class to store configuration parameters and logger.
Signed-off-by: Mauro Carvalho Chehab <mc
docs: kdoc_files: use a class to group config parameters
Instead of abusing argparse.Namespace, define a class to store configuration parameters and logger.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <a66ec9872c72a3ba1a5ac567881d67dc8ee581c6.1773823995.git.mchehab+huawei@kernel.org>
show more ...
|
| 8c0b7c0d | 18-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc: add c_lex to generated documentation
Do some fixes at groups() description for it to be parsed by Sphinx and add it to the documentation.
Signed-off-by: Mauro Carvalho Chehab <mchehab+h
docs: kdoc: add c_lex to generated documentation
Do some fixes at groups() description for it to be parsed by Sphinx and add it to the documentation.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <799178cf30dd4022fdb1d029ba998a458e037b52.1773823995.git.mchehab+huawei@kernel.org>
show more ...
|
| b2d231f4 | 18-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_re: better represent long regular expressions
The Sphinx output from autodoc doesn't automatically break long lines, except on spaces.
Change KernRe __repr__() to break the pattern on mu
docs: kdoc_re: better represent long regular expressions
The Sphinx output from autodoc doesn't automatically break long lines, except on spaces.
Change KernRe __repr__() to break the pattern on multiple strings, each one with a maximum limit of 60 characters.
With that, documentation output for KernRe should now be displayable, even on long strings.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <60c264a9d277fed655b1a62df2195562c8596090.1773823995.git.mchehab+huawei@kernel.org>
show more ...
|
| 7538df7a | 17-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: xforms_lists: use CMatch for all identifiers
CMatch is lexically correct and replaces only identifiers, which is exactly where macro transformations happen.
Use it to make the output safer an
docs: xforms_lists: use CMatch for all identifiers
CMatch is lexically correct and replaces only identifiers, which is exactly where macro transformations happen.
Use it to make the output safer and ensure that all arguments will be parsed the right way, even on complex cases.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <86d4a07ff0e054207747fabf38d6bb261b52b5fa.1773770483.git.mchehab+huawei@kernel.org>
show more ...
|
| 79d881be | 17-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc_parser: avoid tokenizing structs everytime
Most of the rules inside CTransforms are of the type CMatch.
Don't re-parse the source code every time.
Doing this doesn't change the output,
docs: kdoc_parser: avoid tokenizing structs everytime
Most of the rules inside CTransforms are of the type CMatch.
Don't re-parse the source code every time.
Doing this doesn't change the output, but makes kdoc almost as fast as before the tokenizer patches:
# Before tokenizer patches $ time ./scripts/kernel-doc . -man >original 2>&1
real 0m42.933s user 0m36.523s sys 0m1.145s
# After tokenizer patches $ time ./scripts/kernel-doc . -man >before 2>&1
real 1m29.853s user 1m23.974s sys 0m1.237s
# After this patch $ time ./scripts/kernel-doc . -man >after 2>&1
real 0m48.579s user 0m45.938s sys 0m0.988s
$ diff -s before after Files before and after are identical
Manually checked the differences between original and after with:
$ diff -U0 -prBw original after|grep -v Warning|grep -v "@@"|less
They're due: - whitespace fixes; - struct_group are now better handled; - several badly-generated man pages from broken inline kernel-doc markups are now fixed.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <1cc2a4286ebf7d4b2d03fcaf42a1ba9fa09004b9.1773770483.git.mchehab+huawei@kernel.org>
show more ...
|
| 12aa7753 | 17-Mar-2026 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
docs: kdoc: ensure that comments are dropped before calling split_struct_proto()
Changeset 2b957decdb6c ("docs: kdoc: don't add broken comments inside prototypes") revealed a hidden bug at split_str
docs: kdoc: ensure that comments are dropped before calling split_struct_proto()
Changeset 2b957decdb6c ("docs: kdoc: don't add broken comments inside prototypes") revealed a hidden bug at split_struct_proto(): some comments there may break its capability of properly identifying a struct.
Fixing it is as simple as stripping comments before calling it.
Fixes: 2b957decdb6c ("docs: kdoc: don't add broken comments inside prototypes") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <dcff37b6da5329aea415de31f543b6a1c2cbbbce.1773770483.git.mchehab+huawei@kernel.org>
show more ...
|