From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH v5 5/5] docs: kernel-doc.rst: document the new "var" kernel-doc markup
Date: Mon, 24 Nov 2025 10:57:46 +0100 [thread overview]
Message-ID: <5291dedbe9aa0104764a31fe2bf2b08d675295d5.1763978209.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1763978209.git.mchehab+huawei@kernel.org>
Add a description containing the new syntax to document
variables within kernel-doc markups.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
Documentation/doc-guide/kernel-doc.rst | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/Documentation/doc-guide/kernel-doc.rst b/Documentation/doc-guide/kernel-doc.rst
index 2e18a810f98b..0de0e344e10d 100644
--- a/Documentation/doc-guide/kernel-doc.rst
+++ b/Documentation/doc-guide/kernel-doc.rst
@@ -342,6 +342,18 @@ Typedefs with function prototypes can also be documented::
*/
typedef void (*type_name)(struct v4l2_ctrl *arg1, void *arg2);
+Variables documentation
+-----------------------
+
+The general format of a kernel-doc variable comment is::
+
+ /**
+ * var var_name - Brief description.
+ *
+ * Description of the var_name variable.
+ */
+ extern int var_name;
+
Object-like macro documentation
-------------------------------
@@ -463,14 +475,18 @@ through the following syntax::
For further details, please refer to the `Sphinx C Domain`_ documentation.
+.. note::
+ Variables aren't automatically cross referenced. For those, you need to
+ explicitly add a C domain cross-reference.
+
Overview documentation comments
-------------------------------
To facilitate having source code and comments close together, you can include
kernel-doc documentation blocks that are free-form comments instead of being
-kernel-doc for functions, structures, unions, enums, or typedefs. This could be
-used for something like a theory of operation for a driver or library code, for
-example.
+kernel-doc for functions, structures, unions, enums, typedefs or variables.
+This could be used for something like a theory of operation for a driver or
+library code, for example.
This is done by using a ``DOC:`` section keyword with a section title.
@@ -538,7 +554,8 @@ identifiers: *[ function/type ...]*
Include documentation for each *function* and *type* in *source*.
If no *function* is specified, the documentation for all functions
and types in the *source* will be included.
- *type* can be a ``struct``, ``union``, ``enum``, or ``typedef`` identifier.
+ *type* can be a ``struct``, ``union``, ``enum``, ``typedef`` or ``var``
+ identifier.
Examples::
--
2.51.1
next prev parent reply other threads:[~2025-11-24 9:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 9:57 [PATCH v5 0/5] kernel-doc: add support for documenting vars Mauro Carvalho Chehab
2025-11-24 9:57 ` [PATCH v5 1/5] kernel-doc: add support for handling global variables Mauro Carvalho Chehab
2025-11-27 1:14 ` Randy Dunlap
2025-11-24 9:57 ` [PATCH v5 2/5] kernel-doc: add support to handle DEFINE_ variables Mauro Carvalho Chehab
2025-11-27 1:27 ` Randy Dunlap
2025-11-24 9:57 ` [PATCH v5 3/5] docs: media: v4l2-ioctl.h: document two global variables Mauro Carvalho Chehab
2025-11-27 1:15 ` Randy Dunlap
2025-11-24 9:57 ` [PATCH v5 4/5] docs: kernel-doc.rst: don't let automarkup mangle with consts Mauro Carvalho Chehab
2025-11-24 9:57 ` Mauro Carvalho Chehab [this message]
2025-11-27 0:47 ` [PATCH v5 5/5] docs: kernel-doc.rst: document the new "var" kernel-doc markup Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5291dedbe9aa0104764a31fe2bf2b08d675295d5.1763978209.git.mchehab+huawei@kernel.org \
--to=mchehab+huawei@kernel.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).