From nobody Thu Apr 9 17:14:12 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 0BB96392C5B; Fri, 6 Mar 2026 15:25:22 +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=1772810723; cv=none; b=PZA8s5f/cd7nNql549cyGn0stDPb8yg1LNNnEfso6O4OaP7ZMXDh7bNm6pGYN+DUIxQlCDSDUOQxkwdufnOAC5hpg+RxTn8K3V+h7le1WBYBYPPSCaEL9vU1EIBDcJFGbBofCTyrv+Htu2eCDwfx0h+hU3VKTcLEV7ZZWrp/0tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772810723; c=relaxed/simple; bh=P6Q2PSaD8E24gYpLDm2SuaDxRi4gZVBuOO+lyWBKM/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RXcs2/xoE/yXaVKIKnGIj9uLxykHiAOuQAXPvvWM2NryC5Mx3tTIlcKYWqq6Fd1E+w+nqgo6VuLBgxXG0DaIw5ruX5vqCDmcmArsJqUvRJRRYs0m6T7Sw+WzyDSywnSDixGfr0gAuFyZQiEMGHIGNw/+UsRmoOnYcHSJ5cV6JSo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZWtYO8qI; 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="ZWtYO8qI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4490C2BC9E; Fri, 6 Mar 2026 15:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772810722; bh=P6Q2PSaD8E24gYpLDm2SuaDxRi4gZVBuOO+lyWBKM/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZWtYO8qIxE+A6qY/GUFXPj/uk/l2OTZ18tkdhBD9ZlK5ajbSCo0JEU4XN4/hL5A8P zjzJYzIaefaZUTvzI1/35goMaA4x6GHfiLfxPZCChuGCccZCrvFPQhFYBZHyMfdnWd MHQttv+eujQvN4/HxzXFChf/NMhDFydctG1GEEUyWIHIa1w3d+Djdha4YHl2PXaSDO z5zqpz3QzkGboEeG5yRRHJc5GvDMz7k00B9aBBL9hfhxts0PhB3YYJODfI5LuDGkp+ xUY0Up6c+VDfhFOAW1bdCRa/PrgGT/d9NZnFMzwU1ZyXFIN0Dj3E0zhPa53xzP2hp3 5id5FmexIK9GA== Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vyX3I-000000074wH-33HY; Fri, 06 Mar 2026 16:25:20 +0100 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Randy Dunlap Subject: [PATCH v2 1/2] docs: kdoc_files: allows the caller to use a different xforms class Date: Fri, 6 Mar 2026 16:25:14 +0100 Message-ID: <6b274ddbdcd9d438c6848e00e410a2f65ef80ec2.1772810574.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 While the main goal for kernel-doc is to be used inside the Linux Kernel, other open source projects could benefit for it. That's currently the case of QEMU, which has a fork, mainly due to two reasons: - they need an extra C function transform rule; - they handle the html output a little bit different. Add an extra optional argument to make easier for the code to be shared, as, with that, QEMU can just create a new derivated class that will contain its specific rulesets, and just copy the remaining kernel-doc files as-is. Signed-off-by: Mauro Carvalho Chehab --- tools/lib/python/kdoc/kdoc_files.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/lib/python/kdoc/kdoc_files.py b/tools/lib/python/kdoc/kd= oc_files.py index 33618c6abec2..c35e033cf123 100644 --- a/tools/lib/python/kdoc/kdoc_files.py +++ b/tools/lib/python/kdoc/kdoc_files.py @@ -118,7 +118,7 @@ class KernelFiles(): if fname in self.files: return =20 - doc =3D KernelDoc(self.config, fname, CTransforms()) + doc =3D KernelDoc(self.config, fname, self.xforms) export_table, entries =3D doc.parse_kdoc() =20 self.export_table[fname] =3D export_table @@ -154,7 +154,7 @@ class KernelFiles(): =20 self.error(f"Cannot find file {fname}") =20 - def __init__(self, verbose=3DFalse, out_style=3DNone, + def __init__(self, verbose=3DFalse, out_style=3DNone, xforms=3DNone, werror=3DFalse, wreturn=3DFalse, wshort_desc=3DFalse, wcontents_before_sections=3DFalse, logger=3DNone): @@ -193,6 +193,11 @@ class KernelFiles(): self.config.wshort_desc =3D wshort_desc self.config.wcontents_before_sections =3D wcontents_before_sections =20 + if xforms: + self.xforms =3D xforms + else: + self.xforms =3D CTransforms() + if not logger: self.config.log =3D logging.getLogger("kernel-doc") else: --=20 2.52.0 From nobody Thu Apr 9 17:14:12 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 4523839903D; Fri, 6 Mar 2026 15:25:23 +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=1772810723; cv=none; b=e3Q3sV3G90AcSZZjPmDFA8njXDrXQs6Gt2Lyg5Fp2OYIdaFsyX67ensS6jJOdDf2Vz/Ki3jP+o1Wi5bG66PmP4XEVHchzrSg6ZaQlPNO7QpHEH+vU0GEgztfamEjZIHNsK/OyDJx3xaFG80b+pXq0LWQ5qdcFohbMseTtoH4eWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772810723; c=relaxed/simple; bh=93FI6HCbFuKLoTGysvIesP/671jVJYX05qdlxtKR9Kk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y/qPpe3uMr2iTqWrZToGV8T8LYAdcKdA9WuJ47LN7c0g+fCMptK3jI6aKfW7e9xjL+++ZLdAqwngujSkLbhW8BKhro2zGI24zhQwqNWt2VTimLRDD8iYWyuMYJc0TqT2uIHdPn2bWVAk8TfxdDf2x2TNgEdAZonYQD3TpAfZKi8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TnF7fVrs; 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="TnF7fVrs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE5B9C2BCAF; Fri, 6 Mar 2026 15:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772810723; bh=93FI6HCbFuKLoTGysvIesP/671jVJYX05qdlxtKR9Kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TnF7fVrs6rjAh0k8Ev+yGx7tPUYQY4RPkgZ/Hk7zraLYyxHXThyJJHfSwwlfn5pQD eHguFl++Dcyk1UQHjpNkLu1H6vXWQjtY72wRLu7uQIX45sOCN/boPOX3KZYj3GOM5x pFcSiAKX+8GD2Sh2nw0st9/jJURUOsxGQ4HWIEm3IKBwaymqcaO2q+pYJb2Vcgcr/h Xi96viVfYt8QlNfTe9XMLx/aUjp/+rUz0tqxwRCmKK1c4g59I/6avdRl+kUxLFhPn6 WxHHlI8cp1/MVN3pg0LJfM0oPOjYT9TJxG8fAPk0Zf/ipyVNn8B7jtSqOgXlU7rYmw e5Pe5PccOJPNw== Received: from mchehab by mail.kernel.org with local (Exim 4.99.1) (envelope-from ) id 1vyX3I-000000074xU-3rdi; Fri, 06 Mar 2026 16:25:20 +0100 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Randy Dunlap Subject: [PATCH v2 2/2] docs: kdoc_files: document KernelFiles() ABI Date: Fri, 6 Mar 2026 16:25:15 +0100 Message-ID: <13eb44c341232564eaf2a9c9de4782369fef57e1.1772810574.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 KernelFiles is the main entry point to run kernel-doc, being used by both tools/docs/kernel-doc and Documentation/sphinx/kerneldoc.py. It is also used on QEMU, which also uses the kernel-doc libraries from tools/lib/python/kdoc. Properly describe its ABI contract. Signed-off-by: Mauro Carvalho Chehab --- tools/lib/python/kdoc/kdoc_files.py | 44 ++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/tools/lib/python/kdoc/kdoc_files.py b/tools/lib/python/kdoc/kd= oc_files.py index c35e033cf123..8c2059623949 100644 --- a/tools/lib/python/kdoc/kdoc_files.py +++ b/tools/lib/python/kdoc/kdoc_files.py @@ -91,7 +91,49 @@ class KernelFiles(): """ Parse kernel-doc tags on multiple kernel source files. =20 - There are two type of parsers defined here: + This is the main entry point to run kernel-doc. This class is initiali= zed + using a series of optional arguments: + + ``verbose`` + If True, enables kernel-doc verbosity. Default: False. + + ``out_style`` + Class to be used to format output. If None (default), + only report errors. + + ``xforms`` + Transforms to be applied to C prototypes and data structs. + If not specified, defaults to xforms =3D CFunction() + + ``werror`` + If True, treat warnings as errors, retuning an error code on warni= ngs. + + Default: False. + + ``wreturn`` + If True, warns about the lack of a return markup on functions. + + Default: False. + ``wshort_desc`` + If True, warns if initial short description is missing. + + Default: False. + + ``wcontents_before_sections`` + If True, warn if there are contents before sections (deprecated). + This option is kept just for backward-compatibility, but it does + nothing, neither here nor at the original Perl script. + + Default: False. + + ``logger`` + Optional logger class instance. + + If not specified, defaults to use: ``logging.getLogger("kernel-doc= ")`` + + Note: + There are two type of parsers defined here: + - self.parse_file(): parses both kernel-doc markups and ``EXPORT_SYMBOL*`` macros; - self.process_export_file(): parses only ``EXPORT_SYMBOL*`` macro= s. --=20 2.52.0