diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-18 07:30:13 -0500 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-12-21 15:41:46 -0500 |
commit | 8ad72163165265b686902c182c1b4a913e738a81 (patch) | |
tree | bdff1072d4c1f13cb35e2411adb9a960871cc589 /Documentation/doc-guide | |
parent | 7c9aa0157ef4b4cc28c98b08a971dc8344e64aab (diff) |
scripts: kernel-doc: parse next structs/unions
There are several places within the Kernel tree with nested
structs/unions, like this one:
struct ingenic_cgu_clk_info {
const char *name;
enum {
CGU_CLK_NONE = 0,
CGU_CLK_EXT = BIT(0),
CGU_CLK_PLL = BIT(1),
CGU_CLK_GATE = BIT(2),
CGU_CLK_MUX = BIT(3),
CGU_CLK_MUX_GLITCHFREE = BIT(4),
CGU_CLK_DIV = BIT(5),
CGU_CLK_FIXDIV = BIT(6),
CGU_CLK_CUSTOM = BIT(7),
} type;
int parents[4];
union {
struct ingenic_cgu_pll_info pll;
struct {
struct ingenic_cgu_gate_info gate;
struct ingenic_cgu_mux_info mux;
struct ingenic_cgu_div_info div;
struct ingenic_cgu_fixdiv_info fixdiv;
};
struct ingenic_cgu_custom_info custom;
};
};
Currently, such struct is documented as:
**Definition**
::
struct ingenic_cgu_clk_info {
const char * name;
};
**Members**
``name``
name of the clock
With is obvioulsy wrong. It also generates an error:
drivers/clk/ingenic/cgu.h:169: warning: No description found for parameter 'enum'
However, there's nothing wrong with this kernel-doc markup: everything
is documented there.
It makes sense to document all fields there. So, add a
way for the core to parse those structs.
With this patch, all documented fields will properly generate
documentation.
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 | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Documentation/doc-guide/kernel-doc.rst b/Documentation/doc-guide/kernel-doc.rst index 14c226e8154f..722d4525f7cf 100644 --- a/Documentation/doc-guide/kernel-doc.rst +++ b/Documentation/doc-guide/kernel-doc.rst | |||
@@ -281,6 +281,52 @@ comment block. | |||
281 | The kernel-doc data structure comments describe each member of the structure, | 281 | The kernel-doc data structure comments describe each member of the structure, |
282 | in order, with the member descriptions. | 282 | in order, with the member descriptions. |
283 | 283 | ||
284 | Nested structs/unions | ||
285 | ~~~~~~~~~~~~~~~~~~~~~ | ||
286 | |||
287 | It is possible to document nested structs unions, like:: | ||
288 | |||
289 | /** | ||
290 | * struct nested_foobar - a struct with nested unions and structs | ||
291 | * @arg1: - first argument of anonymous union/anonymous struct | ||
292 | * @arg2: - second argument of anonymous union/anonymous struct | ||
293 | * @arg3: - third argument of anonymous union/anonymous struct | ||
294 | * @arg4: - fourth argument of anonymous union/anonymous struct | ||
295 | * @bar.st1.arg1 - first argument of struct st1 on union bar | ||
296 | * @bar.st1.arg2 - second argument of struct st1 on union bar | ||
297 | * @bar.st2.arg1 - first argument of struct st2 on union bar | ||
298 | * @bar.st2.arg2 - second argument of struct st2 on union bar | ||
299 | struct nested_foobar { | ||
300 | /* Anonymous union/struct*/ | ||
301 | union { | ||
302 | struct { | ||
303 | int arg1; | ||
304 | int arg2; | ||
305 | } | ||
306 | struct { | ||
307 | void *arg3; | ||
308 | int arg4; | ||
309 | } | ||
310 | } | ||
311 | union { | ||
312 | struct { | ||
313 | int arg1; | ||
314 | int arg2; | ||
315 | } st1; | ||
316 | struct { | ||
317 | void *arg1; | ||
318 | int arg2; | ||
319 | } st2; | ||
320 | } bar; | ||
321 | }; | ||
322 | |||
323 | .. note:: | ||
324 | |||
325 | #) When documenting nested structs or unions, if the struct/union ``foo`` | ||
326 | is named, the argument ``bar`` inside it should be documented as | ||
327 | ``@foo.bar:`` | ||
328 | #) When the nested struct/union is anonymous, the argument ``bar`` on it | ||
329 | should be documented as ``@bar:`` | ||
284 | 330 | ||
285 | Typedef documentation | 331 | Typedef documentation |
286 | --------------------- | 332 | --------------------- |