From nobody Mon Feb 9 01:22:49 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 2236A24BBFC; Mon, 24 Feb 2025 09:09:04 +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=1740388144; cv=none; b=OiTGVb9O6rkfIPd6wSQBhGWWVBwufMkk5KCv19WP7DRFc95EIyP1u64zRuZaLxNecYfw2a7IoUMJRLgDtP1+2R6z1/kfVwAUiqKh0LqFJTM0HK/bgh+vbEtRwE3katYHybLlrSd3PtgsG4KxWzY6b9EGaOPDNaVD7njT2crHbm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740388144; c=relaxed/simple; bh=4i9tMFsRvYQf8CGO56ooCSwnWGYo0A/a2tTzIVmQWtE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cCcxY3sHq+k6qZC/JmYmv5zeFP9wBtiYtlOqoKzUHU2lCGcFjESnbPmN5yyG1nBOnDWtsnq9Qt0GlL5qiPC31O2VfZXvXvUe/q6/tH6x2GMAoU8lYrPm32dUSsaXq6NIpBdxQPb3AZ7AsCGEDBRYR4LaFfrgNDBiyAEGkmBWN/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ms3OBXsq; 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="ms3OBXsq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FFB0C4CEF9; Mon, 24 Feb 2025 09:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740388143; bh=4i9tMFsRvYQf8CGO56ooCSwnWGYo0A/a2tTzIVmQWtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ms3OBXsqm2yisM/rJhvonJ1uqy3UA5V+Dicp/c47x5pE11GmIp/b/Ycws+BTedQzb k8u61FIA8ScasigdqiWTJFvdKBRpjzy7ImvDVo0xNmCrn0NBPiLCA9Z9vjApeQE69z aj7giQ5NrcZcyp4hfYm58jV2uLjlty0lVnmTw5eMaHowlz6eXppdYwVG/m8sFWzUNM 1HT/+1pK/bEGDpP8tNHZAjTXJlz+ZW7eVgLCIukbM3yhVUVxU8m3H3yWLE76h8rtH/ s1PBU5ARD+XceaVeAKsusoLGGBI0JWXsTUurpM/fqsD56G+14mQ4JDrfe84x9i/INF 7YQmkjJsOveCQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tmUST-00000003p5S-2dft; Mon, 24 Feb 2025 10:09:01 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH v2 31/39] scripts/kernel-doc.py: move modulename to man class Date: Mon, 24 Feb 2025 10:08:37 +0100 Message-ID: <096291e4eaddd666de7a6178d340f575d60ed9d9.1740387599.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.48.1 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-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Only man output requires a modulename. Move its definition to the man class. Signed-off-by: Mauro Carvalho Chehab --- scripts/kernel-doc.py | 6 +++--- scripts/lib/kdoc/kdoc_files.py | 6 +----- scripts/lib/kdoc/kdoc_output.py | 12 ++++++------ scripts/lib/kdoc/kdoc_parser.py | 9 +-------- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py index daae2b4f3307..064106c18d8b 100755 --- a/scripts/kernel-doc.py +++ b/scripts/kernel-doc.py @@ -111,6 +111,7 @@ 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", @@ -198,7 +199,7 @@ def main(): logger.addHandler(handler) =20 if args.man: - out_style =3D ManFormat() + out_style =3D ManFormat(modulename=3Dargs.modulename) elif args.none: out_style =3D None else: @@ -207,8 +208,7 @@ def main(): kfiles =3D KernelFiles(verbose=3Dargs.verbose, out_style=3Dout_style, werror=3Dargs.werror, wreturn=3Dargs.wreturn, wshort_desc=3Dargs.wshort= _desc, - wcontents_before_sections=3Dargs.wcontents_before= _sections, - modulename=3Dargs.modulename) + wcontents_before_sections=3Dargs.wcontents_before= _sections) =20 kfiles.parse(args.files, export_file=3Dargs.export_file) =20 diff --git a/scripts/lib/kdoc/kdoc_files.py b/scripts/lib/kdoc/kdoc_files.py index e1ed2f6dae94..a2417cafb1c8 100755 --- a/scripts/lib/kdoc/kdoc_files.py +++ b/scripts/lib/kdoc/kdoc_files.py @@ -125,7 +125,7 @@ class KernelFiles(): def __init__(self, verbose=3DFalse, out_style=3DNone, werror=3DFalse, wreturn=3DFalse, wshort_desc=3DFalse, wcontents_before_sections=3DFalse, - logger=3DNone, modulename=3DNone): + logger=3DNone): """ Initialize startup variables and parse all files """ @@ -133,9 +133,6 @@ class KernelFiles(): if not verbose: verbose =3D bool(os.environ.get("KBUILD_VERBOSE", 0)) =20 - if not modulename: - modulename =3D "Kernel API" - if out_style is None: out_style =3D OutputFormat() =20 @@ -167,7 +164,6 @@ class KernelFiles(): self.config.wreturn =3D wreturn self.config.wshort_desc =3D wshort_desc self.config.wcontents_before_sections =3D wcontents_before_sections - self.config.modulename =3D modulename =20 self.config.function_table =3D set() self.config.source_map =3D {} diff --git a/scripts/lib/kdoc/kdoc_output.py b/scripts/lib/kdoc/kdoc_output= .py index df3c15bb1c10..13a74a687f89 100755 --- a/scripts/lib/kdoc/kdoc_output.py +++ b/scripts/lib/kdoc/kdoc_output.py @@ -584,7 +584,7 @@ class ManFormat(OutputFormat): ) blankline =3D "" =20 - def __init__(self): + def __init__(self, modulename): """ Creates class variables. =20 @@ -593,6 +593,7 @@ class ManFormat(OutputFormat): """ =20 super().__init__() + self.modulename =3D modulename =20 dt =3D datetime.now() if os.environ.get("KBUILD_BUILD_TIMESTAMP", None): @@ -624,14 +625,13 @@ class ManFormat(OutputFormat): self.data +=3D line + "\n" =20 def out_doc(self, fname, name, args): - module =3D args.get('module') sectionlist =3D args.get('sectionlist', []) sections =3D args.get('sections', {}) =20 if not self.check_doc(name, args): return =20 - self.data +=3D f'.TH "{module}" 9 "{module}" "{self.man_date}" "AP= I Manual" LINUX' + "\n" + self.data +=3D f'.TH "{self.modulename}" 9 "{self.modulename}" "{s= elf.man_date}" "API Manual" LINUX' + "\n" =20 for section in sectionlist: self.data +=3D f'.SH "{section}"' + "\n" @@ -695,7 +695,7 @@ class ManFormat(OutputFormat): sectionlist =3D args.get('sectionlist', []) sections =3D args.get('sections', {}) =20 - self.data +=3D f'.TH "{args["module"]}" 9 "enum {args["enum"]}" "{= self.man_date}" "API Manual" LINUX' + "\n" + self.data +=3D f'.TH "{self.modulename}" 9 "enum {args["enum"]}" "= {self.man_date}" "API Manual" LINUX' + "\n" =20 self.data +=3D ".SH NAME\n" self.data +=3D f"enum {args['enum']} \\- {args['purpose']}\n" @@ -725,7 +725,7 @@ class ManFormat(OutputFormat): self.output_highlight(sections[section]) =20 def out_typedef(self, fname, name, args): - module =3D args.get('module') + module =3D self.modulename typedef =3D args.get('typedef') purpose =3D args.get('purpose') sectionlist =3D args.get('sectionlist', []) @@ -741,7 +741,7 @@ class ManFormat(OutputFormat): self.output_highlight(sections.get(section)) =20 def out_struct(self, fname, name, args): - module =3D args.get('module') + module =3D self.modulename struct_type =3D args.get('type') struct_name =3D args.get('struct') purpose =3D args.get('purpose') diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser= .py index 51ac2d69a587..0c0fa10b942b 100755 --- a/scripts/lib/kdoc/kdoc_parser.py +++ b/scripts/lib/kdoc/kdoc_parser.py @@ -801,7 +801,6 @@ class KernelDoc: =20 self.output_declaration(decl_type, declaration_name, struct=3Ddeclaration_name, - module=3Dself.entry.modulename, definition=3Ddeclaration, parameterlist=3Dself.entry.parameterlist, parameterdescs=3Dself.entry.parameterdescs, @@ -879,7 +878,6 @@ class KernelDoc: =20 self.output_declaration('enum', declaration_name, enum=3Ddeclaration_name, - module=3Dself.config.modulename, parameterlist=3Dself.entry.parameterlist, parameterdescs=3Dself.entry.parameterdescs, parameterdesc_start_lines=3Dself.entry.par= ameterdesc_start_lines, @@ -1051,7 +1049,6 @@ class KernelDoc: self.output_declaration(decl_type, declaration_name, function=3Ddeclaration_name, typedef=3DTrue, - module=3Dself.config.modulename, functiontype=3Dreturn_type, parameterlist=3Dself.entry.parameterli= st, parameterdescs=3Dself.entry.parameterd= escs, @@ -1066,7 +1063,6 @@ class KernelDoc: self.output_declaration(decl_type, declaration_name, function=3Ddeclaration_name, typedef=3DFalse, - module=3Dself.config.modulename, functiontype=3Dreturn_type, parameterlist=3Dself.entry.parameterli= st, parameterdescs=3Dself.entry.parameterd= escs, @@ -1113,7 +1109,6 @@ class KernelDoc: self.output_declaration(decl_type, declaration_name, function=3Ddeclaration_name, typedef=3DTrue, - module=3Dself.entry.modulename, functiontype=3Dreturn_type, parameterlist=3Dself.entry.parameterli= st, parameterdescs=3Dself.entry.parameterd= escs, @@ -1141,7 +1136,6 @@ class KernelDoc: =20 self.output_declaration('typedef', declaration_name, typedef=3Ddeclaration_name, - module=3Dself.entry.modulename, sectionlist=3Dself.entry.sectionlist, sections=3Dself.entry.sections, section_start_lines=3Dself.entry.secti= on_start_lines, @@ -1630,8 +1624,7 @@ class KernelDoc: self.output_declaration("doc", self.entry.identifier, sectionlist=3Dself.entry.sectionlist, sections=3Dself.entry.sections, - section_start_lines=3Dself.entry.secti= on_start_lines, - module=3Dself.config.modulename) + section_start_lines=3Dself.entry.secti= on_start_lines) self.reset_state(ln) =20 elif doc_content.search(line): --=20 2.48.1