summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2026-03-06 16:25:14 +0100
committerJonathan Corbet <corbet@lwn.net>2026-03-09 10:23:20 -0600
commit861dcdb6ad6f339a5958764352e626e2af7df4c1 (patch)
tree29a4a36200514327e4186b758cebbffe8ed5e2a8 /tools/lib/python
parentb8e7e03370b924f2c91895296dfb79c8692d21d4 (diff)
docs: kdoc_files: allows the caller to use a different xforms class
While the main goal for kernel-doc is to be used inside the Linux Kernel, other open source projects could benefit for it. That's currently the case of QEMU, which has a fork, mainly due to two reasons: - they need an extra C function transform rule; - they handle the html output a little bit different. Add an extra optional argument to make easier for the code to be shared, as, with that, QEMU can just create a new derivated class that will contain its specific rulesets, and just copy the remaining kernel-doc files as-is. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <6b274ddbdcd9d438c6848e00e410a2f65ef80ec2.1772810574.git.mchehab+huawei@kernel.org>
Diffstat (limited to 'tools/lib/python')
-rw-r--r--tools/lib/python/kdoc/kdoc_files.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/lib/python/kdoc/kdoc_files.py b/tools/lib/python/kdoc/kdoc_files.py
index 33618c6abec2e..c35e033cf123e 100644
--- a/tools/lib/python/kdoc/kdoc_files.py
+++ b/tools/lib/python/kdoc/kdoc_files.py
@@ -118,7 +118,7 @@ class KernelFiles():
if fname in self.files:
return
- doc = KernelDoc(self.config, fname, CTransforms())
+ doc = KernelDoc(self.config, fname, self.xforms)
export_table, entries = doc.parse_kdoc()
self.export_table[fname] = export_table
@@ -154,7 +154,7 @@ class KernelFiles():
self.error(f"Cannot find file {fname}")
- def __init__(self, verbose=False, out_style=None,
+ def __init__(self, verbose=False, out_style=None, xforms=None,
werror=False, wreturn=False, wshort_desc=False,
wcontents_before_sections=False,
logger=None):
@@ -193,6 +193,11 @@ class KernelFiles():
self.config.wshort_desc = wshort_desc
self.config.wcontents_before_sections = wcontents_before_sections
+ if xforms:
+ self.xforms = xforms
+ else:
+ self.xforms = CTransforms()
+
if not logger:
self.config.log = logging.getLogger("kernel-doc")
else: