diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-18 07:30:02 -0500 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-12-21 15:41:45 -0500 |
commit | 63ac85174a5455bf0ed14fa37515015de33d0fe9 (patch) | |
tree | caeaf3c3a78f5cf51d29b2de2072949831684530 /Documentation/doc-guide | |
parent | 012e93cbdb28329e615b937bb2bb7d61aee5d0d1 (diff) |
docs: kernel-doc.rst: better describe kernel-doc arguments
Add a new section to describe kernel-doc arguments,
adding examples about how identation should happen, as failing
to do that causes Sphinx to do the wrong thing.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/doc-guide')
-rw-r--r-- | Documentation/doc-guide/kernel-doc.rst | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/Documentation/doc-guide/kernel-doc.rst b/Documentation/doc-guide/kernel-doc.rst index 0268335414ce..f1c03c16f03b 100644 --- a/Documentation/doc-guide/kernel-doc.rst +++ b/Documentation/doc-guide/kernel-doc.rst | |||
@@ -112,16 +112,17 @@ Example kernel-doc function comment:: | |||
112 | 112 | ||
113 | /** | 113 | /** |
114 | * foobar() - Brief description of foobar. | 114 | * foobar() - Brief description of foobar. |
115 | * @arg: Description of argument of foobar. | 115 | * @argument1: Description of parameter argument1 of foobar. |
116 | * @argument2: Description of parameter argument2 of foobar. | ||
116 | * | 117 | * |
117 | * Longer description of foobar. | 118 | * Longer description of foobar. |
118 | * | 119 | * |
119 | * Return: Description of return value of foobar. | 120 | * Return: Description of return value of foobar. |
120 | */ | 121 | */ |
121 | int foobar(int arg) | 122 | int foobar(int argument1, char *argument2) |
122 | 123 | ||
123 | The format is similar for documentation for structures, enums, paragraphs, | 124 | The format is similar for documentation for structures, enums, paragraphs, |
124 | etc. See the sections below for details. | 125 | etc. See the sections below for specific details of each type. |
125 | 126 | ||
126 | The kernel-doc structure is extracted from the comments, and proper `Sphinx C | 127 | The kernel-doc structure is extracted from the comments, and proper `Sphinx C |
127 | Domain`_ function and type descriptions with anchors are generated for them. The | 128 | Domain`_ function and type descriptions with anchors are generated for them. The |
@@ -130,6 +131,43 @@ cross-references. See below for details. | |||
130 | 131 | ||
131 | .. _Sphinx C Domain: http://www.sphinx-doc.org/en/stable/domains.html | 132 | .. _Sphinx C Domain: http://www.sphinx-doc.org/en/stable/domains.html |
132 | 133 | ||
134 | |||
135 | Parameters and member arguments | ||
136 | ------------------------------- | ||
137 | |||
138 | The kernel-doc function comments describe each parameter to the function and | ||
139 | function typedefs or each member of struct/union, in order, with the | ||
140 | ``@argument:`` descriptions. For each non-private member argument, one | ||
141 | ``@argument`` definition is needed. | ||
142 | |||
143 | The ``@argument:`` descriptions begin on the very next line following | ||
144 | the opening brief function description line, with no intervening blank | ||
145 | comment lines. | ||
146 | |||
147 | The ``@argument:`` descriptions may span multiple lines. | ||
148 | |||
149 | .. note:: | ||
150 | |||
151 | If the ``@argument`` description has multiple lines, the continuation | ||
152 | of the description should be starting exactly at the same column as | ||
153 | the previous line, e. g.:: | ||
154 | |||
155 | * @argument: some long description | ||
156 | * that continues on next lines | ||
157 | |||
158 | or:: | ||
159 | |||
160 | * @argument: | ||
161 | * some long description | ||
162 | * that continues on next lines | ||
163 | |||
164 | If a function or typedef parameter argument is ``...`` (e. g. a variable | ||
165 | number of arguments), its description should be listed in kernel-doc | ||
166 | notation as:: | ||
167 | |||
168 | * @...: description | ||
169 | |||
170 | |||
133 | Highlights and cross-references | 171 | Highlights and cross-references |
134 | ------------------------------- | 172 | ------------------------------- |
135 | 173 | ||