From nobody Sun Feb 8 15:59:27 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 7196E318EE4; Wed, 14 Jan 2026 12:57:36 +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=1768395456; cv=none; b=COq2Mht+LGX0ZKkiAq4/h7GgUVuBzxEwHUTkNKyrGj6pKui5aD1H4oDMsyL2KWPH3QbFs8dZIECzWNPA6sPwrpOOfpytRnnSw7VBsxWg27NnHv6eUBn8YxbfiZf0Mvnm88LLZY8OB6c2qxmaQvL588ciKECBMaGUKW3xBFa/yN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768395456; c=relaxed/simple; bh=6oCaEi76Hg/UqsSDo++T7ZkfHrGDy79mODSERj/qBrE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tjguLDlE8Pa2dxvhXqsZy8x5hE4afCJnrAA2Jsix2vGp/kG8TtSO6UyMd4dc1s6WmMm8T86ayrFzEW8wg3PxSWPKbI5d3XPdsLrKqwaIZ/Ri7G0nQiMCRmzjeL8VRMW4oxe/WcEJq77Dj0t0JuRca9iAKrpgEPau7v6ejJHbiLk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OinJku6Y; 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="OinJku6Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24721C4CEF7; Wed, 14 Jan 2026 12:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768395456; bh=6oCaEi76Hg/UqsSDo++T7ZkfHrGDy79mODSERj/qBrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OinJku6YFRMUf76QCUhJTt49Z+G64a376QNu68lUXZdQPpv+kmtuGKkaPs9hAasFu HijO/ffFjC+Q/hjHUnKWL/nTAdMzcSEbP8GJ1AlbygDCFSxaCk4Ph7dYcPaEYw7tDt XSSRESBJ8j3nbjiHs+5/IXJTssqB0MLQRBLIFPi7qTl+qg3aSg7qwml36IS4enW5gZ WhAtjmk1v03Zb7PolEITdyegwa4a4NdoVKsFIvZS7Z3Ue/A48CydClXcP29zSvItj8 1sPnioDMH2I8zk63/9U2Z1XChOqE8lS39u+Yh61JUsi0krEjF6s529pI0jaaX/QTpn TWNbPu44iBIEA== Received: from mchehab by mail.kernel.org with local (Exim 4.99) (envelope-from ) id 1vg0RK-00000002ly0-16YQ; Wed, 14 Jan 2026 13:57:34 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Andy Shevchenko , Jani Nikula , Jonathan Corbet , Mauro Carvalho Chehab , Randy Dunlap , stable@vger.kernel.org Subject: [PATCH v4 1/4] scripts/kernel-doc: fix logic to handle unissued warnings Date: Wed, 14 Jan 2026 13:57:22 +0100 Message-ID: <9a3d93bbde9cd3cf5e4dd20ba4f65ef860af6792.1768395332.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 Changeset 469c1c9eb6c9 ("kernel-doc: Issue warnings that were silently disc= arded") didn't properly addressed the missing messages behavior, as it was calling directly python logger low-level function, instead of using the expected method to emit warnings. Basically, there are two methods to log messages: - self.config.log.warning() - This is the raw level to emit a warning. It just writes the a message at stderr, via python logging, as it is initialized as: self.config.log =3D logging.getLogger("kernel-doc") - self.config.warning() - This is where we actually consider a message as a warning, properly incrementing error count. Due to that, several parsing error messages are internally considered as success, causing -Werror to not work on such messages. While here, ensure that the last ignored entry will also be handled by adding an extra check at the end of the parse handler. Fixes: 469c1c9eb6c9 ("kernel-doc: Issue warnings that were silently discard= ed") Closes: https://lore.kernel.org/linux-doc/20260112091053.00cee29a@foz.lan/ Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab Acked-by: Andy Shevchenko --- tools/lib/python/kdoc/kdoc_parser.py | 31 ++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tools/lib/python/kdoc/kdoc_parser.py b/tools/lib/python/kdoc/k= doc_parser.py index a9a37519145d..4ad7ce0b243e 100644 --- a/tools/lib/python/kdoc/kdoc_parser.py +++ b/tools/lib/python/kdoc/kdoc_parser.py @@ -448,18 +448,35 @@ class KernelDoc: =20 self.config.log.debug("Output: %s:%s =3D %s", dtype, name, pformat= (args)) =20 + def emit_unused_warnings(self): + """ + When the parser fails to produce a valid entry, it places some + warnings under `entry.warnings` that will be discarded when resett= ing + the state. + + Ensure that those warnings are not lost. + + NOTE: Because we are calling `config.warning()` here, those + warnings are not filtered by the `-W` parameters: they will = all + be produced even when `-Wreturn`, `-Wshort-desc`, and/or + `-Wcontents-before-sections` are used. + + Allowing those warnings to be filtered is complex, because it + would require storing them in a buffer and then filtering th= em + during the output step of the code, depending on the + selected symbols. + """ + if self.entry and self.entry not in self.entries: + for log_msg in self.entry.warnings: + self.config.warning(log_msg) + def reset_state(self, ln): """ Ancillary routine to create a new entry. It initializes all variables used by the state machine. """ =20 - # - # Flush the warnings out before we proceed further - # - if self.entry and self.entry not in self.entries: - for log_msg in self.entry.warnings: - self.config.log.warning(log_msg) + self.emit_unused_warnings() =20 self.entry =3D KernelEntry(self.config, self.fname, ln) =20 @@ -1741,6 +1758,8 @@ class KernelDoc: # Hand this line to the appropriate state handler self.state_actions[self.state](self, ln, line) =20 + self.emit_unused_warnings() + except OSError: self.config.log.error(f"Error: Cannot open file {self.fname}") =20 --=20 2.52.0 From nobody Sun Feb 8 15:59:27 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 718ED304BCB; Wed, 14 Jan 2026 12:57:36 +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=1768395456; cv=none; b=kUZdLEg7mIO7jYaGfShSDFTNM03EtSbFZWIfXRjCeJzSHWHKwMviqRawhH+pgRYIXY8o2hKZ/UJOcjJud7VvpGtGNebJFmljEB8IBsdB9UWnFrwvCcRs1pPz6XqbifnGY9+XzOY01UhNkjs9KIOlbccmdsj7w2nA0cGjQpZYOJ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768395456; c=relaxed/simple; bh=fwg6VCw4cZEc2+a2J27nnrxYwH8tWyGbO90iEbAtz24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U0KlLMSnlbHLQAX9mtnW+ljdqXeb73D1ejRYlPEWe98Q1Q2o7F2OCqmSZxW2j+RnkzfJUNBY6W1ElDLuE20M/xv5DNn7zNaH24Hsm1UyeAPpzS6bwDg0VuHicF2D7Mea01dLE1wqc7RcHtgnyaDbJorxPFZSj0NMM0ye3iqL5Qc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LpcEJOZP; 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="LpcEJOZP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A7C8C19425; Wed, 14 Jan 2026 12:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768395456; bh=fwg6VCw4cZEc2+a2J27nnrxYwH8tWyGbO90iEbAtz24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpcEJOZPF+n7xrAMkfWVFUNja2Atp1U4exnXOGDkG7TkD9xDFlUZCk1AmeScN+dNN OXFoI4c8wIkd9ZybpXR8WT0v2dhpD3+0Blx3PbYxGovg4zwJNOOMGy9uu1Xjig3Rqn eiVMPS8DN6pAmgbBJ1wckumCAspKLQzvBsLkH3pK/OYLFYf4qznVmHqcgPVM/Gl7/R Gb2Vxea8vs8Ohlzl3JKIW/wNjOUuQSe0wsw3IUd1tdnPsWEdAr/3+vYa9jN0YKvUP9 60uG06F1+3vHCC+d01z3erP67KHFftcYkezsbXjjKIaUwpCYc7mrZLGFqIpVx7AM/p 5zQ/LJb+FPvQA== Received: from mchehab by mail.kernel.org with local (Exim 4.99) (envelope-from ) id 1vg0RK-00000002ly4-1Dme; Wed, 14 Jan 2026 13:57:34 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jani Nikula , Jonathan Corbet , Shuah Khan , stable@vger.kernel.org Subject: [PATCH v4 2/4] scripts/kernel-doc: avoid error_count overflows Date: Wed, 14 Jan 2026 13:57:23 +0100 Message-ID: <68ec6027db89b15394b8ed81b3259d1dc21ab37f.1768395332.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 The glibc library limits the return code to 8 bits. We need to stick to this limit when using sys.exit(error_count). Signed-off-by: Mauro Carvalho Chehab Cc: stable@vger.kernel.org --- scripts/kernel-doc.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py index 7a1eaf986bcd..3992ca49d593 100755 --- a/scripts/kernel-doc.py +++ b/scripts/kernel-doc.py @@ -116,6 +116,8 @@ SRC_DIR =3D os.path.dirname(os.path.realpath(__file__)) =20 sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) =20 +WERROR_RETURN_CODE =3D 3 + DESC =3D """ Read C language source or header FILEs, extract embedded documentation com= ments, and print formatted documentation to standard output. @@ -176,7 +178,20 @@ class MsgFormatter(logging.Formatter): return logging.Formatter.format(self, record) =20 def main(): - """Main program""" + """ + Main program + By default, the return value is: + + - 0: success or Python version is not compatible with = kernel-doc. If -Werror is n= ot used, it will also + return 0 if there are issues at kernel-doc markups; + + - 1: an abnormal condition happened; + + - 2: argparse issued an error; + + - 3: -Werror is used, and one or more unfiltered parse warnings + happened. + """ =20 parser =3D argparse.ArgumentParser(formatter_class=3Dargparse.RawTextH= elpFormatter, description=3DDESC) @@ -323,16 +338,12 @@ def main(): =20 if args.werror: print("%s warnings as errors" % error_count) # pylint: disable= =3DC0209 - sys.exit(error_count) + sys.exit(WERROR_RETURN_CODE) =20 if args.verbose: print("%s errors" % error_count) # pylint: disable= =3DC0209 =20 - if args.none: - sys.exit(0) - - sys.exit(error_count) - + sys.exit(0) =20 # Call main method if __name__ =3D=3D "__main__": --=20 2.52.0 From nobody Sun Feb 8 15:59:27 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 71CEB37F741; Wed, 14 Jan 2026 12:57:36 +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=1768395456; cv=none; b=tEEfPD/3tbpG6h3MuV5Z9EbwGTOiCqaRSjOZ3s90YuG5yQmQqDJc4i38pRF2lw1qRWAm5k0iyGTKK4wLd+qH4C27opET4ExkvWY9ZnqZrGqB7wMOykbAva6VSs4NvOB08R4S309GVzIJtn+EQtkC84Xc66Ge7i+zxPgMjoyaLOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768395456; c=relaxed/simple; bh=Lo3HX4nCVX419+QwqDyEYwQliU9+sgWYRhJZWDw7IOA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eD74B0PrBsKCDX/dmbEB3pIFcvChWJxrYuUt2sBpYM6M8w/RpHNc6HAnDP8tDQ5RTcj6xM62N9hJb76Ef8sH+7uVEWPO/CTHxMguQKJMWCiCIjH3RyTWZljCJDP7FeYO0YCFPp49veJYALwB2h6tnQnwCx+iZsG6UHAr1bgdD48= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VxHoptnn; 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="VxHoptnn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 285DBC19423; Wed, 14 Jan 2026 12:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768395456; bh=Lo3HX4nCVX419+QwqDyEYwQliU9+sgWYRhJZWDw7IOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VxHoptnnu0Y6c+rwsphyLekMOoy42oFy7TFCrs62Vb9JWrRaq7FaGO7Sh5Ap1UP2T uKjWsFbvT9RWe954wbTJi+oy5klsU2Y2aD5sE8l/w5vgqCfnqMUCPhvrsPcE96ZCR5 qfHMI403ZoKdSuiyusjXngSkSNF9/4yqICh/RwB5BXHAsZe+gRleudK1Iu5u+CGNfp y8afQCtC7MkLzImedCIDbU6ZTduafetfrJ6tUg8v4UdznpsZCygjnXY6m6IqBPnz9l nBjNHlgWmyvkcQ34v88x4RVNMw7dqMh7jZi9Oaorpo8xgk7lVYHnnOOm151YIRtxTK TrBOyfHZvvoeA== Received: from mchehab by mail.kernel.org with local (Exim 4.99) (envelope-from ) id 1vg0RK-00000002ly8-1Krs; Wed, 14 Jan 2026 13:57:34 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jani Nikula , Jonathan Corbet , Shuah Khan Subject: [PATCH v4 3/4] scripts/kernel-doc: ensure that comments are using our coding style Date: Wed, 14 Jan 2026 13:57:24 +0100 Message-ID: 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 Along kernel-doc libs, we opted to have all comments starting/ending with a blank comment line. Use the same style here. Signed-off-by: Mauro Carvalho Chehab --- scripts/kernel-doc.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py index 3992ca49d593..1d6036265c0d 100755 --- a/scripts/kernel-doc.py +++ b/scripts/kernel-doc.py @@ -3,7 +3,7 @@ # Copyright(c) 2025: Mauro Carvalho Chehab . # # pylint: disable=3DC0103,R0912,R0914,R0915 - +# # NOTE: While kernel-doc requires at least version 3.6 to run, the # command line should work with Python 3.2+ (tested with 3.4). # The rationale is that it shall fail gracefully during Kernel @@ -12,7 +12,7 @@ # - no f-strings can be used on this file. # - the libraries that require newer versions can only be included # after Python version is checked. - +# # Converted from the kernel-doc script originally written in Perl # under GPLv2, copyrighted since 1998 by the following authors: # @@ -196,8 +196,9 @@ def main(): parser =3D argparse.ArgumentParser(formatter_class=3Dargparse.RawTextH= elpFormatter, description=3DDESC) =20 + # # Normal arguments - + # parser.add_argument("-v", "-verbose", "--verbose", action=3D"store_tru= e", help=3D"Verbose output, more warnings and other in= formation.") =20 @@ -212,8 +213,9 @@ def main(): action=3D"store_true", help=3D"Enable line number output (only in ReST mo= de)") =20 + # # Arguments to control the warning behavior - + # parser.add_argument("-Wreturn", "--wreturn", action=3D"store_true", help=3D"Warns about the lack of a return markup on= functions.") =20 @@ -234,8 +236,9 @@ def main(): parser.add_argument("-export-file", "--export-file", action=3D'append', help=3DEXPORT_FILE_DESC) =20 + # # Output format mutually-exclusive group - + # out_group =3D parser.add_argument_group("Output format selection (mutu= ally exclusive)") =20 out_fmt =3D out_group.add_mutually_exclusive_group() @@ -247,8 +250,9 @@ def main(): out_fmt.add_argument("-N", "-none", "--none", action=3D"store_true", help=3D"Do not output documentation, only warning= s.") =20 + # # Output selection mutually-exclusive group - + # sel_group =3D parser.add_argument_group("Output selection (mutually ex= clusive)") sel_mut =3D sel_group.add_mutually_exclusive_group() =20 @@ -261,7 +265,9 @@ def main(): sel_mut.add_argument("-s", "-function", "--symbol", action=3D'append', help=3DFUNCTION_DESC) =20 + # # Those are valid for all 3 types of filter + # parser.add_argument("-n", "-nosymbol", "--nosymbol", action=3D'append', help=3DNOSYMBOL_DESC) =20 @@ -294,9 +300,11 @@ def main(): =20 python_ver =3D sys.version_info[:2] if python_ver < (3,6): + # # Depending on Kernel configuration, kernel-doc --none is called at # build time. As we don't want to break compilation due to the # usage of an old Python version, return 0 here. + # if args.none: logger.error("Python 3.6 or later is required by kernel-doc. s= kipping checks") sys.exit(0) @@ -306,7 +314,9 @@ def main(): if python_ver < (3,7): logger.warning("Python 3.7 or later is required for correct result= s") =20 + # # Import kernel-doc libraries only after checking Python version + # from kdoc.kdoc_files import KernelFiles # pylint: disable= =3DC0415 from kdoc.kdoc_output import RestFormat, ManFormat # pylint: disable= =3DC0415 =20 @@ -345,6 +355,8 @@ def main(): =20 sys.exit(0) =20 +# # Call main method +# if __name__ =3D=3D "__main__": main() --=20 2.52.0 From nobody Sun Feb 8 15:59:27 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 73D5B38E5E8; Wed, 14 Jan 2026 12:57:36 +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=1768395456; cv=none; b=CsiAFpYN7kc1wf7tUTFAgjyTPpc9fTLXX0Ohua16dVSAh23ilgDEAbzceaLgRBwqCzBqtQ28FLD1h8vB/eZpBduSUaO2GhqABpAgo/3c2KF2M28kMl5VEeY8pj2iaT74yvlen6HJ+xw79T61MyfrwU7TLOlBgQrlYJsjdN6Hk58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768395456; c=relaxed/simple; bh=+3WLqX8wN2UJRYCPHVZkeF+boAr9D0fvRfjS6fsF+Kg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type:Content-Type; b=nD8mR+fDiNN3EFseykB8278XYJpCgbBkKWb7HEybBOvKIX6thVvAkmnK3BqVkyU3TXl6hOOeKooSwGqucThMpAVKpXKcdKzPVaiI5nAgWZ3f5yY9I0scjjjWyDLXcyxQ+Ls0TybAX4hGEV8pjKVpY8PU5RzvZhfwngUZQNdrfsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KEhYT70J; 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="KEhYT70J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AF91C2BC86; Wed, 14 Jan 2026 12:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768395456; bh=+3WLqX8wN2UJRYCPHVZkeF+boAr9D0fvRfjS6fsF+Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEhYT70JAjTSnreUh2wmhzzS2RrMKAzzCXtGFDtq+6nCKYKm0Xarsud18PPm4rgVp oKrSqpG3yPGqVi9hethkY62w68rA24aKsu7lU9LLc2HI+tOJhgPoXEot4AnmBJipJc qi4SAZH3RUdPFZPJcig7i1CWPLpB7Ml3VWVuLoS0W+rUfKdtUb7W1jD9yEvG6Ttdl3 3tWdinrJp3p7u9eVbbmSysdMW1TJliRW+RWu0YJm5H4IJ/DHASKgdMaVqnZq9RBRJO Hmw/N7wA4TKNXtcinTbj3otdyRbOluhLFBvk1Ch86I2cHSmlcEAF33dg+nyHf+7NRO nWsCC9+XSuP1A== Received: from mchehab by mail.kernel.org with local (Exim 4.99) (envelope-from ) id 1vg0RK-00000002lyC-1S2l; Wed, 14 Jan 2026 13:57:34 +0100 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jani Nikula , Mauro Carvalho Chehab , Shuah Khan Subject: [PATCH v4 4/4] scripts/kernel-doc: some fixes to kernel-doc comments Date: Wed, 14 Jan 2026 13:57:25 +0100 Message-ID: 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab There are some typos and English errors in the comments of kernel=E2=80=91d= oc.py. Locate them with the help of an LLM (gpt=E2=80=91oss 14B), executed locally with this prompt: review English grammar and syntax at the comments on the code below: While LLM worked fine for the task of doing an English grammar review for strings, being able to distinguish them from the actual code, it was not is perfect: some things required manual work to fix. - While here, replace: "/**" with: ``/**`` As, if we ever rename this script to kernel_doc.py and add it to Sphinx ext autodoc, we want to avoid this warning: scripts/kernel_doc.py:docstring of kernel_doc:10: WARNING: Inline stron= g start-string without end-string. [docutils] Signed-off-by: Mauro Carvalho Chehab --- scripts/kernel-doc.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py index 1d6036265c0d..7f84c58f7dc4 100755 --- a/scripts/kernel-doc.py +++ b/scripts/kernel-doc.py @@ -9,9 +9,9 @@ # The rationale is that it shall fail gracefully during Kernel # compilation with older Kernel versions. Due to that: # - encoding line is needed here; -# - no f-strings can be used on this file. -# - the libraries that require newer versions can only be included -# after Python version is checked. +# - f-strings cannot be used in this file. +# - libraries that require newer versions can only be included +# after the Python version has been checked. # # Converted from the kernel-doc script originally written in Perl # under GPLv2, copyrighted since 1998 by the following authors: @@ -97,7 +97,7 @@ Read C language source or header FILEs, extract embedded documentation comments, and print formatted documentation to standard output. =20 -The documentation comments are identified by the "/**" +The documentation comments are identified by the ``/**`` opening comment mark. =20 See Documentation/doc-guide/kernel-doc.rst for the @@ -134,13 +134,13 @@ May be used multiple times. """ =20 EXPORT_DESC =3D """ -Only output documentation for the symbols that have been +Only output documentation for symbols that have been exported using EXPORT_SYMBOL() and related macros in any input FILE or -export-file FILE. """ =20 INTERNAL_DESC =3D """ -Only output documentation for the symbols that have NOT been +Only output documentation for symbols that have NOT been exported using EXPORT_SYMBOL() and related macros in any input FILE or -export-file FILE. """ @@ -163,7 +163,7 @@ Header and C source files to be parsed. """ =20 WARN_CONTENTS_BEFORE_SECTIONS_DESC =3D """ -Warns if there are contents before sections (deprecated). +Warn if there are contents before sections (deprecated). =20 This option is kept just for backward-compatibility, but it does nothing, neither here nor at the original Perl script. @@ -171,7 +171,7 @@ neither here nor at the original Perl script. =20 =20 class MsgFormatter(logging.Formatter): - """Helper class to format warnings on a similar way to kernel-doc.pl""" + """Helper class to format warnings in a similar way to kernel-doc.pl."= "" =20 def format(self, record): record.levelname =3D record.levelname.capitalize() @@ -272,7 +272,7 @@ def main(): help=3DNOSYMBOL_DESC) =20 parser.add_argument("-D", "-no-doc-sections", "--no-doc-sections", - action=3D'store_true', help=3D"Don't outputt DOC s= ections") + action=3D'store_true', help=3D"Don't output DOC se= ctions") =20 parser.add_argument("files", metavar=3D"FILE", nargs=3D"+", help=3DFILES_DESC) @@ -301,12 +301,12 @@ def main(): python_ver =3D sys.version_info[:2] if python_ver < (3,6): # - # Depending on Kernel configuration, kernel-doc --none is called at + # Depending on the Kernel configuration, kernel-doc --none is call= ed at # build time. As we don't want to break compilation due to the # usage of an old Python version, return 0 here. # if args.none: - logger.error("Python 3.6 or later is required by kernel-doc. s= kipping checks") + logger.error("Python 3.6 or later is required by kernel-doc. S= kipping checks") sys.exit(0) =20 sys.exit("Python 3.6 or later is required by kernel-doc. Aborting.= ") @@ -315,7 +315,7 @@ def main(): logger.warning("Python 3.7 or later is required for correct result= s") =20 # - # Import kernel-doc libraries only after checking Python version + # Import kernel-doc libraries only after checking the Python version # from kdoc.kdoc_files import KernelFiles # pylint: disable= =3DC0415 from kdoc.kdoc_output import RestFormat, ManFormat # pylint: disable= =3DC0415 --=20 2.52.0