From nobody Fri Dec 19 18:47:39 2025 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 D3F67267712; Tue, 8 Apr 2025 10:09:56 +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=1744106996; cv=none; b=t0fNUxdRX4AwJddGz/EyoC0+OqjlIc+O0sdWOmHevGNQLiLlJYDwg47fBZxO/WQvN8Hb8v37DU565DrfDQeKEUwpFGOAKPCn+VgVpUnt05BS7fUUwQ1soH9ahgMQcYEZS2dSh3IIoPF9WBm4iNug8GwVuQGBKpv8mzl01f8tHQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744106996; c=relaxed/simple; bh=YknnQNXKSY9zOMID4CuZkIJaoPwVVvWlyNEsLX0P8r8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t3im8NncTwFNEwEWdCdEPvQINVsCcVx/sCNK04VrWiP/uJITgd5hoq9lW4cwWFXBu733CJqdEWGz2WLXoBntIX+Dc9MKxWKEkPrzEu4IuuEtCE+3rKDlpXsPy4wdC3oHJN1h6WTKlOkUI39GxEo9ZGOjJtQUGj9dJbB2rzWQw2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g2G+KxNA; 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="g2G+KxNA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E812C4CEF9; Tue, 8 Apr 2025 10:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744106996; bh=YknnQNXKSY9zOMID4CuZkIJaoPwVVvWlyNEsLX0P8r8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g2G+KxNABV6Nfy9T38lDVc5vC5/3iAXlzZaC5GsDDVeumyylarlckWZIKMhRk+EyO kSItWJ/d+G7OBFcRQ8owgmQUEhhLepX2nYiudTLysUb0L4BeM7ypo/q9SZwTadmVT3 ZNIZtEGjLU6kUYvEyOYm8exKaLeLZYC9fZTWqkoUBiyLsqEqTdRFFbS1FW1SEvMZMZ +qNi0JDAw6DQ0u7b6ioaxm5/EhwREHoxf5xqJGRA1F3Z86MR8vS3cQX5op3SoE9FAa jeHzQMbKh5mOsr49/0doJlGDppFfsC2PcCvzjPBuJg3von5EM2QFTryBt4VIeZv37D QdQ9CK1iM8jFw== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1u25tt-00000008RWS-2DvZ; Tue, 08 Apr 2025 18:09:49 +0800 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , Sean Anderson , linux-kernel@vger.kernel.org Subject: [PATCH v3 25/33] scripts/kernel-doc.py: move modulename to man class Date: Tue, 8 Apr 2025 18:09:28 +0800 Message-ID: <583085e3885b0075d16ef9961b4f2ad870f30a55.1744106242.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.49.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-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 eca7e34f9d03..6a6bc81efd31 100755 --- a/scripts/kernel-doc.py +++ b/scripts/kernel-doc.py @@ -186,6 +186,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", @@ -273,7 +274,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: @@ -282,8 +283,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 e2221db7022a..5a6e92e34d05 100644 --- a/scripts/lib/kdoc/kdoc_files.py +++ b/scripts/lib/kdoc/kdoc_files.py @@ -126,7 +126,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 """ @@ -134,9 +134,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 @@ -168,7 +165,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 e0ed79e4d985..8be69245c0d0 100755 --- a/scripts/lib/kdoc/kdoc_output.py +++ b/scripts/lib/kdoc/kdoc_output.py @@ -586,7 +586,7 @@ class ManFormat(OutputFormat): ) blankline =3D "" =20 - def __init__(self): + def __init__(self, modulename): """ Creates class variables. =20 @@ -595,6 +595,7 @@ class ManFormat(OutputFormat): """ =20 super().__init__() + self.modulename =3D modulename =20 dt =3D datetime.now() if os.environ.get("KBUILD_BUILD_TIMESTAMP", None): @@ -626,14 +627,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" @@ -697,7 +697,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" @@ -727,7 +727,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', []) @@ -743,7 +743,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 e48ed128ca04..f923600561f8 100755 --- a/scripts/lib/kdoc/kdoc_parser.py +++ b/scripts/lib/kdoc/kdoc_parser.py @@ -791,7 +791,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, @@ -869,7 +868,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, @@ -1040,7 +1038,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, @@ -1055,7 +1052,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, @@ -1102,7 +1098,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, @@ -1130,7 +1125,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, @@ -1619,8 +1613,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.49.0