[PATCH 35/38] docs: kdoc_output: use a more standard order for .TH on man pages

Mauro Carvalho Chehab
2026-02-18T10:13:32Z

The generated man pages are not following the current standards
for Linux documentation. Reorder .TH fields for them to look
like other Linux man pages.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
tools/docs/sphinx-build-wrapper | 2 +-
tools/lib/python/kdoc/kdoc_output.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper
index e6418e22e2ff..ac6852e3dd8c 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"{output_dir}/{args[3]}.{args[2]}"
+ fname = f"{output_dir}/{args[1]}.{args[2]}"

if self.verbose:
print(f"Creating {fname}")
diff --git a/tools/lib/python/kdoc/kdoc_output.py b/tools/lib/python/kdoc/kdoc_output.py
index fe3fc0dfd02b..fb44cc8e0770 100644
--- a/tools/lib/python/kdoc/kdoc_output.py
+++ b/tools/lib/python/kdoc/kdoc_output.py
@@ -611,8 +611,8 @@ class ManFormat(OutputFormat):
"""Emit a title header line."""
name = name.strip()

- 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"):
"""
--
2.52.0