Skip to contentSkip to conversation

Fix media uAPI cross references

PATCH In review Mauro Carvalho Chehab 3 participants 29 messages Oct 1, 2025 – Oct 20, 2025

Subsystems (11)
lore
Share & tools
lore
#0 lore raw

cover Fix media uAPI cross references

In the past, media used Docbook to generate documentation, together with some logic to ensure that cross-references would match the actual defined uAPI.

The rationale is that we wanted to automatically check for uAPI documentation gaps.

The same logic was migrated to Sphinx. Back then, broken links were reported. However, recent versions of it and/or changes at conf.py disabled such checks.

The result is that several symbols are now not cross-referenced, and we don't get warnings anymore when something breaks.

This series consist on 2 parts:

Part 1: extra patches to parse_data_structs.py and kernel_include.py; Part 2: media documentation fixes.

I'm not sure what's the best strategy to merge it, as some patches belong to doc while others are media. So, they can be merged on either one of the tree, or split on two series and merged in separate or even being merged via a PR applied on both trees.

IMO, the latter is the better strategy.

Anyway, let's submit the series for review and discuss later about its merge strategy.

Mauro Carvalho Chehab (23):
tools: docs: parse_data_structs.py: drop contents header
tools: docs: parse_data_structs.py: output a line number
docs: kernel_include.py: fix line numbers for TOC
docs: kernel_include.py: propose alternatives
tools: docs: parse_data_structs: make process_exceptions two stages
tools: docs: parse_data_structs.py: get rid of process_exceptions()
tools: docs: parse_data_structs.py: add namespace support
tools: docs: parse_data_structs.py: accept more reftypes
docs: media: dvb: use TOC instead of file contents at headers
docs: media: dvb: enable warnings for most headers
docs: media: rc: use TOC instead of file contents for LIRC header
docs: media: mediactl: use TOC instead of file contents
docs: kernel_include.py: use get_close_matches() to propose
alternatives
docs: media: add missing c namespace to V4L headers
docs: media: videodev2.h.rst.exceptions: fix namespace on refs
media: docs: add a missing reference for VIDIOC_QUERY_CTRL
media: docs: videodev2.h.rst.exceptions: ignore struct

    __kernel_v4l2_timeval

media: docs: add some C domain missing references
docs: cec: cec.h.rst.exceptions: fix broken references from cec.h
docs: cec: show broken xrefs and show TOC instead of cec.h content
docs: media: dmx_types: place kerneldoc at the right namespace
docs: media: dvb: headers: warn about broken cross references
docs: media: dvb: fix dmx.h.rst.exceptions

 Documentation/sphinx/kernel_include.py        | 110 ++++++-
 .../userspace-api/media/cec/cec-header.rst    |   8 +-
 .../media/cec/cec.h.rst.exceptions            |   3 +
 .../media/dvb/dmx.h.rst.exceptions            |  82 +++--
 .../userspace-api/media/dvb/dmx_types.rst     |   1 +
 .../media/dvb/frontend.h.rst.exceptions       |   5 +-
 .../userspace-api/media/dvb/headers.rst       |  31 +-
 .../media/mediactl/media-header.rst           |   8 +-
 .../media/mediactl/media.h.rst.exceptions     |   3 +
 .../userspace-api/media/rc/lirc-header.rst    |  14 +-
 .../userspace-api/media/v4l/app-pri.rst       |   1 +
 .../userspace-api/media/v4l/audio.rst         |   1 +
 .../userspace-api/media/v4l/biblio.rst        |   1 +
 .../userspace-api/media/v4l/buffer.rst        |   2 +
 .../media/v4l/capture-example.rst             |   1 +
 .../userspace-api/media/v4l/capture.c.rst     |   1 +
 .../media/v4l/colorspaces-defs.rst            |   1 +
 .../media/v4l/colorspaces-details.rst         |   1 +
 .../userspace-api/media/v4l/colorspaces.rst   |   1 +
 .../userspace-api/media/v4l/common-defs.rst   |   1 +
 .../userspace-api/media/v4l/common.rst        |   1 +
 .../userspace-api/media/v4l/compat.rst        |   1 +
 .../userspace-api/media/v4l/control.rst       |   1 +
 .../userspace-api/media/v4l/crop.rst          |   1 +
 .../userspace-api/media/v4l/depth-formats.rst |   1 +
 .../userspace-api/media/v4l/dev-decoder.rst   |   1 +
 .../userspace-api/media/v4l/dev-encoder.rst   |   1 +
 .../userspace-api/media/v4l/dev-event.rst     |   1 +
 .../userspace-api/media/v4l/dev-mem2mem.rst   |   1 +
 .../userspace-api/media/v4l/dev-meta.rst      |   1 +
 .../userspace-api/media/v4l/dev-osd.rst       |   1 +
 .../userspace-api/media/v4l/dev-overlay.rst   |   1 +
 .../userspace-api/media/v4l/dev-radio.rst     |   1 +
 .../userspace-api/media/v4l/dev-sdr.rst       |   1 +
 .../media/v4l/dev-stateless-decoder.rst       |   1 +
 .../userspace-api/media/v4l/dev-subdev.rst    |   1 +
 .../userspace-api/media/v4l/dev-touch.rst     |   1 +
 .../userspace-api/media/v4l/devices.rst       |   1 +
 .../userspace-api/media/v4l/dv-timings.rst    |   1 +
 .../media/v4l/ext-ctrls-camera.rst            |   1 +
 .../media/v4l/ext-ctrls-codec-stateless.rst   |   1 +
 .../media/v4l/ext-ctrls-codec.rst             |   1 +
 .../media/v4l/ext-ctrls-colorimetry.rst       |   1 +
 .../media/v4l/ext-ctrls-detect.rst            |   1 +
 .../userspace-api/media/v4l/ext-ctrls-dv.rst  |   1 +
 .../media/v4l/ext-ctrls-flash.rst             |   1 +
 .../media/v4l/ext-ctrls-fm-rx.rst             |   1 +
 .../media/v4l/ext-ctrls-fm-tx.rst             |   1 +
 .../media/v4l/ext-ctrls-image-process.rst     |   1 +
 .../media/v4l/ext-ctrls-image-source.rst      |   1 +
 .../media/v4l/ext-ctrls-jpeg.rst              |   1 +
 .../media/v4l/ext-ctrls-rf-tuner.rst          |   1 +
 .../media/v4l/extended-controls.rst           |   1 +
 .../userspace-api/media/v4l/field-order.rst   |   1 +
 .../userspace-api/media/v4l/fourcc.rst        |   1 +
 .../userspace-api/media/v4l/hsv-formats.rst   |   1 +
 .../userspace-api/media/v4l/libv4l.rst        |   1 +
 .../userspace-api/media/v4l/meta-formats.rst  |   1 +
 .../media/v4l/metafmt-c3-isp.rst              |   1 +
 .../userspace-api/media/v4l/metafmt-d4xx.rst  |   1 +
 .../media/v4l/metafmt-generic.rst             |   1 +
 .../media/v4l/metafmt-intel-ipu3.rst          |   1 +
 .../media/v4l/metafmt-pisp-be.rst             |   1 +
 .../media/v4l/metafmt-pisp-fe.rst             |   1 +
 .../media/v4l/metafmt-rkisp1.rst              |   1 +
 .../userspace-api/media/v4l/metafmt-uvc.rst   |   1 +
 .../userspace-api/media/v4l/metafmt-vivid.rst |   1 +
 .../media/v4l/metafmt-vsp1-hgo.rst            |   1 +
 .../media/v4l/metafmt-vsp1-hgt.rst            |   1 +
 .../userspace-api/media/v4l/pixfmt-bayer.rst  |   1 +
 .../userspace-api/media/v4l/pixfmt-cnf4.rst   |   1 +
 .../media/v4l/pixfmt-compressed.rst           |   1 +
 .../media/v4l/pixfmt-indexed.rst              |   1 +
 .../userspace-api/media/v4l/pixfmt-intro.rst  |   1 +
 .../userspace-api/media/v4l/pixfmt-inzi.rst   |   1 +
 .../userspace-api/media/v4l/pixfmt-m420.rst   |   1 +
 .../media/v4l/pixfmt-packed-hsv.rst           |   1 +
 .../media/v4l/pixfmt-packed-yuv.rst           |   1 +
 .../media/v4l/pixfmt-reserved.rst             |   1 +
 .../userspace-api/media/v4l/pixfmt-rgb.rst    |   1 +
 .../media/v4l/pixfmt-sdr-cs08.rst             |   1 +
 .../media/v4l/pixfmt-sdr-cs14le.rst           |   1 +
 .../media/v4l/pixfmt-sdr-cu08.rst             |   1 +
 .../media/v4l/pixfmt-sdr-cu16le.rst           |   1 +
 .../media/v4l/pixfmt-sdr-pcu16be.rst          |   1 +
 .../media/v4l/pixfmt-sdr-pcu18be.rst          |   1 +
 .../media/v4l/pixfmt-sdr-pcu20be.rst          |   1 +
 .../media/v4l/pixfmt-sdr-ru12le.rst           |   1 +
 .../media/v4l/pixfmt-srggb10-ipu3.rst         |   1 +
 .../media/v4l/pixfmt-srggb10.rst              |   1 +
 .../media/v4l/pixfmt-srggb10alaw8.rst         |   1 +
 .../media/v4l/pixfmt-srggb10dpcm8.rst         |   1 +
 .../media/v4l/pixfmt-srggb10p.rst             |   1 +
 .../media/v4l/pixfmt-srggb12.rst              |   1 +
 .../media/v4l/pixfmt-srggb12p.rst             |   1 +
 .../media/v4l/pixfmt-srggb14.rst              |   1 +
 .../media/v4l/pixfmt-srggb14p.rst             |   1 +
 .../media/v4l/pixfmt-srggb16.rst              |   1 +
 .../media/v4l/pixfmt-srggb8-pisp-comp.rst     |   1 +
 .../userspace-api/media/v4l/pixfmt-srggb8.rst |   1 +
 .../media/v4l/pixfmt-tch-td08.rst             |   1 +
 .../media/v4l/pixfmt-tch-td16.rst             |   1 +
 .../media/v4l/pixfmt-tch-tu08.rst             |   1 +
 .../media/v4l/pixfmt-tch-tu16.rst             |   1 +
 .../userspace-api/media/v4l/pixfmt-uv8.rst    |   1 +
 .../media/v4l/pixfmt-v4l2-mplane.rst          |   1 +
 .../userspace-api/media/v4l/pixfmt-v4l2.rst   |   1 +
 .../userspace-api/media/v4l/pixfmt-y12i.rst   |   1 +
 .../userspace-api/media/v4l/pixfmt-y16i.rst   |   1 +
 .../userspace-api/media/v4l/pixfmt-y8i.rst    |   1 +
 .../media/v4l/pixfmt-yuv-luma.rst             |   1 +
 .../media/v4l/pixfmt-yuv-planar.rst           |   1 +
 .../userspace-api/media/v4l/pixfmt-z16.rst    |   1 +
 .../userspace-api/media/v4l/pixfmt.rst        |   1 +
 .../userspace-api/media/v4l/planar-apis.rst   |   1 +
 .../userspace-api/media/v4l/querycap.rst      |   1 +
 .../userspace-api/media/v4l/sdr-formats.rst   |   1 +
 .../media/v4l/selection-api-configuration.rst |   1 +
 .../media/v4l/selection-api-examples.rst      |   1 +
 .../media/v4l/selection-api-intro.rst         |   1 +
 .../media/v4l/selection-api-targets.rst       |   1 +
 .../media/v4l/selection-api-vs-crop-api.rst   |   1 +
 .../userspace-api/media/v4l/selection-api.rst |   1 +
 .../media/v4l/selections-common.rst           |   1 +
 .../userspace-api/media/v4l/standard.rst      |   1 +
 .../media/v4l/subdev-formats.rst              |   1 +
 .../userspace-api/media/v4l/tch-formats.rst   |   1 +
 .../userspace-api/media/v4l/tuner.rst         |   1 +
 .../userspace-api/media/v4l/user-func.rst     |   1 +
 .../media/v4l/v4l2-selection-flags.rst        |   1 +
 .../media/v4l/v4l2-selection-targets.rst      |   1 +
 .../userspace-api/media/v4l/v4l2.rst          |   1 +
 .../media/v4l/v4l2grab-example.rst            |   1 +
 .../userspace-api/media/v4l/v4l2grab.c.rst    |   1 +
 .../userspace-api/media/v4l/video.rst         |   1 +
 .../userspace-api/media/v4l/videodev.rst      |   9 +-
 .../media/v4l/videodev2.h.rst.exceptions      | 288 +++++++++---------
 .../media/v4l/vidioc-queryctrl.rst            |   8 +
 .../userspace-api/media/v4l/yuv-formats.rst   |   1 +
 tools/docs/lib/parse_data_structs.py          | 230 ++++++++------
 tools/docs/parse-headers.py                   |   5 +-
 141 files changed, 608 insertions(+), 324 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/23 tools: docs: parse_data_structs.py: drop contents header

When used in practice, one may want to have multiple header files on a single rst file, like:

	***********************
	Digital TV uAPI symbols
	***********************

	.. contents:: Table of Contents
	   :depth: 2
	   :local:

	Frontend
	========

	.. kernel-include:: include/uapi/linux/dvb/frontend.h
	    :generate-cross-refs:
	    :toc:

	Demux
	=====

	.. kernel-include:: include/uapi/linux/dvb/dmx.h
	    :generate-cross-refs:
	    :toc:

	...

So, don't add ..contents:: here.

---
 tools/docs/lib/parse_data_structs.py | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
tools/docs/lib/parse_data_structs.py +1 -7
index a5aa2e182052..6c868f84f029 100755
@@ -397,16 +397,10 @@ class ParseDataStructs:
 
     def gen_toc(self):
         """
-        Create a TOC table pointing to each symbol from the header
+        Create a list of symbols to be part of a TOC contents table
         """
         text = []
 
-        # Add header
-        text.append(".. contents:: Table of Contents")
-        text.append("   :depth: 2")
-        text.append("   :local:")
-        text.append("")
-
         # Sort symbol types per description
         symbol_descriptions = []
         for k, v in self.DEF_SYMBOL_TYPES.items():
Signature · 1 line
2.51.0
#2 lore raw

PATCH 2/23 tools: docs: parse_data_structs.py: output a line number

In reply to Mauro Carvalho Chehab
---
 tools/docs/lib/parse_data_structs.py | 29 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
tools/docs/lib/parse_data_structs.py +15 -14
index 6c868f84f029..d28471a045f1 100755
@@ -143,7 +143,7 @@ class ParseDataStructs:
         for symbol_type in self.DEF_SYMBOL_TYPES:
             self.symbols[symbol_type] = {}
 
