[PATCH 00/14] More kernel-doc patches

Mauro Carvalho Chehab posted 14 patches 2 weeks, 5 days ago
Documentation/tools/kdoc_ancillary.rst   |   9 +
tools/docs/kernel-doc                    |  48 +-
tools/lib/python/kdoc/c_lex.py           |   9 +-
tools/lib/python/kdoc/kdoc_files.py      | 104 +++--
tools/lib/python/kdoc/kdoc_item.py       |  39 +-
tools/lib/python/kdoc/kdoc_output.py     |  23 +-
tools/lib/python/kdoc/kdoc_parser.py     |  33 +-
tools/lib/python/kdoc/kdoc_re.py         |   9 +-
tools/lib/python/kdoc/kdoc_yaml_file.py  | 155 +++++++
tools/unittests/kdoc-test-schema.yaml    | 156 +++++++
tools/unittests/kdoc-test.yaml           | 154 +++++++
tools/unittests/test_kdoc_parser.py      | 534 +++++++++++++++++++++++
tools/unittests/test_kdoc_test_schema.py |  94 ++++
tools/unittests/test_tokenizer.py        |  13 +-
14 files changed, 1322 insertions(+), 58 deletions(-)
create mode 100644 tools/lib/python/kdoc/kdoc_yaml_file.py
create mode 100644 tools/unittests/kdoc-test-schema.yaml
create mode 100644 tools/unittests/kdoc-test.yaml
create mode 100755 tools/unittests/test_kdoc_parser.py
create mode 100755 tools/unittests/test_kdoc_test_schema.py
[PATCH 00/14] More kernel-doc patches
Posted by Mauro Carvalho Chehab 2 weeks, 5 days ago
Hi Jon,

This series comes after:
    https://lore.kernel.org/linux-doc/cover.1773770483.git.mchehab+huawei@kernel.org/

It basically contains patches I submitted before on a 40+ patch series,
but were less relevant, plus a couple of other minor fixes:

- patch 1 improves one of the CTokenizer unit test, fixing some
  potential issues on it;
- patches 2 and 3 contain some improvement/fixes for Sphinx
  Python autodoc extension. They basically document c_lex.py;

- The remaining patches:
  - create a new class for kernel-doc config;
  - fix some internal representations of KdocItem;
  - add unit tests for KernelDoc() parser class;
  - add support to output KdocItem in YAML, which is a
    machine-readable output for all documented kAPI.

None of the patches should affect man or html output.

Before you complain about the diffstats, changes at kdoc
itself aren't big:

 tools/lib/python/kdoc/c_lex.py          |    9 +-
 tools/lib/python/kdoc/kdoc_files.py     |  104 ++++++++++++++++--------
 tools/lib/python/kdoc/kdoc_item.py      |   39 ++++++++-
 tools/lib/python/kdoc/kdoc_output.py    |   23 +++++
 tools/lib/python/kdoc/kdoc_parser.py    |   33 ++++++-
 tools/lib/python/kdoc/kdoc_re.py        |    9 +-
 tools/lib/python/kdoc/kdoc_yaml_file.py |  155 ++++++++++++++++++++++++++++++++++++
 7 files changed, 325 insertions(+), 47 deletions(-)

e.g. 155 new LoC for the new yaml file output and 123 new LoC for
the other cleanups/fixes.

The remaining ones are at the YAML files and at unittests.

