Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: sphinx/kernel_abi: avoid warnings during Sphinx module init

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/cpuX/topology/physical_package_id is defined 2 times: /new_devel/v4l/docs/Documentation/ABI/stable/sysfs-devices-system-cpu:27; /new_devel/v4l/docs/Documentation/ABI/testing/sysfs-devices-system-cpu:70
WARNING: while setting up extension automarkup: /sys/devices/system/cpu/cpuX/topology/ppin is defined 2 times: /new_devel/v4l/docs/Documentation/ABI/stable/sysfs-devices-system-cpu:89; /new_devel/v4l/docs/Documentation/ABI/testing/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 <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/b0e79dc60d556e3b39fa6774d3b7bf734b73f352.1739182025.git.mchehab+huawei@kernel.org

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
5ca0e7ff c9408169

+22 -5
+3 -1
Documentation/sphinx/automarkup.py
··· 11 11 import re 12 12 from itertools import chain 13 13 14 - from kernel_abi import kernel_abi 14 + from kernel_abi import get_kernel_abi 15 15 16 16 # 17 17 # Python 2 lacks re.ASCII... ··· 287 287 # 288 288 # Go through the dance of getting an xref out of the std domain 289 289 # 290 + kernel_abi = get_kernel_abi() 291 + 290 292 fname = match.group(1) 291 293 target = kernel_abi.xref(fname) 292 294
+19 -4
Documentation/sphinx/kernel_abi.py
··· 52 52 logger = logging.getLogger('kernel_abi') 53 53 path = os.path.join(srctree, "Documentation/ABI") 54 54 55 - # Parse ABI symbols only once 56 - kernel_abi = AbiParser(path, logger=logger) 57 - kernel_abi.parse_abi() 58 - kernel_abi.check_issues() 55 + _kernel_abi = None 56 + 57 + def get_kernel_abi(): 58 + u""" 59 + Initialize kernel_abi global var, if not initialized yet. 60 + 61 + This is needed to avoid warnings during Sphinx module initialization. 62 + """ 63 + global _kernel_abi 64 + 65 + if not _kernel_abi: 66 + # Parse ABI symbols only once 67 + _kernel_abi = AbiParser(path, logger=logger) 68 + _kernel_abi.parse_abi() 69 + _kernel_abi.check_issues() 70 + 71 + return _kernel_abi 59 72 60 73 def setup(app): 61 74 ··· 96 83 } 97 84 98 85 def run(self): 86 + kernel_abi = get_kernel_abi() 87 + 99 88 doc = self.state.document 100 89 if not doc.settings.file_insertion_enabled: 101 90 raise self.warning("docutils: file insertion disabled")