From nobody Fri Apr 3 08:19:32 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 001C03563E7; Wed, 18 Feb 2026 10:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771409614; cv=none; b=THfdkkx4PMSbhSGt7JJnP2d81U2pa+hxdUBMFdLxpCvB06Zz2KhDOYqah5LC/u0QUbSOJJ+EukmtLunegajNYv8Y/1CHmT+NCdUOhPiCLCe2qJ6VOdmuabBJc5aafiT+2l8BoN5LSKdK8YWkasYifKWmB3n59J9iVXQviaI+Xek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771409614; c=relaxed/simple; bh=fvMjJpvYeiR5dsEmac23+IArGmOBOLOmIiyyzQVBvqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PMKFitAWbedQ47DRgKVNmdw8nOm6dWzURkyazwC1jE2Cm9G7R4V8EA5Ieo/jqR+Ywd1cH4zox5cLAAWzR5QGy23RgMC+fw+Uy3Xm8AMJ7W6Olv7dQzfarHN9bGXr9nUOlfFPo6s24X7dXCwtFveQXn1VDf5barUmU+VPxaHXEdU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XCXs+vDn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XCXs+vDn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D708EC2BC9E; Wed, 18 Feb 2026 10:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771409613; bh=fvMjJpvYeiR5dsEmac23+IArGmOBOLOmIiyyzQVBvqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XCXs+vDn55NbKpqXTFsPi7CJOEdjC9jxLinK6EHOS/f1g9uf/z3PDR5iM8HgJvv2N mw6006xk6eMPrrhZWZ3gUeQXlVDshIklV6mSZyA2lgJ13YDwgHo2gn2K8nzXG/bpJP n39uFySI2zwLYiZOkjEYdwgNtOW2LtrKhR7rgIWrEZRbzr7rC8K23c/KG2zdDUwpV5 UOBj0eJUJmFgIO08ARmNG+Siz2Z6OmI5KuPjSBDbx9dowDPlrvTK01Sir9ICF4Ut/c aEvWGuUJcbwKyygGrOWVxR2JEgz6iA8qCHMFu5BmbAekRIl1Bf2Y2UDdWBfrOFHzN+ 45IuDdYQRZx+A== Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vseYm-00000000M4p-0GPz; Wed, 18 Feb 2026 11:13:32 +0100 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List , Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , intel-wired-lan@lists.osuosl.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Shuah Khan Subject: [PATCH 38/38] docs: kdoc_output: pick a better default for modulename Date: Wed, 18 Feb 2026 11:13:08 +0100 Message-ID: <45159d8100d22567a592a90769a71a5335f0a085.1771408406.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab 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 --- tools/docs/kernel-doc | 1 - tools/lib/python/kdoc/kdoc_output.py | 41 +++++++++++++++++----------- 2 files changed, 25 insertions(+), 17 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=3D"Enable debug messages") =20 parser.add_argument("-M", "-modulename", "--modulename", - default=3D"Kernel API", help=3D"Allow setting a module name at the output.= ") =20 parser.add_argument("-l", "-enable-lineno", "--enable_lineno", diff --git a/tools/lib/python/kdoc/kdoc_output.py b/tools/lib/python/kdoc/k= doc_output.py index 1e3dc47bc696..44e40a6e8ca6 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. =20 - This argument is mandatory. + This argument is optional. If not specified, it will be filled + with the directory which contains the documented file. =20 ``section`` Usually a numeric value from 0 to 9, but man pages also accept @@ -634,14 +635,21 @@ class ManFormat(OutputFormat): "%m %d %Y", ] =20 - def emit_th(self, name): + def emit_th(self, name, args): """Emit a title header line.""" - name =3D name.strip() + title =3D name.strip() + module =3D self.modulename(args) =20 - self.data +=3D f'.TH "{name}" {self.section} "{self.date}" ' - self.data +=3D f' "{self.modulename}" "{self.manual}"\n' + self.data +=3D f'.TH "{title}" {self.section} "{self.date}" ' + self.data +=3D f' "{module}" "{self.manual}"\n' =20 - def __init__(self, modulename, section=3D"9", manual=3D"Kernel API Man= ual"): + def modulename(self, args): + if self._modulename: + return self._modulename + + return os.path.dirname(args.fname) + + def __init__(self, modulename=3DNone, section=3D"9", manual=3D"Kernel = API Manual"): """ Creates class variables. =20 @@ -651,7 +659,7 @@ class ManFormat(OutputFormat): =20 super().__init__() =20 - self.modulename =3D modulename + self._modulename =3D modulename self.section =3D section self.manual =3D manual =20 @@ -685,7 +693,8 @@ class ManFormat(OutputFormat): dtype =3D args.type =20 if dtype =3D=3D "doc": - return self.modulename + return name +# return os.path.basename(self.modulename(args)) =20 if dtype in ["function", "typedef"]: return name @@ -762,7 +771,7 @@ class ManFormat(OutputFormat): =20 out_name =3D self.arg_name(args, name) =20 - self.emit_th(out_name) + self.emit_th(out_name, args) =20 for section, text in args.sections.items(): self.data +=3D f'.SH "{section}"' + "\n" @@ -772,7 +781,7 @@ class ManFormat(OutputFormat): =20 out_name =3D self.arg_name(args, name) =20 - self.emit_th(out_name) + self.emit_th(out_name, args) =20 self.data +=3D ".SH NAME\n" self.data +=3D f"{name} \\- {args['purpose']}\n" @@ -818,7 +827,7 @@ class ManFormat(OutputFormat): def out_enum(self, fname, name, args): out_name =3D self.arg_name(args, name) =20 - self.emit_th(out_name) + self.emit_th(out_name, args) =20 self.data +=3D ".SH NAME\n" self.data +=3D f"enum {name} \\- {args['purpose']}\n" @@ -851,7 +860,7 @@ class ManFormat(OutputFormat): out_name =3D self.arg_name(args, name) full_proto =3D args.other_stuff["full_proto"] =20 - self.emit_th(out_name) + self.emit_th(out_name, args) =20 self.data +=3D ".SH NAME\n" self.data +=3D f"{name} \\- {args['purpose']}\n" @@ -868,11 +877,11 @@ class ManFormat(OutputFormat): self.output_highlight(text) =20 def out_typedef(self, fname, name, args): - module =3D self.modulename + module =3D self.modulename(args) purpose =3D args.get('purpose') out_name =3D self.arg_name(args, name) =20 - self.emit_th(out_name) + self.emit_th(out_name, args) =20 self.data +=3D ".SH NAME\n" self.data +=3D f"typedef {name} \\- {purpose}\n" @@ -882,12 +891,12 @@ class ManFormat(OutputFormat): self.output_highlight(text) =20 def out_struct(self, fname, name, args): - module =3D self.modulename + module =3D self.modulename(args) purpose =3D args.get('purpose') definition =3D args.get('definition') out_name =3D self.arg_name(args, name) =20 - self.emit_th(out_name) + self.emit_th(out_name, args) =20 self.data +=3D ".SH NAME\n" self.data +=3D f"{args.type} {name} \\- {purpose}\n" --=20 2.52.0