From nobody Wed Dec 17 03:15:19 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 1CEB21DDC3F; Mon, 10 Feb 2025 10:18:25 +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=1739182705; cv=none; b=DC5XrgXcKoJE1FpTO1oflpDeXh5dVdTtj8Qa68I1WkK1Z6qyE/RZu2l50bY8sYqZBeYpb5ayXKXiEUuuHSXcXmxcLnzlUqyFjuRVKQc7jLO7jdAB8IK9Uzh1z0K9rm3QugrQll7lXMNYdRIsJO8mgOACmPDz7AebOSFn14J8/mc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739182705; c=relaxed/simple; bh=W0QttvocLbg9MNZjjCOsNJWUuoYSXbcWqR4OJBpGkhQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OGJoA9uis7TQhEkzO3sRjSaPQqE4KiotP8WWpeIOSCGPVTzepUWlLHt+qluQE2VaVkAgX6MaQkgo03qWQ44V8ktPwFSAPvdLOOk2Iie628/V6lMWDexBb8xRYD9lmaLR2aTWkVDUtDZKYBAnuIzMvDx0dcae9KGQa/yNPnzzABM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mhUZnr96; 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="mhUZnr96" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47B5DC16AAE; Mon, 10 Feb 2025 10:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739182704; bh=W0QttvocLbg9MNZjjCOsNJWUuoYSXbcWqR4OJBpGkhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhUZnr96S+xMDkzTvbHS2MbxPqMZVlejlkMMudpueCt5lRYcTJpEmYh1mGIjtXPTh 6SXzVCOFRgSWBQyEWLllz+1/BqvG40WWETuW1hpTzo5nXWjtUACVU/Gf6x149UZjKX hrDWk3tTK19ptCy2pNF5l3NjDLpskjswGbzZfEj+G2ucOp8bMxz/IJrkKMwmqfh7PA eDgUS8bkPyzvKp4imevNBN1ua57b6uB9RfRa67Z1UqhKSYwZo88/V7w6HMmMRInIDg xIiC3yfnZoOSwKCdhNzUVmIu1bQsckGSNHBXjYB31uTCLqZ/BmRREs1zEvTiuX1dZH 12W2YtGbXRt8A== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1thQru-00000006Cjc-1wlv; Mon, 10 Feb 2025 11:18:22 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , "Jonathan Corbet" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH 23/27] docs: sphinx/kernel_abi: avoid warnings during Sphinx module init Date: Mon, 10 Feb 2025 11:18:12 +0100 Message-ID: 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" Sphinx logging system doesn't like warnings during module load, as it understands that such logs are produced at the wrong time: WARNING: while setting up extension automarkup: /sys/devices/system/cpu/cp= uX/topology/physical_package_id is defined 2 times: /new_devel/v4l/docs/Doc= umentation/ABI/stable/sysfs-devices-system-cpu:27; /new_devel/v4l/docs/Docu= mentation/ABI/testing/sysfs-devices-system-cpu:70 WARNING: while setting up extension automarkup: /sys/devices/system/cpu/cp= uX/topology/ppin is defined 2 times: /new_devel/v4l/docs/Documentation/ABI/= stable/sysfs-devices-system-cpu:89; /new_devel/v4l/docs/Documentation/ABI/t= esting/sysfs-devices-system-cpu:70 So, use a function to allocate/process ABI files and use it to be called at kernel_abi.py, as automarkup also needs it to produce the right cross-references. Signed-off-by: Mauro Carvalho Chehab --- Documentation/sphinx/automarkup.py | 4 +++- Documentation/sphinx/kernel_abi.py | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Documentation/sphinx/automarkup.py b/Documentation/sphinx/auto= markup.py index 7d91c39b4ca6..22defc18d6d2 100644 --- a/Documentation/sphinx/automarkup.py +++ b/Documentation/sphinx/automarkup.py @@ -11,7 +11,7 @@ from sphinx.errors import NoUri import re from itertools import chain =20 -from kernel_abi import kernel_abi +from kernel_abi import get_kernel_abi =20 # # Python 2 lacks re.ASCII... @@ -287,6 +287,8 @@ def markup_abi_ref(docname, app, match): # # Go through the dance of getting an xref out of the std domain # + kernel_abi =3D get_kernel_abi() + fname =3D match.group(1) target =3D kernel_abi.xref(fname) =20 diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kern= el_abi.py index 964f586de171..e017b0299953 100644 --- a/Documentation/sphinx/kernel_abi.py +++ b/Documentation/sphinx/kernel_abi.py @@ -52,10 +52,23 @@ __version__ =3D "1.0" logger =3D logging.getLogger('kernel_abi') path =3D os.path.join(srctree, "Documentation/ABI") =20 -# Parse ABI symbols only once -kernel_abi =3D AbiParser(path, logger=3Dlogger) -kernel_abi.parse_abi() -kernel_abi.check_issues() +_kernel_abi =3D None + +def get_kernel_abi(): + u""" + Initialize kernel_abi global var, if not initialized yet. + + This is needed to avoid warnings during Sphinx module initialization. + """ + global _kernel_abi + + if not _kernel_abi: + # Parse ABI symbols only once + _kernel_abi =3D AbiParser(path, logger=3Dlogger) + _kernel_abi.parse_abi() + _kernel_abi.check_issues() + + return _kernel_abi =20 def setup(app): =20 @@ -83,6 +96,8 @@ class KernelCmd(Directive): } =20 def run(self): + kernel_abi =3D get_kernel_abi() + doc =3D self.state.document if not doc.settings.file_insertion_enabled: raise self.warning("docutils: file insertion disabled") --=20 2.48.1