-    def store_type(self, symbol_type: str, symbol: str,
+    def store_type(self, ln, symbol_type: str, symbol: str,
                    ref_name: str = None, replace_underscores: bool = True):
         """
         Stores a new symbol at self.symbols under symbol_type.
@@ -172,7 +172,7 @@ class ParseDataStructs:
         else:
             ref_link = symbol
 
-        self.symbols[symbol_type][symbol] = f"{prefix}{ref_link}{suffix}"
+        self.symbols[symbol_type][symbol] = (f"{prefix}{ref_link}{suffix}", ln)
 
     def store_line(self, line):
         """Stores a line at self.data, properly indented"""
@@ -240,20 +240,20 @@ class ParseDataStructs:
                 if is_enum:
                     match = re.match(r"^\s*([_\w][\w\d_]+)\s*[\,=]?", line)
                     if match:
-                        self.store_type("symbol", match.group(1))
+                        self.store_type(line_no, "symbol", match.group(1))
                     if "}" in line:
                         is_enum = False
                     continue
 
                 match = re.match(r"^\s*#\s*define\s+([\w_]+)\s+_IO", line)
                 if match:
-                    self.store_type("ioctl", match.group(1),
+                    self.store_type(line_no, "ioctl", match.group(1),
                                     replace_underscores=False)
                     continue
 
                 match = re.match(r"^\s*#\s*define\s+([\w_]+)(\s+|$)", line)
                 if match:
-                    self.store_type("define", match.group(1))
+                    self.store_type(line_no, "define", match.group(1))
                     continue
 
                 match = re.match(r"^\s*typedef\s+([_\w][\w\d_]+)\s+(.*)\s+([_\w][\w\d_]+);",
@@ -261,20 +261,20 @@ class ParseDataStructs:
                 if match:
                     name = match.group(2).strip()
                     symbol = match.group(3)
-                    self.store_type("typedef", symbol, ref_name=name)
+                    self.store_type(line_no, "typedef", symbol, ref_name=name)
                     continue
 
                 for re_enum in self.RE_ENUMS:
                     match = re_enum.match(line)
                     if match:
-                        self.store_type("enum", match.group(1))
+                        self.store_type(line_no, "enum", match.group(1))
                         is_enum = True
                         break
 
                 for re_struct in self.RE_STRUCTS:
                     match = re_struct.match(line)
                     if match:
-                        self.store_type("struct", match.group(1))
+                        self.store_type(line_no, "struct", match.group(1))
                         break
 
     def process_exceptions(self, fname: str):
@@ -342,7 +342,8 @@ class ParseDataStructs:
 
                 # Change self.symbols to use the replacement rule
                 if old in self.symbols[c_type]:
-                    self.symbols[c_type][old] = new_ref
+                    (_, ln) = self.symbols[c_type][old]
+                    self.symbols[c_type][old] = (new_ref, ln)
                 else:
                     print(f"{name}:{ln}: Warning: can't find {old} {c_type}")
 
@@ -360,8 +361,8 @@ class ParseDataStructs:
 
             print(f"{c_type}:")
 
-            for symbol, ref in sorted(refs.items()):
-                print(f"  {symbol} -> {ref}")
+            for symbol, (ref, ln) in sorted(refs.items()):
+                print(f"  #{ln:<5d} {symbol} -> {ref}")
 
             print()
 
@@ -384,7 +385,7 @@ class ParseDataStructs:
 
         # Process all reference types
         for ref_dict in self.symbols.values():
-            for symbol, replacement in ref_dict.items():
+            for symbol, (replacement, _) in ref_dict.items():
                 symbol = re.escape(re.sub(r"([\_\`\*\<\>\&\\\\:\/])", r"\\\1", symbol))
                 text = re.sub(fr'{start_delim}{symbol}{end_delim}',
                               fr'\1{replacement}\2', text)
@@ -420,8 +421,8 @@ class ParseDataStructs:
             text.append("")
 
             # Sort symbols alphabetically
-            for symbol, ref in sorted(refs.items()):
-                text.append(f"* :{ref}:")
+            for symbol, (ref, ln) in sorted(refs.items()):
+                text.append(f"* {ref}: line #{ln}")
 
             text.append("")  # Add empty line between categories
 
Signature · 1 line
2.51.0
#5 lore raw

PATCH 3/23 docs: kernel_include.py: fix line numbers for TOC

In reply to Mauro Carvalho Chehab

On TOC output, we need to embeed line numbers with ViewList.

Change the parse class to produce a line-number parsed result, and adjust the output accordingly.

---
 Documentation/sphinx/kernel_include.py | 36 ++++++++++++++++----------
 tools/docs/lib/parse_data_structs.py   |  2 +-
 2 files changed, 24 insertions(+), 14 deletions(-)
Documentation/sphinx/kernel_include.py +23 -13
index f94412cd17c9..ed819e9821c2 100755
@@ -104,6 +104,7 @@ logger = logging.getLogger(__name__)
 
 RE_DOMAIN_REF = re.compile(r'\\ :(ref|c:type|c:func):`([^<`]+)(?:<([^>]+)>)?`\\')
 RE_SIMPLE_REF = re.compile(r'`([^`]+)`')
+RE_LINENO_REF = re.compile(r'^\s*-\s+LINENO_(\d+):\s+(.*)')
 
 def ErrorString(exc):  # Shamelessly stolen from docutils
     return f'{exc.__class__.__name}: {exc}'
@@ -242,23 +243,32 @@ class KernelInclude(Directive):
         # TOC output is a ReST file, not a literal. So, we can add line
         # numbers
 
-        rawtext = parser.gen_toc()
-
-        include_lines = statemachine.string2lines(rawtext, tab_width,
-                                                  convert_whitespace=True)
-
-        # Append line numbers data
-
         startline = self.options.get('start-line', None)
+        endline = self.options.get('end-line', None)
+
+        relpath = os.path.relpath(path, srctree)
 
         result = ViewList()
-        if startline and startline > 0:
-            offset = startline - 1
-        else:
-            offset = 0
+        for line in parser.gen_toc().split("\n"):
+            match = RE_LINENO_REF.match(line)
+            if not match:
+                result.append(line, path)
+                continue
 
-        for ln, line in enumerate(include_lines, start=offset):
-            result.append(line, path, ln)
+            ln, ref = match.groups()
+            ln = int(ln)
+
+            # Filter line range if needed
+            if startline and (ln < startline):
+                continue
+
+            if endline and (ln > endline):
+                continue
+
+            # Sphinx numerates starting with zero, but text editors
+            # and other tools start from one
+            realln = ln + 1
+            result.append(f"- {ref}: {relpath}#{realln}", path, ln)
 
         self.state_machine.insert_input(result, path)
 
tools/docs/lib/parse_data_structs.py +1 -1
index d28471a045f1..9ad621712103 100755
@@ -422,7 +422,7 @@ class ParseDataStructs:
 
             # Sort symbols alphabetically
             for symbol, (ref, ln) in sorted(refs.items()):
-                text.append(f"* {ref}: line #{ln}")
+                text.append(f"- LINENO_{ln}: {ref}")
 
             text.append("")  # Add empty line between categories
 
Signature · 1 line
2.51.0
#6 lore raw

PATCH 4/23 docs: kernel_include.py: propose alternatives

In reply to Mauro Carvalho Chehab

Specially when using c::namespace, it is not hard to break a reference by forgetting to add a domain. Also, different cases and using "-"/"_" the wrong way are typical cases that people often gets wrong.

We might use a more complex logic here to also check for typos, but let's keep it plain, simple.

This is enough to get thos exeptions from media controller:

.../include/uapi/linux/media.h:26: WARNING: Invalid xref: c:type:media_device_info. Possible alternatives:
c:type:MC.media_device_info (from mediactl/media-ioc-device-info)
.../include/uapi/linux/media.h:149: WARNING: Invalid xref: c:type:media_entity_desc. Possible alternatives:
c:type:MC.media_entity_desc (from mediactl/media-ioc-enum-entities)
.../include/uapi/linux/media.h:228: WARNING: Invalid xref: c:type:media_link_desc. Possible alternatives:
c:type:MC.media_link_desc (from mediactl/media-ioc-enum-links)
.../include/uapi/linux/media.h:235: WARNING: Invalid xref: c:type:media_links_enum. Possible alternatives:
c:type:MC.media_links_enum (from mediactl/media-ioc-enum-links)
.../include/uapi/linux/media.h:212: WARNING: Invalid xref: c:type:media_pad_desc. Possible alternatives:
c:type:MC.media_pad_desc (from mediactl/media-ioc-enum-links)
.../include/uapi/linux/media.h:298: WARNING: Invalid xref: c:type:media_v2_entity. Possible alternatives:
c:type:MC.media_v2_entity (from mediactl/media-ioc-g-topology)
.../include/uapi/linux/media.h:312: WARNING: Invalid xref: c:type:media_v2_interface. Possible alternatives:
c:type:MC.media_v2_interface (from mediactl/media-ioc-g-topology)
.../include/uapi/linux/media.h:307: WARNING: Invalid xref: c:type:media_v2_intf_devnode. Possible alternatives:
c:type:MC.media_v2_intf_devnode (from mediactl/media-ioc-g-topology)
.../include/uapi/linux/media.h:341: WARNING: Invalid xref: c:type:media_v2_link. Possible alternatives:
c:type:MC.media_v2_link (from mediactl/media-ioc-g-topology)
.../include/uapi/linux/media.h:333: WARNING: Invalid xref: c:type:media_v2_pad. Possible alternatives:
c:type:MC.media_v2_pad (from mediactl/media-ioc-g-topology)
.../include/uapi/linux/media.h:349: WARNING: Invalid xref: c:type:media_v2_topology. Possible alternatives:
c:type:MC.media_v2_topology (from mediactl/media-ioc-g-topology)

---
 Documentation/sphinx/kernel_include.py        | 70 ++++++++++++++++++-
 .../userspace-api/media/v4l/videodev.rst      |  8 ++-
 .../media/v4l/videodev2.h.rst.exceptions      |  3 +
 3 files changed, 77 insertions(+), 4 deletions(-)
Documentation/sphinx/kernel_include.py +69 -1
index ed819e9821c2..e8f7e7a49758 100755
@@ -105,6 +105,7 @@ logger = logging.getLogger(__name__)
 RE_DOMAIN_REF = re.compile(r'\\ :(ref|c:type|c:func):`([^<`]+)(?:<([^>]+)>)?`\\')
 RE_SIMPLE_REF = re.compile(r'`([^`]+)`')
 RE_LINENO_REF = re.compile(r'^\s*-\s+LINENO_(\d+):\s+(.*)')
+RE_SPLIT_DOMAIN = re.compile(r"(.*)\.(.*)")
 
 def ErrorString(exc):  # Shamelessly stolen from docutils
     return f'{exc.__class__.__name}: {exc}'
@@ -399,6 +400,67 @@ class KernelInclude(Directive):
 
 reported = set()
 
+DOMAIN_INFO = {}
+
+def fill_domain_info(env):
+    """
+    Get supported reference types for each Sphinx domain and C namespaces
+    """
+    if DOMAIN_INFO:
+        return
+
+    for domain_name, domain_instance in env.domains.items():
+        try:
+            object_types = list(domain_instance.object_types.keys())
+            DOMAIN_INFO[domain_name] = object_types
+        except AttributeError:
+            # Ignore domains that we can't retrieve object types, if any
+            pass
+
+def get_suggestions(app, env, node,
+                    original_target, original_domain, original_reftype):
+    """Check if target exists in the other domain or with different reftypes."""
+    original_target = original_target.lower()
+
+    # Remove namespace if present
+    if '.' in original_target:
+        original_target = original_target.split(".")[-1]
+
+    targets = set([
+        original_target,
+        original_target.replace("-", "_"),
+        original_target.replace("_", "-"),
+    ])
+
+    # Propose some suggestions, if possible
+    # The code below checks not only variants of the target, but also it
+    # works when .. c:namespace:: targets setting a different C namespace
+    # is in place
+
+    suggestions = []
+    for target in sorted(targets):
+        for domain in DOMAIN_INFO.keys():
+            domain_obj = env.get_domain(domain)
+            for name, dispname, objtype, docname, anchor, priority in domain_obj.get_objects():
+                lower_name = name.lower()
+
+                if domain == "c":
+                    # Check if name belongs to a different C namespace
+                    match = RE_SPLIT_DOMAIN.match(name)
+                    if match:
+                        if target != match.group(2).lower():
+                            continue
+                    else:
+                        if target !=  lower_name:
+                            continue
+                else:
+                    if target != lower_name:
+                        continue
+
+                suggestions.append(f"\t{domain}:{objtype}:`{name}` (from {docname})")
+
+    return suggestions
+
 def check_missing_refs(app, env, node, contnode):
     """Check broken refs for the files it creates xrefs"""
     if not node.source:
@@ -414,11 +476,13 @@ def check_missing_refs(app, env, node, contnode):
     if node.source not in xref_files:
         return None
 
+    fill_domain_info(env)
+
     target = node.get('reftarget', '')
     domain = node.get('refdomain', 'std')
     reftype = node.get('reftype', '')
 
-    msg = f"can't link to: {domain}:{reftype}:: {target}"
+    msg = f"Invalid xref: {domain}:{reftype}:`{target}`"
 
     # Don't duplicate warnings
     data = (node.source, msg)
@@ -426,6 +490,10 @@ def check_missing_refs(app, env, node, contnode):
         return None
     reported.add(data)
 
+    suggestions = get_suggestions(app, env, node, target, domain, reftype)
+    if suggestions:
+        msg += ". Possible alternatives:\n" + '\n'.join(suggestions)
+
     logger.warning(msg, location=node, type='ref', subtype='missing')
 
     return None
Documentation/userspace-api/media/v4l/videodev.rst +5 -3
index cde485bc9a5f..64be44716494 100644
@@ -2,10 +2,12 @@
 
 .. _videodev:
 
-*******************************
-Video For Linux Two Header File
-*******************************
+***************************************
+Video For Linux Two Header uAPI Symbols
+***************************************
 
 .. kernel-include:: include/uapi/linux/videodev2.h
     :generate-cross-refs:
     :exception-file: videodev2.h.rst.exceptions
+    :toc:
+    :warn-broken:
Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions +3 -0
index 35d3456cc812..951d01bf7579 100644
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
+# All symbols are mapped inside V4L C domain namespace
+namespace V4L
+
 # Ignore header name
 ignore define _UAPI__LINUX_VIDEODEV2_H
 
Signature · 1 line
2.51.0
#7 lore raw

PATCH 5/23 tools: docs: parse_data_structs: make process_exceptions two stages

In reply to Mauro Carvalho Chehab

Split the logic which parses exceptions on two stages, preparing the exceptions file to have rules that will affect xref generation.

For now, preserve the original API.

---
 tools/docs/lib/parse_data_structs.py | 125 +++++++++++++++------------
 1 file changed, 71 insertions(+), 54 deletions(-)
tools/docs/lib/parse_data_structs.py +71 -54
index 9ad621712103..46535a05ea4a 100755
@@ -140,9 +140,41 @@ class ParseDataStructs:
 
         self.symbols = {}
 
+        self.ignore = []
+        self.replace = []
+
         for symbol_type in self.DEF_SYMBOL_TYPES:
             self.symbols[symbol_type] = {}
 
+    def read_exceptions(self, fname: str):
+        if not fname:
+            return
+
+        name = os.path.basename(fname)
+
+        with open(fname, "r", encoding="utf-8", errors="backslashreplace") as f:
+            for ln, line in enumerate(f):
+                ln += 1
+                line = line.strip()
+                if not line or line.startswith("#"):
+                    continue
+
+                # ignore rules
+                match = re.match(r"^ignore\s+(\w+)\s+(\S+)", line)
+
+                if match:
+                    self.ignore.append((ln, match.group(1), match.group(2)))
+                    continue
+
+                # replace rules
+                match = re.match(r"^replace\s+(\S+)\s+(\S+)\s+(\S+)", line)
+                if match:
+                    self.replace.append((ln, match.group(1), match.group(2),
+                                         match.group(3)))
+                    continue
+
+                sys.exit(f"{name}:{ln}: invalid line: {line}")
+
     def store_type(self, ln, symbol_type: str, symbol: str,
                    ref_name: str = None, replace_underscores: bool = True):
         """
@@ -277,75 +309,60 @@ class ParseDataStructs:
                         self.store_type(line_no, "struct", match.group(1))
                         break
 
-    def process_exceptions(self, fname: str):
+    def apply_exceptions(self):
         """
         Process exceptions file with rules to ignore or replace references.
         """
-        if not fname:
-            return
 
-        name = os.path.basename(fname)
+        # Handle ignore rules
+        for ln, c_type, symbol in self.ignore:
+            if c_type not in self.DEF_SYMBOL_TYPES:
+                sys.exit(f"{name}:{ln}: {c_type} is invalid")
 
-        with open(fname, "r", encoding="utf-8", errors="backslashreplace") as f:
-            for ln, line in enumerate(f):
-                ln += 1
-                line = line.strip()
-                if not line or line.startswith("#"):
-                    continue
+            d = self.symbols[c_type]
+            if symbol in d:
+                del d[symbol]
 
-                # Handle ignore rules
-                match = re.match(r"^ignore\s+(\w+)\s+(\S+)", line)
-                if match:
-                    c_type = match.group(1)
-                    symbol = match.group(2)
-
-                    if c_type not in self.DEF_SYMBOL_TYPES:
-                        sys.exit(f"{name}:{ln}: {c_type} is invalid")
-
-                    d = self.symbols[c_type]
-                    if symbol in d:
-                        del d[symbol]
-
-                    continue
-
-                # Handle replace rules
-                match = re.match(r"^replace\s+(\S+)\s+(\S+)\s+(\S+)", line)
-                if not match:
-                    sys.exit(f"{name}:{ln}: invalid line: {line}")
-
-                c_type, old, new = match.groups()
-
-                if c_type not in self.DEF_SYMBOL_TYPES:
-                    sys.exit(f"{name}:{ln}: {c_type} is invalid")
+        # Handle replace rules
+        for ln, c_type, old, new in self.replace:
+            if c_type not in self.DEF_SYMBOL_TYPES:
+                sys.exit(f"{name}:{ln}: {c_type} is invalid")
 
-                reftype = None
+            reftype = None
 
-                # Parse reference type when the type is specified
+            # Parse reference type when the type is specified
 
-                match = re.match(r"^\:c\:(data|func|macro|type)\:\`(.+)\`", new)
+            match = re.match(r"^\:c\:(data|func|macro|type)\:\`(.+)\`", new)
+            if match:
+                reftype = f":c:{match.group(1)}"
+                new = match.group(2)
+            else:
+                match = re.search(r"(\:ref)\:\`(.+)\`", new)
                 if match:
-                    reftype = f":c:{match.group(1)}"
+                    reftype = match.group(1)
                     new = match.group(2)
-                else:
-                    match = re.search(r"(\:ref)\:\`(.+)\`", new)
-                    if match:
-                        reftype = match.group(1)
-                        new = match.group(2)
 
-                # If the replacement rule doesn't have a type, get default
+            # If the replacement rule doesn't have a type, get default
+            if not reftype:
+                reftype = self.DEF_SYMBOL_TYPES[c_type].get("ref_type")
                 if not reftype:
-                    reftype = self.DEF_SYMBOL_TYPES[c_type].get("ref_type")
-                    if not reftype:
-                        reftype = self.DEF_SYMBOL_TYPES[c_type].get("real_type")
+                    reftype = self.DEF_SYMBOL_TYPES[c_type].get("real_type")
 
-                new_ref = f"{reftype}:`{old} <{new}>`"
+            new_ref = f"{reftype}:`{old} <{new}>`"
 
-                # Change self.symbols to use the replacement rule
-                if old in self.symbols[c_type]:
-                    (_, ln) = self.symbols[c_type][old]
-                    self.symbols[c_type][old] = (new_ref, ln)
-                else:
-                    print(f"{name}:{ln}: Warning: can't find {old} {c_type}")
+            # Change self.symbols to use the replacement rule
+            if old in self.symbols[c_type]:
+                (_, ln) = self.symbols[c_type][old]
+                self.symbols[c_type][old] = (new_ref, ln)
+            else:
+                print(f"{name}:{ln}: Warning: can't find {old} {c_type}")
+
+    def process_exceptions(self, fname: str):
+        """
+        Process exceptions file with rules to ignore or replace references.
+        """
+        self.read_exceptions(fname)
+        self.apply_exceptions()
 
     def debug_print(self):
         """
Signature · 1 line
2.51.0
#8 lore raw

PATCH 6/23 tools: docs: parse_data_structs.py: get rid of process_exceptions()

In reply to Mauro Carvalho Chehab

Add an extra parameter to parse_file to make it handle exceptions internally, cleaning up the API.

---
 Documentation/sphinx/kernel_include.py |   6 +-
 tools/docs/lib/parse_data_structs.py   | 105 ++++++++++++-------------
 tools/docs/parse-headers.py            |   5 +-
 3 files changed, 56 insertions(+), 60 deletions(-)
Documentation/sphinx/kernel_include.py +4 -2
index e8f7e7a49758..895646da7495 100755
@@ -214,14 +214,16 @@ class KernelInclude(Directive):
         - a TOC table containing cross references.
         """
         parser = ParseDataStructs()
-        parser.parse_file(path)
 
         if 'exception-file' in self.options:
             source_dir = os.path.dirname(os.path.abspath(
                 self.state_machine.input_lines.source(
                     self.lineno - self.state_machine.input_offset - 1)))
             exceptions_file = os.path.join(source_dir, self.options['exception-file'])
-            parser.process_exceptions(exceptions_file)
+        else:
+            exceptions_file = None
+
+        parser.parse_file(path, exceptions_file)
 
         # Store references on a symbol dict to be used at check time
         if 'warn-broken' in self.options:
tools/docs/lib/parse_data_structs.py +51 -54

129 lines not on this page · raw message

tools/docs/parse-headers.py +1 -4
index bfa4e46a53e3..6716c7300258 100755
@@ -47,10 +47,7 @@ def main():
     args = parser.parse_args()
 
     parser = ParseDataStructs(debug=args.debug)
-    parser.parse_file(args.file_in)
-
-    if args.file_rules:
-        parser.process_exceptions(args.file_rules)
+    parser.parse_file(args.file_in, args.file_rules)
 
     parser.debug_print()
     parser.write_output(args.file_in, args.file_out, args.toc)
Signature · 1 line
2.51.0
#9 lore raw

PATCH 7/23 tools: docs: parse_data_structs.py: add namespace support

In reply to Mauro Carvalho Chehab

C domain supports a ".. c:namespace::" tag that allows setting a symbol namespace. This is used within the kernel to avoid warnings about duplicated symbols. This is specially important for syscalls, as each subsystem may have their own documentation for them. This is specially true for ioctl.

When such tag is used, all C domain symbols have c++ style, e.g. they'll become "{namespace}.{reference}".

Allow specifying C namespace at the exception files, avoiding the need of override rules for every symbol.

---
 tools/docs/lib/parse_data_structs.py | 43 +++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 11 deletions(-)
tools/docs/lib/parse_data_structs.py +32 -11
index cbdbf7dfe785..0d537e989ea7 100755
@@ -53,11 +53,19 @@ class ParseDataStructs:
 
         replace <type> <old_symbol> <new_reference>
 
-    Replaces how old_symbol with a new reference. The new_reference can be:
+       Replaces how old_symbol with a new reference. The new_reference can be:
+
         - A simple symbol name;
         - A full Sphinx reference.
 
-    On both cases, <type> can be:
+    3. Namespace rules
+
+        namespace <namespace>
+
+       Sets C namespace to be used during cross-reference generation. Can
+       be overridden by replace rules.
+
+    On ignore and replace rules, <type> can be:
         - ioctl: for defines that end with _IO*, e.g. ioctl definitions
         - define: for other defines
         - symbol: for symbols defined within enums;
@@ -71,6 +79,8 @@ class ParseDataStructs:
         ignore ioctl VIDIOC_ENUM_FMT
         replace ioctl VIDIOC_DQBUF vidioc_qbuf
         replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`v4l2_event_motion_det`
+
+        namespace MC
     """
 
     # Parser regexes with multiple ways to capture enums and structs
@@ -140,6 +150,7 @@ class ParseDataStructs:
 
         self.symbols = {}
 
+        self.namespace = None
         self.ignore = []
         self.replace = []
 
@@ -173,6 +184,11 @@ class ParseDataStructs:
                                          match.group(3)))
                     continue
 
+                match = re.match(r"^namespace\s+(\S+)", line)
+                if match:
+                    self.namespace = match.group(1)
+                    continue
+
                 sys.exit(f"{name}:{ln}: invalid line: {line}")
 
     def apply_exceptions(self):
@@ -237,18 +253,23 @@ class ParseDataStructs:
         ref_type = defs.get("ref_type")
 
         # Determine ref_link based on symbol type
-        if ref_type:
-            if symbol_type == "enum":
-                ref_link = f"{ref_type}:`{symbol}`"
-            else:
-                if not ref_name:
-                    ref_name = symbol.lower()
+        if ref_type or self.namespace:
+            if not ref_name:
+                ref_name = symbol.lower()
 
-                # c-type references don't support hash
-                if ref_type == ":ref" and replace_underscores:
-                    ref_name = ref_name.replace("_", "-")
+            # c-type references don't support hash
+            if ref_type == ":ref" and replace_underscores:
+                ref_name = ref_name.replace("_", "-")
 
+            # C domain references may have namespaces
+            if ref_type.startswith(":c:"):
+                if self.namespace:
+                    ref_name = f"{self.namespace}.{ref_name}"
+
+            if ref_type:
                 ref_link = f"{ref_type}:`{symbol} <{ref_name}>`"
+            else:
+                ref_link = f"`{symbol} <{ref_name}>`"
         else:
             ref_link = symbol
 
Signature · 1 line
2.51.0
#10 lore raw

PATCH 8/23 tools: docs: parse_data_structs.py: accept more reftypes

In reply to Mauro Carvalho Chehab

Current regex is limited to only some c-domain reftypes. There are several others.

Change the code to pick the name specified there.

---
 tools/docs/lib/parse_data_structs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/docs/lib/parse_data_structs.py +1 -1
index 0d537e989ea7..25361996cd20 100755
@@ -214,7 +214,7 @@ class ParseDataStructs:
 
             # Parse reference type when the type is specified
 
-            match = re.match(r"^\:c\:(data|func|macro|type)\:\`(.+)\`", new)
+            match = re.match(r"^\:c\:(\w+)\:\`(.+)\`", new)
             if match:
                 reftype = f":c:{match.group(1)}"
                 new = match.group(2)
Signature · 1 line
2.51.0
#11 lore raw

PATCH 9/23 docs: media: dvb: use TOC instead of file contents at headers

In reply to Mauro Carvalho Chehab

All we wanted were to have a way to link the comprehensive documentation with the actual symbols parsed from the header file, as this helps to identify any broken references.

Use the new :toc: flag for DVB.

---
 .../userspace-api/media/dvb/headers.rst       | 27 +++++++++++++++----
 1 file changed, 22 insertions(+), 5 deletions(-)
Documentation/userspace-api/media/dvb/headers.rst +22 -5
index c75f64cf21d5..e78122944a69 100644
@@ -1,25 +1,42 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
 
-****************************
-Digital TV uAPI header files
-****************************
-
-Digital TV uAPI headers
 ***********************
+Digital TV uAPI symbols
+***********************
+
+.. contents:: Table of Contents
+   :depth: 2
+   :local:
+
+Frontend
+========
 
 .. kernel-include:: include/uapi/linux/dvb/frontend.h
     :generate-cross-refs:
     :exception-file: frontend.h.rst.exceptions
+    :toc:
+
+Demux
+=====
 
 .. kernel-include:: include/uapi/linux/dvb/dmx.h
     :generate-cross-refs:
     :exception-file: dmx.h.rst.exceptions
+    :toc:
+
+Conditional Access
+==================
 
 .. kernel-include:: include/uapi/linux/dvb/ca.h
     :generate-cross-refs:
     :exception-file: ca.h.rst.exceptions
+    :toc:
+
+Network
+=======
 
 .. kernel-include:: include/uapi/linux/dvb/net.h
     :generate-cross-refs:
     :exception-file: net.h.rst.exceptions
+    :toc:
 
Signature · 1 line
2.51.0
#12 lore raw

PATCH 10/23 docs: media: dvb: enable warnings for most headers

In reply to Mauro Carvalho Chehab

Except for two exception rules and dmx.h, the other files are already handling properly cross references.

Fix the two exception rules for frontend.h, as those are false-positives:

include/uapi/linux/dvb/frontend.h:959: WARNING: can't link to: c:type:: FE_GET_PROPERTY include/uapi/linux/dvb/frontend.h:933: WARNING: can't link to: c:func:: FE_SET_FRONTEND_TUNE_MODE

The dmx.h are actual issues that will require an extra patch to fill gaps.

---
 .../userspace-api/media/dvb/frontend.h.rst.exceptions        | 5 +++--
 Documentation/userspace-api/media/dvb/headers.rst            | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)
Documentation/userspace-api/media/dvb/frontend.h.rst.exceptions +3 -2
index dcaf5740de7e..cecd4087d4be 100644
@@ -28,13 +28,14 @@ ignore define MAX_DTV_STATS
 ignore define DTV_IOCTL_MAX_MSGS
 
 # the same reference is used for both get and set ioctls
-replace ioctl FE_SET_PROPERTY :c:type:`FE_GET_PROPERTY`
+replace ioctl FE_SET_PROPERTY :ref:`FE_GET_PROPERTY`
+replace ioctl FE_GET_PROPERTY :ref:`FE_GET_PROPERTY`
 
 # Typedefs that use the enum reference
 replace typedef fe_sec_voltage_t :c:type:`fe_sec_voltage`
 
 # Replaces for flag constants
-replace define FE_TUNE_MODE_ONESHOT :c:func:`FE_SET_FRONTEND_TUNE_MODE`
+replace define FE_TUNE_MODE_ONESHOT :ref:`FE_SET_FRONTEND_TUNE_MODE`
 replace define LNA_AUTO dtv-lna
 replace define NO_STREAM_ID_FILTER dtv-stream-id
 
Documentation/userspace-api/media/dvb/headers.rst +3 -0
index e78122944a69..3c492ae109ae 100644
@@ -15,6 +15,7 @@ Frontend
     :generate-cross-refs:
     :exception-file: frontend.h.rst.exceptions
     :toc:
+    :warn-broken:
 
 Demux
 =====
@@ -31,6 +32,7 @@ Conditional Access
     :generate-cross-refs:
     :exception-file: ca.h.rst.exceptions
     :toc:
+    :warn-broken:
 
 Network
 =======
@@ -39,4 +41,5 @@ Network
     :generate-cross-refs:
     :exception-file: net.h.rst.exceptions
     :toc:
+    :warn-broken:
 
Signature · 1 line
2.51.0
#13 lore raw

PATCH 11/23 docs: media: rc: use TOC instead of file contents for LIRC header

In reply to Mauro Carvalho Chehab

All we wanted were to have a way to link the comprehensive documentation with the actual symbols parsed from the header file, as this helps to identify any broken references.

Use the new :toc: flag for LIRC and enable warnings.

---
 .../userspace-api/media/rc/lirc-header.rst         | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
Documentation/userspace-api/media/rc/lirc-header.rst +11 -3
index a53328327847..ba4992625684 100644
@@ -2,11 +2,19 @@
 
 .. _lirc_header:
 
-****************
-LIRC Header File
-****************
+*****************
+LIRC uAPI symbols
+*****************
+
+.. contents:: Table of Contents
+   :depth: 2
+   :local:
+
+
 
 .. kernel-include:: include/uapi/linux/lirc.h
     :generate-cross-refs:
     :exception-file: lirc.h.rst.exceptions
+    :toc:
+    :warn-broken:
 
Signature · 1 line
2.51.0
#14 lore raw

PATCH 12/23 docs: media: mediactl: use TOC instead of file contents

In reply to Mauro Carvalho Chehab

All we wanted were to have a way to link the comprehensive documentation with the actual symbols parsed from the header file, as this helps to identify any broken references.

Use the new :toc: flag for media controller and enable warnings.

Here, we need to adjust the exceptions file to setup the C namespace accordingly.

---
 .../userspace-api/media/mediactl/media-header.rst         | 8 +++++---
 .../userspace-api/media/mediactl/media.h.rst.exceptions   | 3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)
Documentation/userspace-api/media/mediactl/media-header.rst +5 -3
index d561d2845f3d..a47ac5b2e99b 100644
@@ -2,10 +2,12 @@
 
 .. _media_header:
 
-****************************
-Media Controller Header File
-****************************
+*****************************
+Media controller uAPI symbols
+*****************************
 
 .. kernel-include:: include/uapi/linux/media.h
     :generate-cross-refs:
     :exception-file: media.h.rst.exceptions
+    :toc:
+    :warn-broken:
Documentation/userspace-api/media/mediactl/media.h.rst.exceptions +3 -0
index 9b4c26502d95..09aaec2b4718 100644
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
+# All symbols are mapped inside MC C domain namespace
+namespace MC
+
 # Ignore header name
 ignore define __LINUX_MEDIA_H
 
Signature · 1 line
2.51.0
#15 lore raw

PATCH 13/23 docs: kernel_include.py: use get_close_matches() to propose alternatives

In reply to Mauro Carvalho Chehab

Improve the suggestions algorithm by using get_close_matches() if no suggestions with the same name are found. As we're now building a dict, when the name is identical, but on a different domain, the search is O(1), making it a lot faster.

The get_close_matches is also fast, as there is just one loop, instead of 3.

This can be useful to detect typos on references, with could be the base of a futuere extension that will handle ref unmatches for the entire build, allowing someone to find typos and fix them.

As difflib and get_close_matches are there since the early Python 3.x days, we don't need to handle any extra dependencies to use it.

We're keeping the default values for the search, e.g. n=3, cutoff=0.6. With that, we now have things like:

  $ make SPHINXDIRS="userspace-api/media" htmldocs
  ...
  include/uapi/linux/videodev2.h:199: WARNING: Invalid xref: c:type:`v4l2_memory`. Possible alternatives:
        c:type:`v4l2_meta_format` (from v4l/dev-meta)
        c:type:`v4l2_rect` (from v4l/dev-overlay)
        c:type:`v4l2_area` (from v4l/ext-ctrls-image-source) [ref.missing]
  ...
  include/uapi/linux/videodev2.h:1985: WARNING: Invalid xref: c:type:`V4L.v4l2_queryctrl`. Possible alternatives:
        std:label:`v4l2-queryctrl` (from v4l/vidioc-queryctrl)
        std:label:`v4l2-query-ext-ctrl` (from v4l/vidioc-queryctrl)

At the first example, it was not a typo, but a symbol that doesn't seem to be properly documented. The second example points to v4l2-queryctrl, which is a close match for the symbol.

---
 Documentation/sphinx/kernel_include.py | 62 +++++++++++++-------------
 1 file changed, 30 insertions(+), 32 deletions(-)
Documentation/sphinx/kernel_include.py +30 -32
index 895646da7495..75e139287d50 100755
@@ -87,6 +87,8 @@ import os.path
 import re
 import sys
 
+from difflib import get_close_matches
+
 from docutils import io, nodes, statemachine
 from docutils.statemachine import ViewList
 from docutils.parsers.rst import Directive, directives
@@ -401,8 +403,8 @@ class KernelInclude(Directive):
 # ==============================================================================
 
 reported = set()
-
 DOMAIN_INFO = {}
+all_refs = {}
 
 def fill_domain_info(env):
     """
@@ -419,47 +421,43 @@ def fill_domain_info(env):
             # Ignore domains that we can't retrieve object types, if any
             pass
 
+    for domain in DOMAIN_INFO.keys():
+        domain_obj = env.get_domain(domain)
+        for name, dispname, objtype, docname, anchor, priority in domain_obj.get_objects():
+            ref_name = name.lower()
+
+            if domain == "c":
+                if '.' in ref_name:
+                    ref_name = ref_name.split(".")[-1]
+
+            if not ref_name in all_refs:
+                all_refs[ref_name] = []
+
+            all_refs[ref_name].append(f"\t{domain}:{objtype}:`{name}` (from {docname})")
+
 def get_suggestions(app, env, node,
                     original_target, original_domain, original_reftype):
     """Check if target exists in the other domain or with different reftypes."""
     original_target = original_target.lower()
 
     # Remove namespace if present
-    if '.' in original_target:
-        original_target = original_target.split(".")[-1]
-
-    targets = set([
-        original_target,
-        original_target.replace("-", "_"),
-        original_target.replace("_", "-"),
-    ])
-
-    # Propose some suggestions, if possible
-    # The code below checks not only variants of the target, but also it
-    # works when .. c:namespace:: targets setting a different C namespace
-    # is in place
+    if original_domain == "c":
+        if '.' in original_target:
+            original_target = original_target.split(".")[-1]
 
     suggestions = []
-    for target in sorted(targets):
-        for domain in DOMAIN_INFO.keys():
-            domain_obj = env.get_domain(domain)
-            for name, dispname, objtype, docname, anchor, priority in domain_obj.get_objects():
-                lower_name = name.lower()
 
-                if domain == "c":
-                    # Check if name belongs to a different C namespace
-                    match = RE_SPLIT_DOMAIN.match(name)
-                    if match:
-                        if target != match.group(2).lower():
-                            continue
-                    else:
-                        if target !=  lower_name:
-                            continue
-                else:
-                    if target != lower_name:
-                        continue
+    # If name exists, propose exact name match on different domains
+    if original_target in all_refs:
+        return all_refs[original_target]
 
-                suggestions.append(f"\t{domain}:{objtype}:`{name}` (from {docname})")
+    # If not found, get a close match, using difflib.
+    # Such method is based on Ratcliff-Obershelp Algorithm, which seeks
+    # for a close match within a certain distance. We're using the defaults
+    # here, e.g. cutoff=0.6, proposing 3 alternatives
+    matches = get_close_matches(original_target, all_refs.keys())
+    for match in matches:
+        suggestions += all_refs[match]
 
     return suggestions
 
Signature · 1 line
2.51.0
#16 lore raw

PATCH 14/23 docs: media: add missing c namespace to V4L headers

In reply to Mauro Carvalho Chehab

Media references belong to V4L namespace. Fix a lot of broken links when including videodev2.h and probably fixing several other broken cross-references between different files inside media docs.

---
 Documentation/userspace-api/media/v4l/app-pri.rst                | 1 +
 Documentation/userspace-api/media/v4l/audio.rst                  | 1 +
 Documentation/userspace-api/media/v4l/biblio.rst                 | 1 +
 Documentation/userspace-api/media/v4l/capture-example.rst        | 1 +
 Documentation/userspace-api/media/v4l/capture.c.rst              | 1 +
 Documentation/userspace-api/media/v4l/colorspaces-defs.rst       | 1 +
 Documentation/userspace-api/media/v4l/colorspaces-details.rst    | 1 +
 Documentation/userspace-api/media/v4l/colorspaces.rst            | 1 +
 Documentation/userspace-api/media/v4l/common-defs.rst            | 1 +
 Documentation/userspace-api/media/v4l/common.rst                 | 1 +
 Documentation/userspace-api/media/v4l/compat.rst                 | 1 +
 Documentation/userspace-api/media/v4l/control.rst                | 1 +
 Documentation/userspace-api/media/v4l/crop.rst                   | 1 +
 Documentation/userspace-api/media/v4l/depth-formats.rst          | 1 +
 Documentation/userspace-api/media/v4l/dev-decoder.rst            | 1 +
 Documentation/userspace-api/media/v4l/dev-encoder.rst            | 1 +
 Documentation/userspace-api/media/v4l/dev-event.rst              | 1 +
 Documentation/userspace-api/media/v4l/dev-mem2mem.rst            | 1 +
 Documentation/userspace-api/media/v4l/dev-meta.rst               | 1 +
 Documentation/userspace-api/media/v4l/dev-osd.rst                | 1 +
 Documentation/userspace-api/media/v4l/dev-overlay.rst            | 1 +
 Documentation/userspace-api/media/v4l/dev-radio.rst              | 1 +
 Documentation/userspace-api/media/v4l/dev-sdr.rst                | 1 +
 Documentation/userspace-api/media/v4l/dev-stateless-decoder.rst  | 1 +
 Documentation/userspace-api/media/v4l/dev-subdev.rst             | 1 +
 Documentation/userspace-api/media/v4l/dev-touch.rst              | 1 +
 Documentation/userspace-api/media/v4l/devices.rst                | 1 +
 Documentation/userspace-api/media/v4l/dv-timings.rst             | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst       | 1 +
 .../userspace-api/media/v4l/ext-ctrls-codec-stateless.rst        | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst        | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-colorimetry.rst  | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-detect.rst       | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst           | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-flash.rst        | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-fm-rx.rst        | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-fm-tx.rst        | 1 +
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst          | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-jpeg.rst         | 1 +
 Documentation/userspace-api/media/v4l/ext-ctrls-rf-tuner.rst     | 1 +
 Documentation/userspace-api/media/v4l/extended-controls.rst      | 1 +
 Documentation/userspace-api/media/v4l/field-order.rst            | 1 +
 Documentation/userspace-api/media/v4l/fourcc.rst                 | 1 +
 Documentation/userspace-api/media/v4l/hsv-formats.rst            | 1 +
 Documentation/userspace-api/media/v4l/libv4l.rst                 | 1 +
 Documentation/userspace-api/media/v4l/meta-formats.rst           | 1 +
 Documentation/userspace-api/media/v4l/metafmt-c3-isp.rst         | 1 +
 Documentation/userspace-api/media/v4l/metafmt-d4xx.rst           | 1 +
 Documentation/userspace-api/media/v4l/metafmt-generic.rst        | 1 +
 Documentation/userspace-api/media/v4l/metafmt-intel-ipu3.rst     | 1 +
 Documentation/userspace-api/media/v4l/metafmt-pisp-be.rst        | 1 +
 Documentation/userspace-api/media/v4l/metafmt-pisp-fe.rst        | 1 +
 Documentation/userspace-api/media/v4l/metafmt-rkisp1.rst         | 1 +
 Documentation/userspace-api/media/v4l/metafmt-uvc.rst            | 1 +
 Documentation/userspace-api/media/v4l/metafmt-vivid.rst          | 1 +
 Documentation/userspace-api/media/v4l/metafmt-vsp1-hgo.rst       | 1 +
 Documentation/userspace-api/media/v4l/metafmt-vsp1-hgt.rst       | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-bayer.rst           | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-cnf4.rst            | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-compressed.rst      | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-indexed.rst         | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-intro.rst           | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-inzi.rst            | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-m420.rst            | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-packed-hsv.rst      | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst      | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-reserved.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-rgb.rst             | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-sdr-cs08.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-sdr-cs14le.rst      | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-sdr-cu08.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-sdr-cu16le.rst      | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-sdr-pcu16be.rst     | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-sdr-pcu18be.rst     | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-sdr-pcu20be.rst     | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-sdr-ru12le.rst      | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb10-ipu3.rst    | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb10.rst         | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb10alaw8.rst    | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb10dpcm8.rst    | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb10p.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb12.rst         | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb12p.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb14.rst         | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb14p.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb16.rst         | 1 +
 .../userspace-api/media/v4l/pixfmt-srggb8-pisp-comp.rst          | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-srggb8.rst          | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-tch-td08.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-tch-td16.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-tch-tu08.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-tch-tu16.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-uv8.rst             | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-v4l2-mplane.rst     | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-v4l2.rst            | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-y12i.rst            | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-y16i.rst            | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-y8i.rst             | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst        | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst      | 1 +
 Documentation/userspace-api/media/v4l/pixfmt-z16.rst             | 1 +
 Documentation/userspace-api/media/v4l/pixfmt.rst                 | 1 +
 Documentation/userspace-api/media/v4l/planar-apis.rst            | 1 +
 Documentation/userspace-api/media/v4l/querycap.rst               | 1 +
 Documentation/userspace-api/media/v4l/sdr-formats.rst            | 1 +
 .../userspace-api/media/v4l/selection-api-configuration.rst      | 1 +
 Documentation/userspace-api/media/v4l/selection-api-examples.rst | 1 +
 Documentation/userspace-api/media/v4l/selection-api-intro.rst    | 1 +
 Documentation/userspace-api/media/v4l/selection-api-targets.rst  | 1 +
 .../userspace-api/media/v4l/selection-api-vs-crop-api.rst        | 1 +
 Documentation/userspace-api/media/v4l/selection-api.rst          | 1 +
 Documentation/userspace-api/media/v4l/selections-common.rst      | 1 +
 Documentation/userspace-api/media/v4l/standard.rst               | 1 +
 Documentation/userspace-api/media/v4l/subdev-formats.rst         | 1 +
 Documentation/userspace-api/media/v4l/tch-formats.rst            | 1 +
 Documentation/userspace-api/media/v4l/tuner.rst                  | 1 +
 Documentation/userspace-api/media/v4l/user-func.rst              | 1 +
 Documentation/userspace-api/media/v4l/v4l2-selection-flags.rst   | 1 +
 Documentation/userspace-api/media/v4l/v4l2-selection-targets.rst | 1 +
 Documentation/userspace-api/media/v4l/v4l2.rst                   | 1 +
 Documentation/userspace-api/media/v4l/v4l2grab-example.rst       | 1 +
 Documentation/userspace-api/media/v4l/v4l2grab.c.rst             | 1 +
 Documentation/userspace-api/media/v4l/video.rst                  | 1 +
 Documentation/userspace-api/media/v4l/videodev.rst               | 1 +
 Documentation/userspace-api/media/v4l/yuv-formats.rst            | 1 +
 126 files changed, 126 insertions(+)
Documentation/userspace-api/media/v4l/app-pri.rst +1 -0
index 626a42f2e138..47d96cd64525 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _app-pri:
 
Documentation/userspace-api/media/v4l/audio.rst +1 -0
index 17f0b1c89908..3b424440e478 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _audio:
 
Documentation/userspace-api/media/v4l/biblio.rst +1 -0
index 856acf6a890c..9721247e66ef 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 **********
 References
Documentation/userspace-api/media/v4l/capture-example.rst +1 -0
index 25891320b7ad..f018a654f59c 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _capture-example:
 
Documentation/userspace-api/media/v4l/capture.c.rst +1 -0
index 349541b1dac0..aae17e1e844a 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 file: media/v4l/capture.c
 =========================
Documentation/userspace-api/media/v4l/colorspaces-defs.rst +1 -0
index fe9f8aa8ab9d..0b40e735f3bf 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 ****************************
 Defining Colorspaces in V4L2
Documentation/userspace-api/media/v4l/colorspaces-details.rst +1 -0
index 26a4ace42ca5..f29b0e3978bc 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 ********************************
 Detailed Colorspace Descriptions
Documentation/userspace-api/media/v4l/colorspaces.rst +1 -0
index 2aa0dda4fd01..11954d7cf999 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _colorspaces:
 
Documentation/userspace-api/media/v4l/common-defs.rst +1 -0
index 6ae42ac7ddb7..329ba6ec760b 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _common-defs:
 
Documentation/userspace-api/media/v4l/common.rst +1 -0
index ea0435182e44..507c35fec8ce 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _common:
 
Documentation/userspace-api/media/v4l/compat.rst +1 -0
index b63b8392dec6..f766ea89f9ff 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _compat:
 
Documentation/userspace-api/media/v4l/control.rst +1 -0
index 9253cc946f02..19372bb32c4b 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _control:
 
Documentation/userspace-api/media/v4l/crop.rst +1 -0
index 3fe185e25ccf..c5f389aca275 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _crop:
 
Documentation/userspace-api/media/v4l/depth-formats.rst +1 -0
index b4f3fc229c85..bd61064d51d3 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _depth-formats:
 
Documentation/userspace-api/media/v4l/dev-decoder.rst +1 -0
index ef8e8cf31f90..eb662ced0ab4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0
+.. c:namespace:: V4L
 
 .. _decoder:
 
Documentation/userspace-api/media/v4l/dev-encoder.rst +1 -0
index 6c523c69bdce..cdad276d00bc 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _encoder:
 
Documentation/userspace-api/media/v4l/dev-event.rst +1 -0
index f34f9cf6ce6c..f61d774f0153 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _event:
 
Documentation/userspace-api/media/v4l/dev-mem2mem.rst +1 -0
index 7041bb3d5b8d..6058eeaefca4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _mem2mem:
 
Documentation/userspace-api/media/v4l/dev-meta.rst +1 -0
index 5eee9ab60395..da706d01b808 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _metadata:
 
Documentation/userspace-api/media/v4l/dev-osd.rst +1 -0
index 8e4be9129e75..f37450b1b631 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _osd:
 
Documentation/userspace-api/media/v4l/dev-overlay.rst +1 -0
index d52977120b41..b7f4302eee6e 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _overlay:
 
Documentation/userspace-api/media/v4l/dev-radio.rst +1 -0
index 284ce96a1637..843a2151f470 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _radio:
 
Documentation/userspace-api/media/v4l/dev-sdr.rst +1 -0
index dfdeddbca41f..99907adc0628 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _sdr:
 
Documentation/userspace-api/media/v4l/dev-stateless-decoder.rst +1 -0
index 35ed05f2695e..e311f0c13272 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0
+.. c:namespace:: V4L
 
 .. _stateless_decoder:
 
Documentation/userspace-api/media/v4l/dev-subdev.rst +1 -0
index 161b43f1ce66..d1ad0a2e0cfc 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _subdev:
 
Documentation/userspace-api/media/v4l/dev-touch.rst +1 -0
index a71b9def5d58..808957cd9afc 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _touch:
 
Documentation/userspace-api/media/v4l/devices.rst +1 -0
index 8bfbad65a9d4..d4790b9ef81a 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _devices:
 
Documentation/userspace-api/media/v4l/dv-timings.rst +1 -0
index 4b19bcb4bd80..9f117c82df1b 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _dv-timings:
 
Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst +1 -0
index cdc515c60468..b4daa7e28dc0 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _camera-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst +1 -0
index 0da635691fdc..497ae74379f6 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _codec-stateless-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +1 -0
index 4a379bd9e3fb..c8890cb5e00a 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _codec-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-colorimetry.rst +1 -0
index 1e7265155715..38a4136d7220 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _colorimetry-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-detect.rst +1 -0
index 312c4fa94dc3..ee2b7e37c1d9 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _detect-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst +1 -0
index d2794e03ac6d..5918dde83efb 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _dv-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-flash.rst +1 -0
index d22c5efb806a..bd024ab461a4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _flash-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-fm-rx.rst +1 -0
index ccd439e9e0e3..b7284768f7ea 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _fm-rx-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-fm-tx.rst +1 -0
index cb40cf4cc3ec..7143a4c08f78 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _fm-tx-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -0
index 27803dca8d3e..6d516f041ca2 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _image-process-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +1 -0
index 71f23f131f97..f9c0b7ad3b4e 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _image-source-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-jpeg.rst +1 -0
index 522095c08469..b114650bca5b 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _jpeg-controls:
 
Documentation/userspace-api/media/v4l/ext-ctrls-rf-tuner.rst +1 -0
index 8a6f9f0373ff..f50802a1c4d4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _rf-tuner-controls:
 
Documentation/userspace-api/media/v4l/extended-controls.rst +1 -0
index 44fcd67f20bf..5fe71da6afc0 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _extended-controls:
 
Documentation/userspace-api/media/v4l/field-order.rst +1 -0
index 9a0ed8fc550f..2a01852513b3 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _field-order:
 
Documentation/userspace-api/media/v4l/fourcc.rst +1 -0
index d3482c40da62..5cea7008814f 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0
+.. c:namespace:: V4L
 
 Guidelines for Video4Linux pixel format 4CCs
 ============================================
Documentation/userspace-api/media/v4l/hsv-formats.rst +1 -0
index d810c914b673..f0731de6f038 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _hsv-formats:
 
Documentation/userspace-api/media/v4l/libv4l.rst +1 -0
index f446dd2d01ac..ce7a0400891c 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _libv4l:
 
Documentation/userspace-api/media/v4l/meta-formats.rst +1 -0
index 0de80328c36b..d9868ee88a07 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _meta-formats:
 
Documentation/userspace-api/media/v4l/metafmt-c3-isp.rst +1 -0
index 449b45c2ec24..24359601ae25 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: (GPL-2.0-only OR MIT)
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-c3isp-stats:
 .. _v4l2-meta-fmt-c3isp-params:
Documentation/userspace-api/media/v4l/metafmt-d4xx.rst +1 -0
index 0686413b16b2..d716170bb795 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-d4xx:
 
Documentation/userspace-api/media/v4l/metafmt-generic.rst +1 -0
index 78ab56b21682..c5c1abe568bc 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 ********************************************************************************************************************************************************************************************************************************************************************************
 V4L2_META_FMT_GENERIC_8 ('MET8'), V4L2_META_FMT_GENERIC_CSI2_10 ('MC1A'), V4L2_META_FMT_GENERIC_CSI2_12 ('MC1C'), V4L2_META_FMT_GENERIC_CSI2_14 ('MC1E'), V4L2_META_FMT_GENERIC_CSI2_16 ('MC1G'), V4L2_META_FMT_GENERIC_CSI2_20 ('MC1K'), V4L2_META_FMT_GENERIC_CSI2_24 ('MC1O')
Documentation/userspace-api/media/v4l/metafmt-intel-ipu3.rst +1 -0
index 84d81dd7a7b5..c11d17e5a286 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-params:
 .. _v4l2-meta-fmt-stat-3a:
Documentation/userspace-api/media/v4l/metafmt-pisp-be.rst +1 -0
index 3281fe366c86..e230177910f4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-rpi-be-cfg:
 
Documentation/userspace-api/media/v4l/metafmt-pisp-fe.rst +1 -0
index fddeada83e4a..a2aa5c4c2920 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-rpi-fe-cfg:
 
Documentation/userspace-api/media/v4l/metafmt-rkisp1.rst +1 -0
index 959f6bde8695..d3c899b0150b 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-rk-isp1-stat-3a:
 
Documentation/userspace-api/media/v4l/metafmt-uvc.rst +1 -0
index 4c05e9e54683..c4ae2f13e7f7 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-uvc:
 
Documentation/userspace-api/media/v4l/metafmt-vivid.rst +1 -0
index 7173e2c3e245..94f28736dc80 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-vivid:
 
Documentation/userspace-api/media/v4l/metafmt-vsp1-hgo.rst +1 -0
index 8d886feb180c..70357899a5f0 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-vsp1-hgo:
 
Documentation/userspace-api/media/v4l/metafmt-vsp1-hgt.rst +1 -0
index d8830ff605de..4a1575a9e728 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-meta-fmt-vsp1-hgt:
 
Documentation/userspace-api/media/v4l/pixfmt-bayer.rst +1 -0
index b5ca501842b0..8b4e413177f5 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _pixfmt-bayer:
 
Documentation/userspace-api/media/v4l/pixfmt-cnf4.rst +1 -0
index 8f469290c304..4e3e9c5f4387 100644
@@ -1,4 +1,5 @@
 .. -*- coding: utf-8; mode: rst -*-
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-CNF4:
 
Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +1 -0
index 806ed73ac474..c7efb0465db6 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 ******************
 Compressed Formats
Documentation/userspace-api/media/v4l/pixfmt-indexed.rst +1 -0
index 5bd4a47c5854..08d698ebdd64 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _pixfmt-indexed:
 
Documentation/userspace-api/media/v4l/pixfmt-intro.rst +1 -0
index 14239ee826bf..00c1b7b0e907 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 **********************
 Standard Image Formats
Documentation/userspace-api/media/v4l/pixfmt-inzi.rst +1 -0
index 3115c8f6a842..0af3a303a7f0 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-INZI:
 
Documentation/userspace-api/media/v4l/pixfmt-m420.rst +1 -0
index c01a949e7c11..f44a6c5eaddf 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-M420:
 
Documentation/userspace-api/media/v4l/pixfmt-packed-hsv.rst +1 -0
index dd89860f50e0..d1cab3c632f1 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _packed-hsv:
 
Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +1 -0
index 9f111ed594d2..ae7d88ae1c3d 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _packed-yuv:
 
Documentation/userspace-api/media/v4l/pixfmt-reserved.rst +1 -0
index ac52485252d9..1cf6c59f4bc4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _pixfmt-reserved:
 
Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +1 -0
index 5ed4d62df909..cf6760bb6109 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _pixfmt-rgb:
 
Documentation/userspace-api/media/v4l/pixfmt-sdr-cs08.rst +1 -0
index bd6ee6111de4..b2dda90409d9 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-sdr-fmt-cs8:
 
Documentation/userspace-api/media/v4l/pixfmt-sdr-cs14le.rst +1 -0
index ea21b288d357..df8b4b22ebce 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-SDR-FMT-CS14LE:
 
Documentation/userspace-api/media/v4l/pixfmt-sdr-cu08.rst +1 -0
index 45fce09d85ff..86accef8f9f4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-sdr-fmt-cu8:
 
Documentation/userspace-api/media/v4l/pixfmt-sdr-cu16le.rst +1 -0
index 7f4242f8da6f..13d8c86e9b1d 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-SDR-FMT-CU16LE:
 
Documentation/userspace-api/media/v4l/pixfmt-sdr-pcu16be.rst +1 -0
index a4d4b70ece63..9c4908d57a25 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-SDR-FMT-PCU16BE:
 
Documentation/userspace-api/media/v4l/pixfmt-sdr-pcu18be.rst +1 -0
index 3db690bd683a..56c3f2aee0a4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-SDR-FMT-PCU18BE:
 
Documentation/userspace-api/media/v4l/pixfmt-sdr-pcu20be.rst +1 -0
index 485343cdf150..1992ee5dd2bc 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-SDR-FMT-PCU20BE:
 
Documentation/userspace-api/media/v4l/pixfmt-sdr-ru12le.rst +1 -0
index 2ad4706bfc7a..3b2a94e64bcd 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-SDR-FMT-RU12LE:
 
Documentation/userspace-api/media/v4l/pixfmt-srggb10-ipu3.rst +1 -0
index 3322b0600f1d..de4720dba48a 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-pix-fmt-ipu3-sbggr10:
 .. _v4l2-pix-fmt-ipu3-sgbrg10:
Documentation/userspace-api/media/v4l/pixfmt-srggb10.rst +1 -0
index a66414ab4291..6b4950ad54e0 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SRGGB10:
 .. _v4l2-pix-fmt-sbggr10:
Documentation/userspace-api/media/v4l/pixfmt-srggb10alaw8.rst +1 -0
index a5ae1f099e68..42176c437ebe 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SBGGR10ALAW8:
 .. _v4l2-pix-fmt-sgbrg10alaw8:
Documentation/userspace-api/media/v4l/pixfmt-srggb10dpcm8.rst +1 -0
index f0544c6f4580..dac580181562 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SBGGR10DPCM8:
 .. _v4l2-pix-fmt-sgbrg10dpcm8:
Documentation/userspace-api/media/v4l/pixfmt-srggb10p.rst +1 -0
index fd5feb415531..af91f12c24e8 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SRGGB10P:
 .. _v4l2-pix-fmt-sbggr10p:
Documentation/userspace-api/media/v4l/pixfmt-srggb12.rst +1 -0
index 15c34e1e4835..2b3212ef732f 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SRGGB12:
 .. _v4l2-pix-fmt-sbggr12:
Documentation/userspace-api/media/v4l/pixfmt-srggb12p.rst +1 -0
index 8c03aedcc00e..cffb3dfc338a 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SRGGB12P:
 .. _v4l2-pix-fmt-sbggr12p:
Documentation/userspace-api/media/v4l/pixfmt-srggb14.rst +1 -0
index 4f5120a6c678..7a3552c045a3 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SRGGB14:
 .. _v4l2-pix-fmt-sbggr14:
Documentation/userspace-api/media/v4l/pixfmt-srggb14p.rst +1 -0
index f4f53d7dbdeb..330197aded11 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SRGGB14P:
 .. _v4l2-pix-fmt-sbggr14p:
Documentation/userspace-api/media/v4l/pixfmt-srggb16.rst +1 -0
index 2f2f1ef430d9..dab222f49522 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SRGGB16:
 .. _v4l2-pix-fmt-sbggr16:
Documentation/userspace-api/media/v4l/pixfmt-srggb8-pisp-comp.rst +1 -0
index 5a82a15559d6..7a55a3c7c9f6 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-pix-fmt-pisp-comp1-rggb:
 .. _v4l2-pix-fmt-pisp-comp1-grbg:
Documentation/userspace-api/media/v4l/pixfmt-srggb8.rst +1 -0
index 02061c5a9778..4cb263a6ea26 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-SRGGB8:
 .. _v4l2-pix-fmt-sbggr8:
Documentation/userspace-api/media/v4l/pixfmt-tch-td08.rst +1 -0
index ec89f43c60ec..37b03da07cf4 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-TCH-FMT-DELTA-TD08:
 
Documentation/userspace-api/media/v4l/pixfmt-tch-td16.rst +1 -0
index 7b59a6424243..66d3d7041550 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-TCH-FMT-DELTA-TD16:
 
Documentation/userspace-api/media/v4l/pixfmt-tch-tu08.rst +1 -0
index 63c5264b8668..b10bb7bad025 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-TCH-FMT-TU08:
 
Documentation/userspace-api/media/v4l/pixfmt-tch-tu16.rst +1 -0
index ade618a037a8..889298d010a1 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-TCH-FMT-TU16:
 
Documentation/userspace-api/media/v4l/pixfmt-uv8.rst +1 -0
index ff1d73ef5dba..8fa97b57ad75 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-UV8:
 
Documentation/userspace-api/media/v4l/pixfmt-v4l2-mplane.rst +1 -0
index ad4da988c3a3..7069b2a6b0b1 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 ******************************
 Multi-planar format structures
Documentation/userspace-api/media/v4l/pixfmt-v4l2.rst +1 -0
index 9c423ffe02f9..995267741a26 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 ******************************
 Single-planar format structure
Documentation/userspace-api/media/v4l/pixfmt-y12i.rst +1 -0
index d9b539381d74..b4223ce3506c 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-Y12I:
 
Documentation/userspace-api/media/v4l/pixfmt-y16i.rst +1 -0
index 74ba9e910a38..51f216f24e41 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-Y16I:
 
Documentation/userspace-api/media/v4l/pixfmt-y8i.rst +1 -0
index 770ed4749c14..c5a3648d37e5 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-Y8I:
 
Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +1 -0
index 74df19be91f6..99bcc6d385b7 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _yuv-luma-only:
 
Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst +1 -0
index 6e4f399f1f88..0631919bd667 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. planar-yuv:
 
Documentation/userspace-api/media/v4l/pixfmt-z16.rst +1 -0
index 54a8cd723d1a..3ab8844d2e6f 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _V4L2-PIX-FMT-Z16:
 
Documentation/userspace-api/media/v4l/pixfmt.rst +1 -0
index 11dab4a90630..71b29267488f 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _pixfmt:
 
Documentation/userspace-api/media/v4l/planar-apis.rst +1 -0
index 9207ce4283df..075754f0e423 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _planar-apis:
 
Documentation/userspace-api/media/v4l/querycap.rst +1 -0
index 15a90271af45..c96f7654c870 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _querycap:
 
Documentation/userspace-api/media/v4l/sdr-formats.rst +1 -0
index d8bdfdb56911..df76b7d2aaf2 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _sdr-formats:
 
Documentation/userspace-api/media/v4l/selection-api-configuration.rst +1 -0
index fee49bf1a1c0..978c401f4252 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 *************
 Configuration
Documentation/userspace-api/media/v4l/selection-api-examples.rst +1 -0
index 5f8e8a1f59d7..3cf7c067f20f 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 ********
 Examples
Documentation/userspace-api/media/v4l/selection-api-intro.rst +1 -0
index 6534854ae9f7..817e660ce016 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 ************
 Introduction
Documentation/userspace-api/media/v4l/selection-api-targets.rst +1 -0
index 50fdadd5b307..e1aaaa3a7123 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 *****************
 Selection targets
Documentation/userspace-api/media/v4l/selection-api-vs-crop-api.rst +1 -0
index f57b9180012c..0c0d66a0cfe6 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _selection-vs-crop:
 
Documentation/userspace-api/media/v4l/selection-api.rst +1 -0
index 0360743746dc..1320eb632272 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _selection-api:
 
Documentation/userspace-api/media/v4l/selections-common.rst +1 -0
index 322b39cf0eba..e08da7a9b599 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-selections-common:
 
Documentation/userspace-api/media/v4l/standard.rst +1 -0
index 1f6678325da9..53818e37db5f 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _standard:
 
Documentation/userspace-api/media/v4l/subdev-formats.rst +1 -0
index 2a94371448dc..1904390df830 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-mbus-format:
 
Documentation/userspace-api/media/v4l/tch-formats.rst +1 -0
index 8c941ff9e200..a382d1c20eb3 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _tch-formats:
 
Documentation/userspace-api/media/v4l/tuner.rst +1 -0
index e2c53c3abdc6..c82f68d2f900 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _tuner:
 
Documentation/userspace-api/media/v4l/user-func.rst +1 -0
index 6f661138801c..5fc95c792408 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _user-func:
 
Documentation/userspace-api/media/v4l/v4l2-selection-flags.rst +1 -0
index 1cb1531c1e52..6aa00b613148 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-selection-flags:
 
Documentation/userspace-api/media/v4l/v4l2-selection-targets.rst +1 -0
index b46bae984f35..e9fd4b4bad42 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2-selection-targets:
 
Documentation/userspace-api/media/v4l/v4l2.rst +1 -0
index cf8ae56a008c..caa41b14dfdc 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 .. include:: <isonum.txt>
 
 .. _v4l2spec:
Documentation/userspace-api/media/v4l/v4l2grab-example.rst +1 -0
index b323be42c580..b2472d4b0e3f 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _v4l2grab-example:
 
Documentation/userspace-api/media/v4l/v4l2grab.c.rst +1 -0
index 1a55e3617ea8..c958db1e0211 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 file: media/v4l/v4l2grab.c
 ==========================
Documentation/userspace-api/media/v4l/video.rst +1 -0
index f8f69a57602c..25cb854c1101 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _video:
 
Documentation/userspace-api/media/v4l/videodev.rst +1 -0
index 64be44716494..0b71a60928fb 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _videodev:
 
Documentation/userspace-api/media/v4l/yuv-formats.rst +1 -0
index 78ee406d7647..c5ef408470a5 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
 
 .. _yuv-formats:
 
Signature · 1 line
2.51.0
#17 lore raw

PATCH 15/23 docs: media: videodev2.h.rst.exceptions: fix namespace on refs

In reply to Mauro Carvalho Chehab

Media uses V4L domain, but the replace rules are not considering it.

Fix them.

---
 .../media/v4l/videodev2.h.rst.exceptions      | 284 +++++++++---------
 1 file changed, 142 insertions(+), 142 deletions(-)
Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions +142 -142
index 951d01bf7579..9bcb5ae6fbc4 100644
@@ -20,155 +20,155 @@ ignore symbol V4L2_TUNER_DIGITAL_TV
 ignore symbol V4L2_COLORSPACE_BT878
 
 # Documented enum v4l2_field
-replace symbol V4L2_FIELD_ALTERNATE :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_ANY :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_BOTTOM :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_INTERLACED :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_INTERLACED_BT :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_INTERLACED_TB :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_NONE :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_SEQ_BT :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_SEQ_TB :c:type:`v4l2_field`
-replace symbol V4L2_FIELD_TOP :c:type:`v4l2_field`
+replace symbol V4L2_FIELD_ALTERNATE :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_ANY :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_BOTTOM :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_INTERLACED :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_INTERLACED_BT :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_INTERLACED_TB :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_NONE :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_SEQ_BT :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_SEQ_TB :c:type:`V4L.v4l2_field`
+replace symbol V4L2_FIELD_TOP :c:type:`V4L.v4l2_field`
 
 # Documented enum v4l2_buf_type
-replace symbol V4L2_BUF_TYPE_META_CAPTURE :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_META_OUTPUT :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_SDR_CAPTURE :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_SDR_OUTPUT :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_SLICED_VBI_CAPTURE :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_SLICED_VBI_OUTPUT :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_VBI_CAPTURE :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_VBI_OUTPUT :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_VIDEO_CAPTURE :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY :c:type:`v4l2_buf_type`
-replace symbol V4L2_BUF_TYPE_VIDEO_OVERLAY :c:type:`v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_META_CAPTURE :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_META_OUTPUT :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_SDR_CAPTURE :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_SDR_OUTPUT :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_SLICED_VBI_CAPTURE :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_SLICED_VBI_OUTPUT :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_VBI_CAPTURE :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_VBI_OUTPUT :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_VIDEO_CAPTURE :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY :c:type:`V4L.v4l2_buf_type`
+replace symbol V4L2_BUF_TYPE_VIDEO_OVERLAY :c:type:`V4L.v4l2_buf_type`
 
 # Documented enum v4l2_tuner_type
-replace symbol V4L2_TUNER_ANALOG_TV :c:type:`v4l2_tuner_type`
-replace symbol V4L2_TUNER_RADIO :c:type:`v4l2_tuner_type`
-replace symbol V4L2_TUNER_RF :c:type:`v4l2_tuner_type`
-replace symbol V4L2_TUNER_SDR :c:type:`v4l2_tuner_type`
+replace symbol V4L2_TUNER_ANALOG_TV :c:type:`V4L.v4l2_tuner_type`
+replace symbol V4L2_TUNER_RADIO :c:type:`V4L.v4l2_tuner_type`
+replace symbol V4L2_TUNER_RF :c:type:`V4L.v4l2_tuner_type`
+replace symbol V4L2_TUNER_SDR :c:type:`V4L.v4l2_tuner_type`
 
 # Documented enum v4l2_memory
-replace symbol V4L2_MEMORY_DMABUF :c:type:`v4l2_memory`
-replace symbol V4L2_MEMORY_MMAP :c:type:`v4l2_memory`
-replace symbol V4L2_MEMORY_OVERLAY :c:type:`v4l2_memory`
-replace symbol V4L2_MEMORY_USERPTR :c:type:`v4l2_memory`
+replace symbol V4L2_MEMORY_DMABUF :c:type:`V4L.v4l2_memory`
+replace symbol V4L2_MEMORY_MMAP :c:type:`V4L.v4l2_memory`
+replace symbol V4L2_MEMORY_OVERLAY :c:type:`V4L.v4l2_memory`
+replace symbol V4L2_MEMORY_USERPTR :c:type:`V4L.v4l2_memory`
 
 # Documented enum v4l2_colorspace
-replace symbol V4L2_COLORSPACE_470_SYSTEM_BG :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_470_SYSTEM_M :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_OPRGB :c:type:`v4l2_colorspace`
-replace define V4L2_COLORSPACE_ADOBERGB :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_BT2020 :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_DCI_P3 :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_DEFAULT :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_JPEG :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_RAW :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_REC709 :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_SMPTE170M :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_SMPTE240M :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_SRGB :c:type:`v4l2_colorspace`
-replace symbol V4L2_COLORSPACE_LAST :c:type:`v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_470_SYSTEM_BG :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_470_SYSTEM_M :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_OPRGB :c:type:`V4L.v4l2_colorspace`
+replace define V4L2_COLORSPACE_ADOBERGB :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_BT2020 :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_DCI_P3 :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_DEFAULT :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_JPEG :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_RAW :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_REC709 :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_SMPTE170M :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_SMPTE240M :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_SRGB :c:type:`V4L.v4l2_colorspace`
+replace symbol V4L2_COLORSPACE_LAST :c:type:`V4L.v4l2_colorspace`
 
 # Documented enum v4l2_xfer_func
-replace symbol V4L2_XFER_FUNC_709 :c:type:`v4l2_xfer_func`
-replace symbol V4L2_XFER_FUNC_OPRGB :c:type:`v4l2_xfer_func`
-replace define V4L2_XFER_FUNC_ADOBERGB :c:type:`v4l2_xfer_func`
-replace symbol V4L2_XFER_FUNC_DCI_P3 :c:type:`v4l2_xfer_func`
-replace symbol V4L2_XFER_FUNC_DEFAULT :c:type:`v4l2_xfer_func`
-replace symbol V4L2_XFER_FUNC_NONE :c:type:`v4l2_xfer_func`
-replace symbol V4L2_XFER_FUNC_SMPTE2084 :c:type:`v4l2_xfer_func`
-replace symbol V4L2_XFER_FUNC_SMPTE240M :c:type:`v4l2_xfer_func`
-replace symbol V4L2_XFER_FUNC_SRGB :c:type:`v4l2_xfer_func`
-replace symbol V4L2_XFER_FUNC_LAST :c:type:`v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_709 :c:type:`V4L.v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_OPRGB :c:type:`V4L.v4l2_xfer_func`
+replace define V4L2_XFER_FUNC_ADOBERGB :c:type:`V4L.v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_DCI_P3 :c:type:`V4L.v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_DEFAULT :c:type:`V4L.v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_NONE :c:type:`V4L.v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_SMPTE2084 :c:type:`V4L.v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_SMPTE240M :c:type:`V4L.v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_SRGB :c:type:`V4L.v4l2_xfer_func`
+replace symbol V4L2_XFER_FUNC_LAST :c:type:`V4L.v4l2_xfer_func`
 
 # Documented enum v4l2_ycbcr_encoding
-replace symbol V4L2_YCBCR_ENC_601 :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_709 :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_BT2020 :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_BT2020_CONST_LUM :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_DEFAULT :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_SYCC :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_XV601 :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_XV709 :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_SMPTE240M :c:type:`v4l2_ycbcr_encoding`
-replace symbol V4L2_YCBCR_ENC_LAST :c:type:`v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_601 :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_709 :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_BT2020 :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_BT2020_CONST_LUM :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_DEFAULT :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_SYCC :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_XV601 :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_XV709 :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_SMPTE240M :c:type:`V4L.v4l2_ycbcr_encoding`
+replace symbol V4L2_YCBCR_ENC_LAST :c:type:`V4L.v4l2_ycbcr_encoding`
 
 # Documented enum v4l2_hsv_encoding
-replace symbol V4L2_HSV_ENC_180 :c:type:`v4l2_hsv_encoding`
-replace symbol V4L2_HSV_ENC_256 :c:type:`v4l2_hsv_encoding`
+replace symbol V4L2_HSV_ENC_180 :c:type:`V4L.v4l2_hsv_encoding`
+replace symbol V4L2_HSV_ENC_256 :c:type:`V4L.v4l2_hsv_encoding`
 
 # Documented enum v4l2_quantization
-replace symbol V4L2_QUANTIZATION_DEFAULT :c:type:`v4l2_quantization`
-replace symbol V4L2_QUANTIZATION_FULL_RANGE :c:type:`v4l2_quantization`
-replace symbol V4L2_QUANTIZATION_LIM_RANGE :c:type:`v4l2_quantization`
+replace symbol V4L2_QUANTIZATION_DEFAULT :c:type:`V4L.v4l2_quantization`
+replace symbol V4L2_QUANTIZATION_FULL_RANGE :c:type:`V4L.v4l2_quantization`
+replace symbol V4L2_QUANTIZATION_LIM_RANGE :c:type:`V4L.v4l2_quantization`
 
 # Documented enum v4l2_priority
-replace symbol V4L2_PRIORITY_BACKGROUND :c:type:`v4l2_priority`
-replace symbol V4L2_PRIORITY_DEFAULT :c:type:`v4l2_priority`
-replace symbol V4L2_PRIORITY_INTERACTIVE :c:type:`v4l2_priority`
-replace symbol V4L2_PRIORITY_RECORD :c:type:`v4l2_priority`
-replace symbol V4L2_PRIORITY_UNSET :c:type:`v4l2_priority`
+replace symbol V4L2_PRIORITY_BACKGROUND :c:type:`V4L.v4l2_priority`
+replace symbol V4L2_PRIORITY_DEFAULT :c:type:`V4L.v4l2_priority`
+replace symbol V4L2_PRIORITY_INTERACTIVE :c:type:`V4L.v4l2_priority`
+replace symbol V4L2_PRIORITY_RECORD :c:type:`V4L.v4l2_priority`
+replace symbol V4L2_PRIORITY_UNSET :c:type:`V4L.v4l2_priority`
 
 # Documented enum v4l2_frmsizetypes
-replace symbol V4L2_FRMSIZE_TYPE_CONTINUOUS :c:type:`v4l2_frmsizetypes`
-replace symbol V4L2_FRMSIZE_TYPE_DISCRETE :c:type:`v4l2_frmsizetypes`
-replace symbol V4L2_FRMSIZE_TYPE_STEPWISE :c:type:`v4l2_frmsizetypes`
+replace symbol V4L2_FRMSIZE_TYPE_CONTINUOUS :c:type:`V4L.v4l2_frmsizetypes`
+replace symbol V4L2_FRMSIZE_TYPE_DISCRETE :c:type:`V4L.v4l2_frmsizetypes`
+replace symbol V4L2_FRMSIZE_TYPE_STEPWISE :c:type:`V4L.v4l2_frmsizetypes`
 
 # Documented enum frmivaltypes
-replace symbol V4L2_FRMIVAL_TYPE_CONTINUOUS :c:type:`v4l2_frmivaltypes`
-replace symbol V4L2_FRMIVAL_TYPE_DISCRETE :c:type:`v4l2_frmivaltypes`
-replace symbol V4L2_FRMIVAL_TYPE_STEPWISE :c:type:`v4l2_frmivaltypes`
+replace symbol V4L2_FRMIVAL_TYPE_CONTINUOUS :c:type:`V4L.v4l2_frmivaltypes`
+replace symbol V4L2_FRMIVAL_TYPE_DISCRETE :c:type:`V4L.v4l2_frmivaltypes`
+replace symbol V4L2_FRMIVAL_TYPE_STEPWISE :c:type:`V4L.v4l2_frmivaltypes`
 
-# Documented enum :c:type:`v4l2_ctrl_type`
+# Documented enum :c:type:`V4L.v4l2_ctrl_type`
 replace symbol V4L2_CTRL_COMPOUND_TYPES vidioc_queryctrl
 
-replace symbol V4L2_CTRL_TYPE_BITMASK :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_BOOLEAN :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_BUTTON :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_CTRL_CLASS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_INTEGER :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_INTEGER64 :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_INTEGER_MENU :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_MENU :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_STRING :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_U16 :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_U32 :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_U8 :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_MPEG2_SEQUENCE :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_MPEG2_PICTURE :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_MPEG2_QUANTISATION :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_H264_SPS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_H264_PPS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_H264_SCALING_MATRIX :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_H264_PRED_WEIGHTS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_H264_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_H264_DECODE_PARAMS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_RECT :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_VP9_FRAME :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HDR10_CLL_INFO :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_AV1_SEQUENCE :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_AV1_FRAME :c:type:`v4l2_ctrl_type`
-replace symbol V4L2_CTRL_TYPE_AV1_FILM_GRAIN :c:type:`v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_BITMASK :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_BOOLEAN :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_BUTTON :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_CTRL_CLASS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_INTEGER :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_INTEGER64 :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_INTEGER_MENU :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_MENU :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_STRING :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_U16 :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_U32 :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_U8 :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_MPEG2_SEQUENCE :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_MPEG2_PICTURE :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_MPEG2_QUANTISATION :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_H264_SPS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_H264_PPS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_H264_SCALING_MATRIX :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_H264_PRED_WEIGHTS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_H264_SLICE_PARAMS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_H264_DECODE_PARAMS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_AREA :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_RECT :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_VP9_FRAME :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HDR10_CLL_INFO :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_AV1_SEQUENCE :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_AV1_FRAME :c:type:`V4L.v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_AV1_FILM_GRAIN :c:type:`V4L.v4l2_ctrl_type`
 
 # V4L2 capability defines
 replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities
@@ -204,10 +204,10 @@ replace define V4L2_CAP_IO_MC device-capabilities
 replace define V4L2_CAP_EDID device-capabilities
 
 # V4L2 pix flags
-replace define V4L2_PIX_FMT_PRIV_MAGIC :c:type:`v4l2_pix_format`
+replace define V4L2_PIX_FMT_PRIV_MAGIC :c:type:`V4L.v4l2_pix_format`
 replace define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA format-flags
-replace define V4L2_PIX_FMT_HM12 :c:type:`v4l2_pix_format`
-replace define V4L2_PIX_FMT_SUNXI_TILED_NV12 :c:type:`v4l2_pix_format`
+replace define V4L2_PIX_FMT_HM12 :c:type:`V4L.v4l2_pix_format`
+replace define V4L2_PIX_FMT_SUNXI_TILED_NV12 :c:type:`V4L.v4l2_pix_format`
 
 # V4L2 format flags
 replace define V4L2_FMT_FLAG_COMPRESSED fmtdesc-flags
@@ -266,7 +266,7 @@ replace define V4L2_FBUF_FLAG_SRC_CHROMAKEY framebuffer-flags
 # Used on VIDIOC_G_PARM
 
 replace define V4L2_MODE_HIGHQUALITY parm-flags
-replace define V4L2_CAP_TIMEPERFRAME :c:type:`v4l2_captureparm`
+replace define V4L2_CAP_TIMEPERFRAME :c:type:`V4L.v4l2_captureparm`
 
 # The V4L2_STD_foo are all defined at v4l2_std_id table
 
@@ -319,11 +319,11 @@ replace define V4L2_STD_ALL v4l2-std-id
 
 # V4L2 DT BT timings definitions
 
-replace define V4L2_DV_PROGRESSIVE :c:type:`v4l2_bt_timings`
-replace define V4L2_DV_INTERLACED :c:type:`v4l2_bt_timings`
+replace define V4L2_DV_PROGRESSIVE :c:type:`V4L.v4l2_bt_timings`
+replace define V4L2_DV_INTERLACED :c:type:`V4L.v4l2_bt_timings`
 
-replace define V4L2_DV_VSYNC_POS_POL :c:type:`v4l2_bt_timings`
-replace define V4L2_DV_HSYNC_POS_POL :c:type:`v4l2_bt_timings`
+replace define V4L2_DV_VSYNC_POS_POL :c:type:`V4L.v4l2_bt_timings`
+replace define V4L2_DV_HSYNC_POS_POL :c:type:`V4L.v4l2_bt_timings`
 
 replace define V4L2_DV_BT_STD_CEA861 dv-bt-standards
 replace define V4L2_DV_BT_STD_DMT dv-bt-standards
@@ -459,11 +459,11 @@ replace define V4L2_AUDMODE_AVL audio-mode
 
 # MPEG
 
-replace define V4L2_ENC_IDX_FRAME_I :c:type:`v4l2_enc_idx`
-replace define V4L2_ENC_IDX_FRAME_P :c:type:`v4l2_enc_idx`
-replace define V4L2_ENC_IDX_FRAME_B :c:type:`v4l2_enc_idx`
-replace define V4L2_ENC_IDX_FRAME_MASK :c:type:`v4l2_enc_idx`
-replace define V4L2_ENC_IDX_ENTRIES :c:type:`v4l2_enc_idx`
+replace define V4L2_ENC_IDX_FRAME_I :c:type:`V4L.v4l2_enc_idx`
+replace define V4L2_ENC_IDX_FRAME_P :c:type:`V4L.v4l2_enc_idx`
+replace define V4L2_ENC_IDX_FRAME_B :c:type:`V4L.v4l2_enc_idx`
+replace define V4L2_ENC_IDX_FRAME_MASK :c:type:`V4L.v4l2_enc_idx`
+replace define V4L2_ENC_IDX_ENTRIES :c:type:`V4L.v4l2_enc_idx`
 
 replace define V4L2_ENC_CMD_START encoder-cmds
 replace define V4L2_ENC_CMD_STOP encoder-cmds
@@ -491,10 +491,10 @@ replace define V4L2_DEC_START_FMT_GOP decoder-cmds
 replace define V4L2_VBI_UNSYNC vbifmt-flags
 replace define V4L2_VBI_INTERLACED vbifmt-flags
 
-replace define V4L2_VBI_ITU_525_F1_START :c:type:`v4l2_vbi_format`
-replace define V4L2_VBI_ITU_525_F2_START :c:type:`v4l2_vbi_format`
-replace define V4L2_VBI_ITU_625_F1_START :c:type:`v4l2_vbi_format`
-replace define V4L2_VBI_ITU_625_F2_START :c:type:`v4l2_vbi_format`
+replace define V4L2_VBI_ITU_525_F1_START :c:type:`V4L.v4l2_vbi_format`
+replace define V4L2_VBI_ITU_525_F2_START :c:type:`V4L.v4l2_vbi_format`
+replace define V4L2_VBI_ITU_625_F1_START :c:type:`V4L.v4l2_vbi_format`
+replace define V4L2_VBI_ITU_625_F2_START :c:type:`V4L.v4l2_vbi_format`
 
 
 replace define V4L2_SLICED_TELETEXT_B vbi-services
@@ -530,7 +530,7 @@ replace define V4L2_EVENT_CTRL_CH_DIMENSIONS ctrl-changes-flags
 
 replace define V4L2_EVENT_SRC_CH_RESOLUTION src-changes-flags
 
-replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`v4l2_event_motion_det`
+replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`V4L.v4l2_event_motion_det`
 
 replace define V4L2_EVENT_SUB_FL_SEND_INITIAL event-flags
 replace define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK event-flags
Signature · 1 line
2.51.0
#18 lore raw

PATCH 16/23 media: docs: add a missing reference for VIDIOC_QUERY_CTRL

In reply to Mauro Carvalho Chehab

This one is missing its c:macro definition.

---
 Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst | 2 ++
 1 file changed, 2 insertions(+)
Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst +2 -0
index 3549417c7feb..a8d84806a3c0 100644
@@ -15,6 +15,8 @@ VIDIOC_QUERYCTRL - VIDIOC_QUERY_EXT_CTRL - VIDIOC_QUERYMENU - Enumerate controls
 Synopsis
 ========
 
+.. c:macro:: VIDIOC_QUERY_CTRL
+
 ``int ioctl(int fd, int VIDIOC_QUERYCTRL, struct v4l2_queryctrl *argp)``
 
 .. c:macro:: VIDIOC_QUERY_EXT_CTRL
Signature · 1 line
2.51.0
#19 lore raw

PATCH 17/23 media: docs: videodev2.h.rst.exceptions: ignore struct __kernel_v4l2_timeval

In reply to Mauro Carvalho Chehab

This is an ancillary struct used for year-2038 compat logic. It is not meant to be used directly on userspace.

---
 Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions | 1 +
 1 file changed, 1 insertion(+)
Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions +1 -0
index 9bcb5ae6fbc4..c41693115db6 100644
@@ -18,6 +18,7 @@ ignore define _UAPI__LINUX_VIDEODEV2_H
 ignore symbol V4L2_BUF_TYPE_PRIVATE
 ignore symbol V4L2_TUNER_DIGITAL_TV
 ignore symbol V4L2_COLORSPACE_BT878
+ignore struct __kernel_v4l2_timeval
 
 # Documented enum v4l2_field
 replace symbol V4L2_FIELD_ALTERNATE :c:type:`V4L.v4l2_field`
Signature · 1 line
2.51.0
#20 lore raw

PATCH 18/23 media: docs: add some C domain missing references

In reply to Mauro Carvalho Chehab

Some enum/struct fields don't contain C domain references. Add them to avoid broken xrefs.

---
 Documentation/userspace-api/media/v4l/buffer.rst           | 2 ++
 Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst | 6 ++++++
 2 files changed, 8 insertions(+)
Documentation/userspace-api/media/v4l/buffer.rst +2 -0
index 856874341882..94dc2719e907 100644
@@ -667,6 +667,8 @@ Buffer Flags
 	exposure of the frame has begun. This is only valid for the
 	``V4L2_BUF_TYPE_VIDEO_CAPTURE`` buffer type.
 
+.. c:enum:: v4l2_memory
+
 .. raw:: latex
 
     \normalsize
Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst +6 -0
index a8d84806a3c0..c8baa9430c14 100644
@@ -100,6 +100,8 @@ See also the examples in :ref:`control`.
 
 .. _v4l2-queryctrl:
 
+.. c:struct:: v4l2_queryctrl
+
 .. cssclass:: longtable
 
 .. flat-table:: struct v4l2_queryctrl
@@ -180,6 +182,8 @@ See also the examples in :ref:`control`.
 
 .. cssclass:: longtable
 
+.. c:struct:: v4l2_query_ext_ctrl
+
 .. flat-table:: struct v4l2_query_ext_ctrl
     :header-rows:  0
     :stub-columns: 0
@@ -278,6 +282,8 @@ See also the examples in :ref:`control`.
 
 .. _v4l2-querymenu:
 
+.. c:struct:: v4l2_querymenu
+
 .. flat-table:: struct v4l2_querymenu
     :header-rows:  0
     :stub-columns: 0
Signature · 1 line
2.51.0
#21 lore raw

PATCH 19/23 docs: cec: cec.h.rst.exceptions: fix broken references from cec.h

In reply to Mauro Carvalho Chehab

All references there belong to CEC namespace.

---
 Documentation/userspace-api/media/cec/cec.h.rst.exceptions | 3 +++
 1 file changed, 3 insertions(+)
Documentation/userspace-api/media/cec/cec.h.rst.exceptions +3 -0
index 15fa1752d4ef..65e8be062bdb 100644
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
+# All symbols belong to CEC namespace
+namespace CEC
+
 # Ignore header name
 ignore define _CEC_UAPI_H
 
Signature · 1 line
2.51.0
#22 lore raw

PATCH 20/23 docs: cec: show broken xrefs and show TOC instead of cec.h content

In reply to Mauro Carvalho Chehab

Enable xref broken warnings. While here, change the output to only show cross-references, as there's no need to show the entire cec.h header at the docs.

---
 Documentation/userspace-api/media/cec/cec-header.rst | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/userspace-api/media/cec/cec-header.rst +5 -3
index f67003bb8740..648498bc7d6f 100644
@@ -2,10 +2,12 @@
 
 .. _cec_header:
 
-***************
-CEC Header File
-***************
+****************
+CEC uAPI Symbols
+****************
 
 .. kernel-include:: include/uapi/linux/cec.h
     :generate-cross-refs:
     :exception-file: cec.h.rst.exceptions
+    :toc:
+    :warn-broken:
Signature · 1 line
2.51.0
#23 lore raw

PATCH 21/23 docs: media: dmx_types: place kerneldoc at the right namespace

In reply to Mauro Carvalho Chehab

The DVB documentation is using DTV.dmx for all demux symbols.

Use such domain for kernel-doc documentation.

---
 Documentation/userspace-api/media/dvb/dmx_types.rst | 1 +
 1 file changed, 1 insertion(+)
Documentation/userspace-api/media/dvb/dmx_types.rst +1 -0
index 33458fbb84ab..dd76010696c8 100644
@@ -1,4 +1,5 @@
 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: DTV.dmx
 
 .. _dmx_types:
 
Signature · 1 line
2.51.0
#24 lore raw

PATCH 22/23 docs: media: dvb: headers: warn about broken cross references

In reply to Mauro Carvalho Chehab

Enable cross-reference warnings for demux header.

---
 Documentation/userspace-api/media/dvb/headers.rst | 1 +
 1 file changed, 1 insertion(+)
Documentation/userspace-api/media/dvb/headers.rst +1 -0
index 3c492ae109ae..6d69622bf1e0 100644
@@ -24,6 +24,7 @@ Demux
     :generate-cross-refs:
     :exception-file: dmx.h.rst.exceptions
     :toc:
+    :warn-broken:
 
 Conditional Access
 ==================
Signature · 1 line
2.51.0
#25 lore raw

PATCH 23/23 docs: media: dvb: fix dmx.h.rst.exceptions

In reply to Mauro Carvalho Chehab

There are lots of broken links on dmx. Those are mostly linked to namespace handling.

Yet, some symbols were pointed to the wrong locations, and there are some definitions that aren't needed.

---
 .../media/dvb/dmx.h.rst.exceptions            | 82 +++++++++----------
 1 file changed, 39 insertions(+), 43 deletions(-)
Documentation/userspace-api/media/dvb/dmx.h.rst.exceptions +39 -43
index afc14d384b83..2c219388d123 100644
@@ -1,34 +1,36 @@
 # SPDX-License-Identifier: GPL-2.0
 
+# All symbols belone to this namespace
+namespace DTV.dmx
+
 # Ignore header name
 ignore define _UAPI_DVBDMX_H_
 
 # Ignore limit constants
 ignore define DMX_FILTER_SIZE
 
-# dmx_pes_type_t enum symbols
-replace enum dmx_ts_pes :c:type:`dmx_pes_type`
-replace symbol DMX_PES_AUDIO0 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_VIDEO0 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_TELETEXT0 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_SUBTITLE0 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_PCR0 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_AUDIO1 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_VIDEO1 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_TELETEXT1 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_SUBTITLE1 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_PCR1 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_AUDIO2 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_VIDEO2 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_TELETEXT2 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_SUBTITLE2 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_PCR2 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_AUDIO3 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_VIDEO3 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_TELETEXT3 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_SUBTITLE3 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_PCR3 :c:type:`dmx_pes_type`
-replace symbol DMX_PES_OTHER :c:type:`dmx_pes_type`
+# dmx_ts_pes_type_t enum symbols
+replace symbol DMX_PES_AUDIO0 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_VIDEO0 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_TELETEXT0 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_SUBTITLE0 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_PCR0 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_AUDIO1 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_VIDEO1 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_TELETEXT1 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_SUBTITLE1 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_PCR1 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_AUDIO2 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_VIDEO2 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_TELETEXT2 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_SUBTITLE2 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_PCR2 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_AUDIO3 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_VIDEO3 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_TELETEXT3 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_SUBTITLE3 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_PCR3 :c:type:`DTV.dmx.dmx_ts_pes`
+replace symbol DMX_PES_OTHER :c:type:`DTV.dmx.dmx_ts_pes`
 
 # Ignore obsolete symbols
 ignore define DMX_PES_AUDIO
@@ -38,29 +40,23 @@ ignore define DMX_PES_SUBTITLE
 ignore define DMX_PES_PCR
 
 # dmx_input_t symbols
-replace enum dmx_input :c:type:`dmx_input`
-replace symbol DMX_IN_FRONTEND :c:type:`dmx_input`
-replace symbol DMX_IN_DVR :c:type:`dmx_input`
+replace symbol DMX_IN_FRONTEND :c:enum:`DTV.dmx.dmx_input`
+replace symbol DMX_IN_DVR :c:enum:`DTV.dmx.dmx_input`
 
 # Flags for struct dmx_sct_filter_params
-replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
-replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
-replace define DMX_IMMEDIATE_START :c:type:`dmx_sct_filter_params`
+replace define DMX_CHECK_CRC :c:type:`DTV.dmx.dmx_sct_filter_params`
+replace define DMX_ONESHOT :c:type:`DTV.dmx.dmx_sct_filter_params`
+replace define DMX_IMMEDIATE_START :c:type:`DTV.dmx.dmx_sct_filter_params`
 
-# some typedefs should point to struct/enums
-replace typedef dmx_filter_t :c:type:`dmx_filter`
-replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
-replace typedef dmx_input_t :c:type:`dmx_input`
+replace symbol DMX_BUFFER_FLAG_HAD_CRC32_DISCARD :c:type:`DTV.dmx.dmx_buffer_flags`
+replace symbol DMX_BUFFER_FLAG_TEI :c:type:`DTV.dmx.dmx_buffer_flags`
+replace symbol DMX_BUFFER_PKT_COUNTER_MISMATCH :c:type:`DTV.dmx.dmx_buffer_flags`
+replace symbol DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED :c:type:`DTV.dmx.dmx_buffer_flags`
+replace symbol DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR :c:type:`DTV.dmx.dmx_buffer_flags`
 
-replace symbol DMX_BUFFER_FLAG_HAD_CRC32_DISCARD :c:type:`dmx_buffer_flags`
-replace	symbol DMX_BUFFER_FLAG_TEI :c:type:`dmx_buffer_flags`
-replace	symbol DMX_BUFFER_PKT_COUNTER_MISMATCH :c:type:`dmx_buffer_flags`
-replace	symbol DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED :c:type:`dmx_buffer_flags`
-replace	symbol DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR :c:type:`dmx_buffer_flags`
-
-replace symbol DMX_OUT_DECODER :c:type:`dmx_output`
-replace symbol DMX_OUT_TAP :c:type:`dmx_output`
-replace symbol DMX_OUT_TS_TAP :c:type:`dmx_output`
-replace symbol DMX_OUT_TSDEMUX_TAP :c:type:`dmx_output`
+replace symbol DMX_OUT_DECODER :c:type:`DTV.dmx.dmx_output`
+replace symbol DMX_OUT_TAP :c:type:`DTV.dmx.dmx_output`
+replace symbol DMX_OUT_TS_TAP :c:type:`DTV.dmx.dmx_output`
+replace symbol DMX_OUT_TSDEMUX_TAP :c:type:`DTV.dmx.dmx_output`
 
 replace ioctl DMX_DQBUF dmx_qbuf
Signature · 1 line
2.51.0
maintainer
#26 lore raw
In reply to Mauro Carvalho Chehab
Quoted 19 lines · Mauro Carvalho Chehab

In the past, media used Docbook to generate documentation, together with some logic to ensure that cross-references would match the actual defined uAPI.

The rationale is that we wanted to automatically check for uAPI documentation gaps.

The same logic was migrated to Sphinx. Back then, broken links were reported. However, recent versions of it and/or changes at conf.py disabled such checks.

The result is that several symbols are now not cross-referenced, and we don't get warnings anymore when something breaks.

This series consist on 2 parts:

Part 1: extra patches to parse_data_structs.py and kernel_include.py; Part 2: media documentation fixes.

Quoted 6 lines

I'm not sure what's the best strategy to merge it, as some patches belong to doc while others are media. So, they can be merged on either one of the tree, or split on two series and merged in separate or even being merged via a PR applied on both trees.

IMO, the latter is the better strategy.

OK, this series has been applied to -rc1 and is available in my media-uapi branch. I've also merged it into docs-next.

Thanks,

jon

#27 lore raw

Hi Jon,

Em Fri, 17 Oct 2025 14:08:39 -0600
Jonathan Corbet <[email protected]> escreveu:

Quoted 26 lines
Quoted 24 lines · Mauro Carvalho Chehab

In the past, media used Docbook to generate documentation, together with some logic to ensure that cross-references would match the actual defined uAPI.

The rationale is that we wanted to automatically check for uAPI documentation gaps.

The same logic was migrated to Sphinx. Back then, broken links were reported. However, recent versions of it and/or changes at conf.py disabled such checks.

The result is that several symbols are now not cross-referenced, and we don't get warnings anymore when something breaks.

This series consist on 2 parts:

Part 1: extra patches to parse_data_structs.py and kernel_include.py; Part 2: media documentation fixes.

I'm not sure what's the best strategy to merge it, as some patches belong to doc while others are media. So, they can be merged on either one of the tree, or split on two series and merged in separate or even being merged via a PR applied on both trees.

Quoted 4 lines
Quoted 1 line

IMO, the latter is the better strategy.

OK, this series has been applied to -rc1 and is available in my media-uapi branch. I've also merged it into docs-next.

Thanks!

Merged on media-committers next branch as well:

	https://gitlab.freedesktop.org/linux-media/media-committers/-/commit/8652359fc004cbadbf0e95692c1472caac6260c2
Quoted 4 lines

Thanks,

jon

#3 lore raw

Re: [PATCH 02/23] tools: docs: parse_data_structs.py: output a line number

In reply to Mauro Carvalho Chehab

On 01/10/2025 16:49, Mauro Carvalho Chehab wrote:

Missing commit message!

I'm less concerned about the missing message (it's clear what is happening here), than I am about the fact that checkpatch wasn't run.

Regards,

Hans

Quoted 116 lines
---
 tools/docs/lib/parse_data_structs.py | 29 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
tools/docs/lib/parse_data_structs.py +15 -14
index 6c868f84f029..d28471a045f1 100755
@@ -143,7 +143,7 @@ class ParseDataStructs:
         for symbol_type in self.DEF_SYMBOL_TYPES:
             self.symbols[symbol_type] = {}
 
-    def store_type(self, symbol_type: str, symbol: str,
+    def store_type(self, ln, symbol_type: str, symbol: str,
                    ref_name: str = None, replace_underscores: bool = True):
         """
         Stores a new symbol at self.symbols under symbol_type.
@@ -172,7 +172,7 @@ class ParseDataStructs:
         else:
             ref_link = symbol
 
-        self.symbols[symbol_type][symbol] = f"{prefix}{ref_link}{suffix}"
+        self.symbols[symbol_type][symbol] = (f"{prefix}{ref_link}{suffix}", ln)
 
     def store_line(self, line):
         """Stores a line at self.data, properly indented"""
@@ -240,20 +240,20 @@ class ParseDataStructs:
                 if is_enum:
                     match = re.match(r"^\s*([_\w][\w\d_]+)\s*[\,=]?", line)
                     if match:
-                        self.store_type("symbol", match.group(1))
+                        self.store_type(line_no, "symbol", match.group(1))
                     if "}" in line:
                         is_enum = False
                     continue
 
                 match = re.match(r"^\s*#\s*define\s+([\w_]+)\s+_IO", line)
                 if match:
-                    self.store_type("ioctl", match.group(1),
+                    self.store_type(line_no, "ioctl", match.group(1),
                                     replace_underscores=False)
                     continue
 
                 match = re.match(r"^\s*#\s*define\s+([\w_]+)(\s+|$)", line)
                 if match:
-                    self.store_type("define", match.group(1))
+                    self.store_type(line_no, "define", match.group(1))
                     continue
 
                 match = re.match(r"^\s*typedef\s+([_\w][\w\d_]+)\s+(.*)\s+([_\w][\w\d_]+);",
@@ -261,20 +261,20 @@ class ParseDataStructs:
                 if match:
                     name = match.group(2).strip()
                     symbol = match.group(3)
-                    self.store_type("typedef", symbol, ref_name=name)
+                    self.store_type(line_no, "typedef", symbol, ref_name=name)
                     continue
 
                 for re_enum in self.RE_ENUMS:
                     match = re_enum.match(line)
                     if match:
-                        self.store_type("enum", match.group(1))
+                        self.store_type(line_no, "enum", match.group(1))
                         is_enum = True
                         break
 
                 for re_struct in self.RE_STRUCTS:
                     match = re_struct.match(line)
                     if match:
-                        self.store_type("struct", match.group(1))
+                        self.store_type(line_no, "struct", match.group(1))
                         break
 
     def process_exceptions(self, fname: str):
@@ -342,7 +342,8 @@ class ParseDataStructs:
 
                 # Change self.symbols to use the replacement rule
                 if old in self.symbols[c_type]:
-                    self.symbols[c_type][old] = new_ref
+                    (_, ln) = self.symbols[c_type][old]
+                    self.symbols[c_type][old] = (new_ref, ln)
                 else:
                     print(f"{name}:{ln}: Warning: can't find {old} {c_type}")
 
@@ -360,8 +361,8 @@ class ParseDataStructs:
 
             print(f"{c_type}:")
 
-            for symbol, ref in sorted(refs.items()):
-                print(f"  {symbol} -> {ref}")
+            for symbol, (ref, ln) in sorted(refs.items()):
+                print(f"  #{ln:<5d} {symbol} -> {ref}")
 
             print()
 
@@ -384,7 +385,7 @@ class ParseDataStructs:
 
         # Process all reference types
         for ref_dict in self.symbols.values():
-            for symbol, replacement in ref_dict.items():
+            for symbol, (replacement, _) in ref_dict.items():
                 symbol = re.escape(re.sub(r"([\_\`\*\<\>\&\\\\:\/])", r"\\\1", symbol))
                 text = re.sub(fr'{start_delim}{symbol}{end_delim}',
                               fr'\1{replacement}\2', text)
@@ -420,8 +421,8 @@ class ParseDataStructs:
             text.append("")
 
             # Sort symbols alphabetically
-            for symbol, ref in sorted(refs.items()):
-                text.append(f"* :{ref}:")
+            for symbol, (ref, ln) in sorted(refs.items()):
+                text.append(f"* {ref}: line #{ln}")
 
             text.append("")  # Add empty line between categories
 
Acked-by on the v1 series
#28 lore raw
In reply to Mauro Carvalho Chehab
Quoted 24 lines · Mauro Carvalho Chehab

In the past, media used Docbook to generate documentation, together with some logic to ensure that cross-references would match the actual defined uAPI.

The rationale is that we wanted to automatically check for uAPI documentation gaps.

The same logic was migrated to Sphinx. Back then, broken links were reported. However, recent versions of it and/or changes at conf.py disabled such checks.

The result is that several symbols are now not cross-referenced, and we don't get warnings anymore when something breaks.

This series consist on 2 parts:

Part 1: extra patches to parse_data_structs.py and kernel_include.py; Part 2: media documentation fixes.

I'm not sure what's the best strategy to merge it, as some patches belong to doc while others are media. So, they can be merged on either one of the tree, or split on two series and merged in separate or even being merged via a PR applied on both trees.

Quoted 4 lines

IMO, the latter is the better strategy.

Anyway, let's submit the series for review and discuss later about its merge strategy.

For all the media/cec oatches:

Nice that cross references are now properly checked.

Regards,

Hans

Quoted 171 lines

Mauro Carvalho Chehab (23):
tools: docs: parse_data_structs.py: drop contents header
tools: docs: parse_data_structs.py: output a line number
docs: kernel_include.py: fix line numbers for TOC
docs: kernel_include.py: propose alternatives
tools: docs: parse_data_structs: make process_exceptions two stages
tools: docs: parse_data_structs.py: get rid of process_exceptions()
tools: docs: parse_data_structs.py: add namespace support
tools: docs: parse_data_structs.py: accept more reftypes
docs: media: dvb: use TOC instead of file contents at headers
docs: media: dvb: enable warnings for most headers
docs: media: rc: use TOC instead of file contents for LIRC header
docs: media: mediactl: use TOC instead of file contents
docs: kernel_include.py: use get_close_matches() to propose
alternatives
docs: media: add missing c namespace to V4L headers
docs: media: videodev2.h.rst.exceptions: fix namespace on refs
media: docs: add a missing reference for VIDIOC_QUERY_CTRL
media: docs: videodev2.h.rst.exceptions: ignore struct

    __kernel_v4l2_timeval

media: docs: add some C domain missing references
docs: cec: cec.h.rst.exceptions: fix broken references from cec.h
docs: cec: show broken xrefs and show TOC instead of cec.h content
docs: media: dmx_types: place kerneldoc at the right namespace
docs: media: dvb: headers: warn about broken cross references
docs: media: dvb: fix dmx.h.rst.exceptions

 Documentation/sphinx/kernel_include.py        | 110 ++++++-
 .../userspace-api/media/cec/cec-header.rst    |   8 +-
 .../media/cec/cec.h.rst.exceptions            |   3 +
 .../media/dvb/dmx.h.rst.exceptions            |  82 +++--
 .../userspace-api/media/dvb/dmx_types.rst     |   1 +
 .../media/dvb/frontend.h.rst.exceptions       |   5 +-
 .../userspace-api/media/dvb/headers.rst       |  31 +-
 .../media/mediactl/media-header.rst           |   8 +-
 .../media/mediactl/media.h.rst.exceptions     |   3 +
 .../userspace-api/media/rc/lirc-header.rst    |  14 +-
 .../userspace-api/media/v4l/app-pri.rst       |   1 +
 .../userspace-api/media/v4l/audio.rst         |   1 +
 .../userspace-api/media/v4l/biblio.rst        |   1 +
 .../userspace-api/media/v4l/buffer.rst        |   2 +
 .../media/v4l/capture-example.rst             |   1 +
 .../userspace-api/media/v4l/capture.c.rst     |   1 +
 .../media/v4l/colorspaces-defs.rst            |   1 +
 .../media/v4l/colorspaces-details.rst         |   1 +
 .../userspace-api/media/v4l/colorspaces.rst   |   1 +
 .../userspace-api/media/v4l/common-defs.rst   |   1 +
 .../userspace-api/media/v4l/common.rst        |   1 +
 .../userspace-api/media/v4l/compat.rst        |   1 +
 .../userspace-api/media/v4l/control.rst       |   1 +
 .../userspace-api/media/v4l/crop.rst          |   1 +
 .../userspace-api/media/v4l/depth-formats.rst |   1 +
 .../userspace-api/media/v4l/dev-decoder.rst   |   1 +
 .../userspace-api/media/v4l/dev-encoder.rst   |   1 +
 .../userspace-api/media/v4l/dev-event.rst     |   1 +
 .../userspace-api/media/v4l/dev-mem2mem.rst   |   1 +
 .../userspace-api/media/v4l/dev-meta.rst      |   1 +
 .../userspace-api/media/v4l/dev-osd.rst       |   1 +
 .../userspace-api/media/v4l/dev-overlay.rst   |   1 +
 .../userspace-api/media/v4l/dev-radio.rst     |   1 +
 .../userspace-api/media/v4l/dev-sdr.rst       |   1 +
 .../media/v4l/dev-stateless-decoder.rst       |   1 +
 .../userspace-api/media/v4l/dev-subdev.rst    |   1 +
 .../userspace-api/media/v4l/dev-touch.rst     |   1 +
 .../userspace-api/media/v4l/devices.rst       |   1 +
 .../userspace-api/media/v4l/dv-timings.rst    |   1 +
 .../media/v4l/ext-ctrls-camera.rst            |   1 +
 .../media/v4l/ext-ctrls-codec-stateless.rst   |   1 +
 .../media/v4l/ext-ctrls-codec.rst             |   1 +
 .../media/v4l/ext-ctrls-colorimetry.rst       |   1 +
 .../media/v4l/ext-ctrls-detect.rst            |   1 +
 .../userspace-api/media/v4l/ext-ctrls-dv.rst  |   1 +
 .../media/v4l/ext-ctrls-flash.rst             |   1 +
 .../media/v4l/ext-ctrls-fm-rx.rst             |   1 +
 .../media/v4l/ext-ctrls-fm-tx.rst             |   1 +
 .../media/v4l/ext-ctrls-image-process.rst     |   1 +
 .../media/v4l/ext-ctrls-image-source.rst      |   1 +
 .../media/v4l/ext-ctrls-jpeg.rst              |   1 +
 .../media/v4l/ext-ctrls-rf-tuner.rst          |   1 +
 .../media/v4l/extended-controls.rst           |   1 +
 .../userspace-api/media/v4l/field-order.rst   |   1 +
 .../userspace-api/media/v4l/fourcc.rst        |   1 +
 .../userspace-api/media/v4l/hsv-formats.rst   |   1 +
 .../userspace-api/media/v4l/libv4l.rst        |   1 +
 .../userspace-api/media/v4l/meta-formats.rst  |   1 +
 .../media/v4l/metafmt-c3-isp.rst              |   1 +
 .../userspace-api/media/v4l/metafmt-d4xx.rst  |   1 +
 .../media/v4l/metafmt-generic.rst             |   1 +
 .../media/v4l/metafmt-intel-ipu3.rst          |   1 +
 .../media/v4l/metafmt-pisp-be.rst             |   1 +
 .../media/v4l/metafmt-pisp-fe.rst             |   1 +
 .../media/v4l/metafmt-rkisp1.rst              |   1 +
 .../userspace-api/media/v4l/metafmt-uvc.rst   |   1 +
 .../userspace-api/media/v4l/metafmt-vivid.rst |   1 +
 .../media/v4l/metafmt-vsp1-hgo.rst            |   1 +
 .../media/v4l/metafmt-vsp1-hgt.rst            |   1 +
 .../userspace-api/media/v4l/pixfmt-bayer.rst  |   1 +
 .../userspace-api/media/v4l/pixfmt-cnf4.rst   |   1 +
 .../media/v4l/pixfmt-compressed.rst           |   1 +
 .../media/v4l/pixfmt-indexed.rst              |   1 +
 .../userspace-api/media/v4l/pixfmt-intro.rst  |   1 +
 .../userspace-api/media/v4l/pixfmt-inzi.rst   |   1 +
 .../userspace-api/media/v4l/pixfmt-m420.rst   |   1 +
 .../media/v4l/pixfmt-packed-hsv.rst           |   1 +
 .../media/v4l/pixfmt-packed-yuv.rst           |   1 +
 .../media/v4l/pixfmt-reserved.rst             |   1 +
 .../userspace-api/media/v4l/pixfmt-rgb.rst    |   1 +
 .../media/v4l/pixfmt-sdr-cs08.rst             |   1 +
 .../media/v4l/pixfmt-sdr-cs14le.rst           |   1 +
 .../media/v4l/pixfmt-sdr-cu08.rst             |   1 +
 .../media/v4l/pixfmt-sdr-cu16le.rst           |   1 +
 .../media/v4l/pixfmt-sdr-pcu16be.rst          |   1 +
 .../media/v4l/pixfmt-sdr-pcu18be.rst          |   1 +
 .../media/v4l/pixfmt-sdr-pcu20be.rst          |   1 +
 .../media/v4l/pixfmt-sdr-ru12le.rst           |   1 +
 .../media/v4l/pixfmt-srggb10-ipu3.rst         |   1 +
 .../media/v4l/pixfmt-srggb10.rst              |   1 +
 .../media/v4l/pixfmt-srggb10alaw8.rst         |   1 +
 .../media/v4l/pixfmt-srggb10dpcm8.rst         |   1 +
 .../media/v4l/pixfmt-srggb10p.rst             |   1 +
 .../media/v4l/pixfmt-srggb12.rst              |   1 +
 .../media/v4l/pixfmt-srggb12p.rst             |   1 +
 .../media/v4l/pixfmt-srggb14.rst              |   1 +
 .../media/v4l/pixfmt-srggb14p.rst             |   1 +
 .../media/v4l/pixfmt-srggb16.rst              |   1 +
 .../media/v4l/pixfmt-srggb8-pisp-comp.rst     |   1 +
 .../userspace-api/media/v4l/pixfmt-srggb8.rst |   1 +
 .../media/v4l/pixfmt-tch-td08.rst             |   1 +
 .../media/v4l/pixfmt-tch-td16.rst             |   1 +
 .../media/v4l/pixfmt-tch-tu08.rst             |   1 +
 .../media/v4l/pixfmt-tch-tu16.rst             |   1 +
 .../userspace-api/media/v4l/pixfmt-uv8.rst    |   1 +
 .../media/v4l/pixfmt-v4l2-mplane.rst          |   1 +
 .../userspace-api/media/v4l/pixfmt-v4l2.rst   |   1 +
 .../userspace-api/media/v4l/pixfmt-y12i.rst   |   1 +
 .../userspace-api/media/v4l/pixfmt-y16i.rst   |   1 +
 .../userspace-api/media/v4l/pixfmt-y8i.rst    |   1 +
 .../media/v4l/pixfmt-yuv-luma.rst             |   1 +
 .../media/v4l/pixfmt-yuv-planar.rst           |   1 +
 .../userspace-api/media/v4l/pixfmt-z16.rst    |   1 +
 .../userspace-api/media/v4l/pixfmt.rst        |   1 +
 .../userspace-api/media/v4l/planar-apis.rst   |   1 +
 .../userspace-api/media/v4l/querycap.rst      |   1 +
 .../userspace-api/media/v4l/sdr-formats.rst   |   1 +
 .../media/v4l/selection-api-configuration.rst |   1 +
 .../media/v4l/selection-api-examples.rst      |   1 +
 .../media/v4l/selection-api-intro.rst         |   1 +
 .../media/v4l/selection-api-targets.rst       |   1 +
 .../media/v4l/selection-api-vs-crop-api.rst   |   1 +
 .../userspace-api/media/v4l/selection-api.rst |   1 +
 .../media/v4l/selections-common.rst           |   1 +
 .../userspace-api/media/v4l/standard.rst      |   1 +
 .../media/v4l/subdev-formats.rst              |   1 +
 .../userspace-api/media/v4l/tch-formats.rst   |   1 +
 .../userspace-api/media/v4l/tuner.rst         |   1 +
 .../userspace-api/media/v4l/user-func.rst     |   1 +
 .../media/v4l/v4l2-selection-flags.rst        |   1 +
 .../media/v4l/v4l2-selection-targets.rst      |   1 +
 .../userspace-api/media/v4l/v4l2.rst          |   1 +
 .../media/v4l/v4l2grab-example.rst            |   1 +
 .../userspace-api/media/v4l/v4l2grab.c.rst    |   1 +
 .../userspace-api/media/v4l/video.rst         |   1 +
 .../userspace-api/media/v4l/videodev.rst      |   9 +-
 .../media/v4l/videodev2.h.rst.exceptions      | 288 +++++++++---------
 .../media/v4l/vidioc-queryctrl.rst            |   8 +
 .../userspace-api/media/v4l/yuv-formats.rst   |   1 +
 tools/docs/lib/parse_data_structs.py          | 230 ++++++++------
 tools/docs/parse-headers.py                   |   5 +-
 141 files changed, 608 insertions(+), 324 deletions(-)
#4 lore raw

Re: [PATCH 02/23] tools: docs: parse_data_structs.py: output a line number

In reply to Hans Verkuil

Em Mon, 20 Oct 2025 12:46:50 +0200
Hans Verkuil <[email protected]> escreveu:

Quoted 3 lines · Mauro Carvalho Chehab

Missing commit message!

Weird, I'm almost sure I filled some description.

Quoted 3 lines

I'm less concerned about the missing message (it's clear what is happening here), than I am about the fact that checkpatch wasn't run.

My mailbomb script does run checkpatch for each patch, but I probably missed the warnings(*).

(*) By the time I sent this series, I was playing with a new version
written in Python. It had several issues, however, mostly because I was unable to find a way for Python to read an e-mail formatted with git format-patch without mangling with content encoding. I got problems on translations, with binary file patches and even with \n at the code.

On my original script, written in 2015, it was easy to lose checkpatch messages in the crowd on big series. I did several improvements on it, like running checkpatch in parallel and re-ordering warnings to avoid losing them, but it was done only after sending this series.

In any case, checkpatch currently doesn't have any logic for Python or ReST files. It only reports patch descriptions issues like this. IMO what it is needed for checkpatch to be more useful for tools is:

1. to define a coding style for Python;
2. to add some code at checkpatch to handle Python as well.

Quoted 122 lines

Regards,

Hans

Quoted 116 lines
---
 tools/docs/lib/parse_data_structs.py | 29 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
tools/docs/lib/parse_data_structs.py +15 -14
index 6c868f84f029..d28471a045f1 100755
@@ -143,7 +143,7 @@ class ParseDataStructs:
         for symbol_type in self.DEF_SYMBOL_TYPES:
             self.symbols[symbol_type] = {}
 
-    def store_type(self, symbol_type: str, symbol: str,
+    def store_type(self, ln, symbol_type: str, symbol: str,
                    ref_name: str = None, replace_underscores: bool = True):
         """
         Stores a new symbol at self.symbols under symbol_type.
@@ -172,7 +172,7 @@ class ParseDataStructs:
         else:
             ref_link = symbol
 
-        self.symbols[symbol_type][symbol] = f"{prefix}{ref_link}{suffix}"
+        self.symbols[symbol_type][symbol] = (f"{prefix}{ref_link}{suffix}", ln)
 
     def store_line(self, line):
         """Stores a line at self.data, properly indented"""
@@ -240,20 +240,20 @@ class ParseDataStructs:
                 if is_enum:
                     match = re.match(r"^\s*([_\w][\w\d_]+)\s*[\,=]?", line)
                     if match:
-                        self.store_type("symbol", match.group(1))
+                        self.store_type(line_no, "symbol", match.group(1))
                     if "}" in line:
                         is_enum = False
                     continue
 
                 match = re.match(r"^\s*#\s*define\s+([\w_]+)\s+_IO", line)
                 if match:
-                    self.store_type("ioctl", match.group(1),
+                    self.store_type(line_no, "ioctl", match.group(1),
                                     replace_underscores=False)
                     continue
 
                 match = re.match(r"^\s*#\s*define\s+([\w_]+)(\s+|$)", line)
                 if match:
-                    self.store_type("define", match.group(1))
+                    self.store_type(line_no, "define", match.group(1))
                     continue
 
                 match = re.match(r"^\s*typedef\s+([_\w][\w\d_]+)\s+(.*)\s+([_\w][\w\d_]+);",
@@ -261,20 +261,20 @@ class ParseDataStructs:
                 if match:
                     name = match.group(2).strip()
                     symbol = match.group(3)
-                    self.store_type("typedef", symbol, ref_name=name)
+                    self.store_type(line_no, "typedef", symbol, ref_name=name)
                     continue
 
                 for re_enum in self.RE_ENUMS:
                     match = re_enum.match(line)
                     if match:
-                        self.store_type("enum", match.group(1))
+                        self.store_type(line_no, "enum", match.group(1))
                         is_enum = True
                         break
 
                 for re_struct in self.RE_STRUCTS:
                     match = re_struct.match(line)
                     if match:
-                        self.store_type("struct", match.group(1))
+                        self.store_type(line_no, "struct", match.group(1))
                         break
 
     def process_exceptions(self, fname: str):
@@ -342,7 +342,8 @@ class ParseDataStructs:
 
                 # Change self.symbols to use the replacement rule
                 if old in self.symbols[c_type]:
-                    self.symbols[c_type][old] = new_ref
+                    (_, ln) = self.symbols[c_type][old]
+                    self.symbols[c_type][old] = (new_ref, ln)
                 else:
                     print(f"{name}:{ln}: Warning: can't find {old} {c_type}")
 
@@ -360,8 +361,8 @@ class ParseDataStructs:
 
             print(f"{c_type}:")
 
-            for symbol, ref in sorted(refs.items()):
-                print(f"  {symbol} -> {ref}")
+            for symbol, (ref, ln) in sorted(refs.items()):
+                print(f"  #{ln:<5d} {symbol} -> {ref}")
 
             print()
 
@@ -384,7 +385,7 @@ class ParseDataStructs:
 
         # Process all reference types
         for ref_dict in self.symbols.values():
-            for symbol, replacement in ref_dict.items():
+            for symbol, (replacement, _) in ref_dict.items():
                 symbol = re.escape(re.sub(r"([\_\`\*\<\>\&\\\\:\/])", r"\\\1", symbol))
                 text = re.sub(fr'{start_delim}{symbol}{end_delim}',
                               fr'\1{replacement}\2', text)
@@ -420,8 +421,8 @@ class ParseDataStructs:
             text.append("")
 
             # Sort symbols alphabetically
-            for symbol, ref in sorted(refs.items()):
-                text.append(f"* :{ref}:")
+            for symbol, (ref, ln) in sorted(refs.items()):
+                text.append(f"* {ref}: line #{ln}")
 
             text.append("")  # Add empty line between categories