From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: [PATCH v2 07/13] docs: kdoc_output: fix naming for DOC markups
Date: Fri, 6 Mar 2026 16:45:45 +0100 [thread overview]
Message-ID: <11d809e5c4bec23240d3ace3f342dbb2a9263446.1772810752.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1772810752.git.mchehab+huawei@kernel.org>
Right now, DOC markups aren't being handled properly, as it was
using the same name for all output.
Fix it by filling the title argument on a different way.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
tools/docs/sphinx-build-wrapper | 2 +-
tools/lib/python/kdoc/kdoc_output.py | 38 +++++++++++++++++-----------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper
index d3f0dba13da1..2c63d28f639d 100755
--- a/tools/docs/sphinx-build-wrapper
+++ b/tools/docs/sphinx-build-wrapper
@@ -625,7 +625,7 @@ class SphinxBuilder:
# Use shlex here, as it handles well parameters with commas
args = shlex.split(line)
- fname = f"{args[3]}.{args[2]}"
+ fname = f"{args[1]}.{args[2]}"
fname = fname.replace("/", " ")
fname = f"{output_dir}/{fname}"
diff --git a/tools/lib/python/kdoc/kdoc_output.py b/tools/lib/python/kdoc/kdoc_output.py
index 62e300e65405..cf834dbf2725 100644
--- a/tools/lib/python/kdoc/kdoc_output.py
+++ b/tools/lib/python/kdoc/kdoc_output.py
@@ -607,14 +607,21 @@ class ManFormat(OutputFormat):
"%m %d %Y",
]
- def emit_th(self, name):
+ def modulename(self, args):
+ if self._modulename:
+ return self._modulename
+
+ return os.path.dirname(args.fname)
+
+ def emit_th(self, name, args):
"""Emit a title header line."""
- name = name.strip()
+ title = name.strip()
+ module = self.modulename(args)
- self.data += f'.TH "{self.modulename}" {self.section} "{name}" '
- self.data += f'"{self.date}" "{self.manual}"\n'
+ self.data += f'.TH "{name}" {self.section} "{self.date}" '
+ self.data += f'"{self.modulename}" "{self.manual}"\n'
- def __init__(self, modulename, section="9", manual="Kernel API Manual"):
+ def __init__(self, modulename=None, section="9", manual="Kernel API Manual"):
"""
Creates class variables.
@@ -624,7 +631,7 @@ class ManFormat(OutputFormat):
super().__init__()
- self.modulename = modulename
+ self._modulename = modulename
self.section = section
self.manual = manual
@@ -658,7 +665,8 @@ class ManFormat(OutputFormat):
dtype = args.type
if dtype == "doc":
- return self.modulename
+ return name
+# return os.path.basename(self.modulename(args))
if dtype in ["function", "typedef"]:
return name
@@ -735,7 +743,7 @@ class ManFormat(OutputFormat):
out_name = self.arg_name(args, name)
- self.emit_th(out_name)
+ self.emit_th(out_name, args)
for section, text in args.sections.items():
self.data += f'.SH "{section}"' + "\n"
@@ -745,7 +753,7 @@ class ManFormat(OutputFormat):
out_name = self.arg_name(args, name)
- self.emit_th(out_name)
+ self.emit_th(out_name, args)
self.data += ".SH NAME\n"
self.data += f"{name} \\- {args['purpose']}\n"
@@ -791,7 +799,7 @@ class ManFormat(OutputFormat):
def out_enum(self, fname, name, args):
out_name = self.arg_name(args, name)
- self.emit_th(out_name)
+ self.emit_th(out_name, args)
self.data += ".SH NAME\n"
self.data += f"enum {name} \\- {args['purpose']}\n"
@@ -824,7 +832,7 @@ class ManFormat(OutputFormat):
out_name = self.arg_name(args, name)
full_proto = args.other_stuff["full_proto"]
- self.emit_th(out_name)
+ self.emit_th(out_name, args)
self.data += ".SH NAME\n"
self.data += f"{name} \\- {args['purpose']}\n"
@@ -841,11 +849,11 @@ class ManFormat(OutputFormat):
self.output_highlight(text)
def out_typedef(self, fname, name, args):
- module = self.modulename
+ module = self.modulename(args)
purpose = args.get('purpose')
out_name = self.arg_name(args, name)
- self.emit_th(out_name)
+ self.emit_th(out_name, args)
self.data += ".SH NAME\n"
self.data += f"typedef {name} \\- {purpose}\n"
@@ -855,12 +863,12 @@ class ManFormat(OutputFormat):
self.output_highlight(text)
def out_struct(self, fname, name, args):
- module = self.modulename
+ module = self.modulename(args)
purpose = args.get('purpose')
definition = args.get('definition')
out_name = self.arg_name(args, name)
- self.emit_th(out_name)
+ self.emit_th(out_name, args)
self.data += ".SH NAME\n"
self.data += f"{args.type} {name} \\- {purpose}\n"
--
2.52.0
next prev parent reply other threads:[~2026-03-06 15:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 15:45 [PATCH v2 00/13] kernel-doc improvements Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 01/13] docs: sphinx-build-wrapper: better handle troff .TH markups Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 02/13] docs: sphinx-build-wrapper: don't allow "/" on file names Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 03/13] docs: kdoc_output: use a method to emit the .TH header Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 04/13] docs: kdoc_output: remove extra attribute on man .TH headers Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 05/13] docs: kdoc_output: use a single manual for everything Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 06/13] docs: kdoc_output: don't use a different modulename for functions Mauro Carvalho Chehab
2026-03-06 15:45 ` Mauro Carvalho Chehab [this message]
2026-03-06 15:45 ` [PATCH v2 08/13] docs: kdoc_output: describe the class init parameters Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 09/13] docs: kdoc_output: pick a better default for modulename Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 10/13] docs: kdoc_output: Change the logic to handle man highlight Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 11/13] docs: kdoc_output: add a logic to handle tables inside kernel-doc markups Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 12/13] docs: kdoc_output: add support to handle code blocks Mauro Carvalho Chehab
2026-03-06 15:45 ` [PATCH v2 13/13] docs: kdoc_output: better handle lists Mauro Carvalho Chehab
2026-03-09 16:39 ` [PATCH v2 00/13] kernel-doc improvements Jonathan Corbet
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=11d809e5c4bec23240d3ace3f342dbb2a9263446.1772810752.git.mchehab+huawei@kernel.org \
--to=mchehab+huawei@kernel.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=skhan@linuxfoundation.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®