Skip to contentSkip to conversation

drm/gpusvm: use literal blocks for the indented code examples

PATCH In review Honglei Huang 2 participants 2 messages Oct 14

Subsystems (3)
lore
Share & tools
lore

Honglei Huang

author reviewer
#0 lore raw

PATCH 1/1 drm/gpusvm: use literal blocks for the indented code examples

kernel-doc only recognises ".. code-block::" at column 0 of the comment. The two examples under "- Pages:" are indented inside a list item, so kernel-doc treated them as prose and rewrote "&drange->inline_pages", "&range->notifier" and "&ctx" into :c:type: cross references. The injected backticks then make Sphinx fail to lex the block as C.

Use a plain "::" literal block, which kernel-doc accepts at any indentation. Syntax colouring is lost, but keeping ".. code-block:: c" would mean lifting both examples out of the list item.

Fixes cc2a6cbd6823 ("drm/gpusvm: let drm_gpusvm_get_pages() map an array of pages")
---
 drivers/gpu/drm/drm_gpusvm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_gpusvm.c +2 -6
index b6c9d3a07dc..7b166bcb0d1 100644
@@ -67,9 +67,7 @@
  *	sit in contiguous memory so a single drm_gpusvm_range_set_unmapped()
  *	can mark them all. A driver can keep one instance inline for the single
  *	device case and switch to a heap array only when more devices join,
- *	e.g.:
- *
- *	.. code-block:: c
+ *	e.g.::
  *
  *		struct driver_range {
  *			struct drm_gpusvm_range base;
@@ -99,9 +97,7 @@
  *	The 1:1 examples below pass @num_pages == 1 and &drange->pages. In the
  *	N:1 case the driver instead passes the whole array and its count, so a
  *	single call faults the CPU range once and DMA maps it for every owning
- *	drm_device, e.g.:
- *
- *	.. code-block:: c
+ *	drm_device, e.g.::
  *
  *		// GPU fault handler: one fault, one DMA mapping per device
  *		err = drm_gpusvm_get_pages(gpusvm, driver_pages(drange),

base-commit: 34081b8bbbbfb9adbe04f764f718de04df23a84a

Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Honglei Huang

kernel-doc only recognises ".. code-block::" at column 0 of the comment. The two examples under "- Pages:" are indented inside a list item, so kernel-doc treated them as prose and rewrote "&drange->inline_pages", "&range->notifier" and "&ctx" into :c:type: cross references. The injected backticks then make Sphinx fail to lex the block as C.

Use a plain "::" literal block, which kernel-doc accepts at any indentation. Syntax colouring is lost, but keeping ".. code-block:: c" would mean lifting both examples out of the list item.

Fixes cc2a6cbd6823 ("drm/gpusvm: let drm_gpusvm_get_pages() map an array of pages")

Hmm, I why Intel's CI didn't catch this - we typically build kernel doc but perhaps we are building gpusvm. Let me check on this.

Anyways thanks for the fix:

Quoted 38 lines
---
 drivers/gpu/drm/drm_gpusvm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_gpusvm.c +2 -6
index b6c9d3a07dc..7b166bcb0d1 100644
@@ -67,9 +67,7 @@
  *	sit in contiguous memory so a single drm_gpusvm_range_set_unmapped()
  *	can mark them all. A driver can keep one instance inline for the single
  *	device case and switch to a heap array only when more devices join,
- *	e.g.:
- *
- *	.. code-block:: c
+ *	e.g.::
  *
  *		struct driver_range {
  *			struct drm_gpusvm_range base;
@@ -99,9 +97,7 @@
  *	The 1:1 examples below pass @num_pages == 1 and &drange->pages. In the
  *	N:1 case the driver instead passes the whole array and its count, so a
  *	single call faults the CPU range once and DMA maps it for every owning
- *	drm_device, e.g.:
- *
- *	.. code-block:: c
+ *	drm_device, e.g.::
  *
  *		// GPU fault handler: one fault, one DMA mapping per device
  *		err = drm_gpusvm_get_pages(gpusvm, driver_pages(drange),

base-commit: 34081b8bbbbfb9adbe04f764f718de04df23a84a

Signature · 1 line
2.34.1