Skip to content

Commit b580fa3

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: kernel-doc.rst: document the new "var" kernel-doc markup
Add a description containing the new syntax to document variables within kernel-doc markups. Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <aa0e3abcd6882a62f3ab9c34033c60fca1c44604.1765894964.git.mchehab+huawei@kernel.org>
1 parent 8deb5d7 commit b580fa3

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

Documentation/doc-guide/kernel-doc.rst

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,18 @@ Typedefs with function prototypes can also be documented::
342342
*/
343343
typedef void (*type_name)(struct v4l2_ctrl *arg1, void *arg2);
344344

345+
Variables documentation
346+
-----------------------
347+
348+
The general format of a kernel-doc variable comment is::
349+
350+
/**
351+
* var var_name - Brief description.
352+
*
353+
* Description of the var_name variable.
354+
*/
355+
extern int var_name;
356+
345357
Object-like macro documentation
346358
-------------------------------
347359

@@ -463,14 +475,18 @@ through the following syntax::
463475

464476
For further details, please refer to the `Sphinx C Domain`_ documentation.
465477

478+
.. note::
479+
Variables aren't automatically cross referenced. For those, you need to
480+
explicitly add a C domain cross-reference.
481+
466482
Overview documentation comments
467483
-------------------------------
468484

469485
To facilitate having source code and comments close together, you can include
470486
kernel-doc documentation blocks that are free-form comments instead of being
471-
kernel-doc for functions, structures, unions, enums, or typedefs. This could be
472-
used for something like a theory of operation for a driver or library code, for
473-
example.
487+
kernel-doc for functions, structures, unions, enums, typedefs or variables.
488+
This could be used for something like a theory of operation for a driver or
489+
library code, for example.
474490

475491
This is done by using a ``DOC:`` section keyword with a section title.
476492

@@ -538,7 +554,8 @@ identifiers: *[ function/type ...]*
538554
Include documentation for each *function* and *type* in *source*.
539555
If no *function* is specified, the documentation for all functions
540556
and types in the *source* will be included.
541-
*type* can be a ``struct``, ``union``, ``enum``, or ``typedef`` identifier.
557+
*type* can be a ``struct``, ``union``, ``enum``, ``typedef`` or ``var``
558+
identifier.
542559

543560
Examples::
544561

0 commit comments

Comments
 (0)