From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
linux-kernel@vger.kernel.org,
Jani Nikula <jani.nikula@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Randy Dunlap <rdunlap@infradead.org>
Subject: [PATCH 05/15] docs: kdoc_files: move output symbols logic to kdoc_output
Date: Tue, 3 Feb 2026 15:55:33 +0100 [thread overview]
Message-ID: <f31df724450b31b6aa96c19e7ccbd7a1820d3c3e.1770128540.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1770128540.git.mchehab+huawei@kernel.org>
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>
---
tools/lib/python/kdoc/kdoc_files.py | 18 ++----------------
tools/lib/python/kdoc/kdoc_output.py | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/tools/lib/python/kdoc/kdoc_files.py b/tools/lib/python/kdoc/kdoc_files.py
index 1c5cb9e5f0e8..58f4ee08e226 100644
--- a/tools/lib/python/kdoc/kdoc_files.py
+++ b/tools/lib/python/kdoc/kdoc_files.py
@@ -269,6 +269,7 @@ class KernelFiles():
# Initialize variables that are internal to KernelFiles
self.out_style = out_style
+ self.out_style.set_config(self.config)
self.errors = 0
self.results = {}
@@ -311,8 +312,6 @@ class KernelFiles():
returning kernel-doc markups on each interaction.
"""
- self.out_style.set_config(self.config)
-
if not filenames:
filenames = sorted(self.results.keys())
@@ -336,25 +335,12 @@ class KernelFiles():
function_table, enable_lineno,
no_doc_sections)
- msg = ""
if fname not in self.results:
self.config.log.warning("No kernel-doc for file %s", fname)
continue
symbols = self.results[fname]
- self.out_style.set_symbols(symbols)
-
- for arg in symbols:
- m = self.out_msg(fname, arg.name, arg)
-
- if m is None:
- ln = arg.get("ln", 0)
- dtype = arg.get('type', "")
-
- self.config.log.warning("%s:%d Can't handle %s",
- fname, ln, dtype)
- else:
- msg += m
+ msg = self.out_style.output_symbols(fname, symbols)
if msg:
yield fname, msg
diff --git a/tools/lib/python/kdoc/kdoc_output.py b/tools/lib/python/kdoc/kdoc_output.py
index 44e40a6e8ca6..ece03cd9d321 100644
--- a/tools/lib/python/kdoc/kdoc_output.py
+++ b/tools/lib/python/kdoc/kdoc_output.py
@@ -222,6 +222,27 @@ class OutputFormat:
return None
+ def output_symbols(self, fname, symbols):
+ """
+ Handles a set of KdocItem symbols.
+ """
+ self.set_symbols(symbols)
+
+ msg = ""
+ for arg in symbols:
+ m = self.msg(fname, arg.name, arg)
+
+ if m is None:
+ ln = arg.get("ln", 0)
+ dtype = arg.get('type', "")
+
+ self.config.log.warning("%s:%d Can't handle %s",
+ fname, ln, dtype)
+ else:
+ msg += m
+
+ return msg
+
# Virtual methods to be overridden by inherited classes
# At the base class, those do nothing.
def set_symbols(self, symbols):
--
2.52.0
next prev parent reply other threads:[~2026-02-03 14:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-03 14:55 [PATCH 00/15] Add unit tests for kernel-doc parser and output Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 01/15] unittests: unittest_helper: store verbosity at the environment Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 02/15] unittests: rename kdoc_xforms.py Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 03/15] unittests: add a runner to execute all unittests Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 04/15] docs: kdoc_files: use a class to group config parameters Mauro Carvalho Chehab
2026-02-03 14:55 ` Mauro Carvalho Chehab [this message]
2026-02-03 14:55 ` [PATCH 06/15] docs: kdoc_item: fix initial value for parameterdesc_start_lines Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 07/15] docs: kdoc_item: add support to generate a KdocItem from a dict Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 08/15] docs: kdoc_item: fix a typo on sections_start_lines Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 09/15] docs: unittests: add a parser to test kernel-doc parser logic Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 10/15] docs: add a schema to help creating unittests for kernel-doc Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 11/15] docs: add a simple kdoc-test.yaml together with a validation tool Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 12/15] docs: test_kdoc_parser: add support for dynamic test creation Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 13/15] docs: add a new file to write kernel-doc output to a YAML file Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 14/15] docs: kernel-doc: add support to store output on " Mauro Carvalho Chehab
2026-02-03 14:55 ` [PATCH 15/15] unittests: test_kdoc_parser: add command line arg to read " Mauro Carvalho Chehab
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=f31df724450b31b6aa96c19e7ccbd7a1820d3c3e.1770128540.git.mchehab+huawei@kernel.org \
--to=mchehab+huawei@kernel.org \
--cc=corbet@lwn.net \
--cc=jani.nikula@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rdunlap@infradead.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®