Non-void functions should describe their return values in their kernel-doc
comments. Currently, some don't, others do in various forms. For example:
* Return the result.
* Return: The result.
* Returns the result.
* Returns: the result.
* Return Value: The result.
* @return: the result.
* This function returns the result.
* It will return the result.
Defining a convention would improve consistency of kernel-doc comments. It
would also help scripts/kernel-doc identify the text describing the return
value of a function. Thus allowing additional checks on the comments, and
suitable highlighting in the generated docs (man pages, html, etc).
So, as a convention, use a section named "Return" to describe the return
value of a function.
Signed-off-by: Yacine Belkadi <yacine.belkadi.1@gmail.com>
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* comment lines.
*
* The longer description can have multiple paragraphs.
* comment lines.
*
* The longer description can have multiple paragraphs.
+ *
+ * Return: Describe the return value of foobar.
*/
The short description following the subject can span multiple lines
*/
The short description following the subject can span multiple lines
kernel-doc notation as:
* @...: description
kernel-doc notation as:
* @...: description
+The return value, if any, should be described in a dedicated section
+named "Return".
Example kernel-doc data structure comment.
Example kernel-doc data structure comment.
"section header:" names must be unique per function (or struct,
union, typedef, enum).
"section header:" names must be unique per function (or struct,
union, typedef, enum).
+Use the section header "Return" for sections describing the return value
+of a function.
+
Avoid putting a spurious blank line after the function name, or else the
description will be repeated!
Avoid putting a spurious blank line after the function name, or else the
description will be repeated!
NOTE 1: The multi-line descriptive text you provide does *not* recognize
line breaks, so if you try to format some text nicely, as in:
NOTE 1: The multi-line descriptive text you provide does *not* recognize
line breaks, so if you try to format some text nicely, as in:
0 - cool
1 - invalid arg
2 - out of memory
this will all run together and produce:
0 - cool
1 - invalid arg
2 - out of memory
this will all run together and produce:
- Return codes 0 - cool 1 - invalid arg 2 - out of memory
+ Return: 0 - cool 1 - invalid arg 2 - out of memory
NOTE 2: If the descriptive text you provide has lines that begin with
some phrase followed by a colon, each of those phrases will be taken as
a new section heading, which means you should similarly try to avoid text
like:
NOTE 2: If the descriptive text you provide has lines that begin with
some phrase followed by a colon, each of those phrases will be taken as
a new section heading, which means you should similarly try to avoid text
like:
0: cool
1: invalid arg
2: out of memory
0: cool
1: invalid arg
2: out of memory