[PATCH v2 09/13] docs: kdoc_output: pick a better default for modulename

From: Mauro Carvalho Chehab

Date: Fri Mar 06 2026 - 10:51:01 EST


Instead of placing the same data for modulename for all generated
man pages, use the directory from the filename used to produce
kernel docs as basis.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
---
tools/docs/kernel-doc | 1 -
tools/lib/python/kdoc/kdoc_output.py | 7 ++++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/docs/kernel-doc b/tools/docs/kernel-doc
index aed09f9a54dd..3a932f95bdf5 100755
--- a/tools/docs/kernel-doc
+++ b/tools/docs/kernel-doc
@@ -210,7 +210,6 @@ def main():
help="Enable debug messages")

parser.add_argument("-M", "-modulename", "--modulename",
- default="Kernel API",
help="Allow setting a module name at the output.")

parser.add_argument("-l", "-enable-lineno", "--enable_lineno",
diff --git a/tools/lib/python/kdoc/kdoc_output.py b/tools/lib/python/kdoc/kdoc_output.py
index 7a181b40810d..c25f80a39cdc 100644
--- a/tools/lib/python/kdoc/kdoc_output.py
+++ b/tools/lib/python/kdoc/kdoc_output.py
@@ -589,7 +589,8 @@ class ManFormat(OutputFormat):
``modulename``
Defines the module name to be used at the troff ``.TH`` output.

- This argument is mandatory.
+ This argument is optional. If not specified, it will be filled
+ with the directory which contains the documented file.

``section``
Usually a numeric value from 0 to 9, but man pages also accept
@@ -645,8 +646,8 @@ class ManFormat(OutputFormat):
title = name.strip()
module = self.modulename(args)

- self.data += f'.TH "{name}" {self.section} "{self.date}" '
- self.data += f'"{self.modulename}" "{self.manual}"\n'
+ self.data += f'.TH "{title}" {self.section} "{self.date}" '
+ self.data += f'"{module}" "{self.manual}"\n'

def __init__(self, modulename=None, section="9", manual="Kernel API Manual"):
"""
--
2.52.0