Mauro Carvalho Chehab (14):
  unittests: test_tokenizer: better handle mismatch error
  docs: kdoc_re: better represent long regular expressions
  docs: kdoc: add c_lex to generated documentation
  docs: kdoc_files: use a class to group config parameters
  docs: kdoc_files: move output symbols logic to kdoc_output
  docs: kdoc_item: fix initial value for parameterdesc_start_lines
  docs: kdoc_item: add support to generate a KdocItem from a dict
  docs: kdoc_item: fix a typo on sections_start_lines
  docs: unittests: add a parser to test kernel-doc parser logic
  docs: add a schema to help creating unittests for kernel-doc
  docs: add a simple kdoc-test.yaml together with a validation tool
  docs: test_kdoc_parser: add support for dynamic test creation
  docs: add a new file to write kernel-doc output to a YAML file
  docs: kernel-doc: add support to store output on a YAML file

 Documentation/tools/kdoc_ancillary.rst   |   9 +
 tools/docs/kernel-doc                    |  48 +-
 tools/lib/python/kdoc/c_lex.py           |   9 +-
 tools/lib/python/kdoc/kdoc_files.py      | 104 +++--
 tools/lib/python/kdoc/kdoc_item.py       |  39 +-
 tools/lib/python/kdoc/kdoc_output.py     |  23 +-
 tools/lib/python/kdoc/kdoc_parser.py     |  33 +-
 tools/lib/python/kdoc/kdoc_re.py         |   9 +-
 tools/lib/python/kdoc/kdoc_yaml_file.py  | 155 +++++++
 tools/unittests/kdoc-test-schema.yaml    | 156 +++++++
 tools/unittests/kdoc-test.yaml           | 154 +++++++
 tools/unittests/test_kdoc_parser.py      | 534 +++++++++++++++++++++++
 tools/unittests/test_kdoc_test_schema.py |  94 ++++
 tools/unittests/test_tokenizer.py        |  13 +-
 14 files changed, 1322 insertions(+), 58 deletions(-)
 create mode 100644 tools/lib/python/kdoc/kdoc_yaml_file.py
 create mode 100644 tools/unittests/kdoc-test-schema.yaml
 create mode 100644 tools/unittests/kdoc-test.yaml
 create mode 100755 tools/unittests/test_kdoc_parser.py
 create mode 100755 tools/unittests/test_kdoc_test_schema.py

-- 
2.53.0
Re: [PATCH 00/14] More kernel-doc patches
Posted by Mauro Carvalho Chehab 2 weeks, 5 days ago
On Wed, 18 Mar 2026 10:11:00 +0100
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:

> Hi Jon,
> 
> This series comes after:
>     https://lore.kernel.org/linux-doc/cover.1773770483.git.mchehab+huawei@kernel.org/
> 
> It basically contains patches I submitted before on a 40+ patch series,
> but were less relevant, plus a couple of other minor fixes:
> 
> - patch 1 improves one of the CTokenizer unit test, fixing some
>   potential issues on it;
> - patches 2 and 3 contain some improvement/fixes for Sphinx
>   Python autodoc extension. They basically document c_lex.py;
> 
> - The remaining patches:
>   - create a new class for kernel-doc config;
>   - fix some internal representations of KdocItem;
>   - add unit tests for KernelDoc() parser class;
>   - add support to output KdocItem in YAML, which is a
>     machine-readable output for all documented kAPI.

Btw, if one wants, for instance, to obtain all mm-related kAPI already
documented with kernel-doc markups in a machine-readable format, all 
it is needed is to run:

	$ ./scripts/kernel-doc -none -y mm.yaml mm/ include/linux/mm.h include/linux/mm_*.h

Its output follows the YAML schema defined at:

	tools/unittests/kdoc-test-schema.yaml

Regards,
Mauro
Re: [PATCH 00/14] More kernel-doc patches
Posted by Jonathan Corbet 2 weeks ago
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:

> Hi Jon,
>
> This series comes after:
>     https://lore.kernel.org/linux-doc/cover.1773770483.git.mchehab+huawei@kernel.org/
>
> It basically contains patches I submitted before on a 40+ patch series,
> but were less relevant, plus a couple of other minor fixes:
>
> - patch 1 improves one of the CTokenizer unit test, fixing some
>   potential issues on it;
> - patches 2 and 3 contain some improvement/fixes for Sphinx
>   Python autodoc extension. They basically document c_lex.py;
>
> - The remaining patches:
>   - create a new class for kernel-doc config;
>   - fix some internal representations of KdocItem;
>   - add unit tests for KernelDoc() parser class;
>   - add support to output KdocItem in YAML, which is a
>     machine-readable output for all documented kAPI.
>
> None of the patches should affect man or html output.

OK, I applied this set too.

Thanks,

jon