Re: [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment

From: Baoquan He
Date: Fri Mar 29 2019 - 10:00:06 EST


On 03/29/19 at 11:36am, Oscar Salvador wrote:
> > +/**
> > + * sparse_add_one_section - add a memory section
> > + * @nid: The node to add section on
> > + * @start_pfn: start pfn of the memory range
> > + * @altmap: device page map
> > + *
> > + * This is only intended for hotplug.
> > + *
> > + * Returns:
> > + * 0 on success.
> > + * Other error code on failure:
> > + * - -EEXIST - section has been present.
> > + * - -ENOMEM - out of memory.
>
> I am not really into kernel-doc format, but I thought it was something like:
>
> <--
> Return:
> 0: success
> -EEXIST: Section is already present
> -ENOMEM: Out of memory
> -->
>
> But as I said, I might very well be wrong.

Below is excerpt from doc-guide/kernel-doc.rst. Seems they suggest it
like this if format returned values with multi-line style. While the
format is not strictly defined. I will use it to update.

*Return:
* * 0 - Success
* * -EEXIST - Section is already present
* * -ENOMEM - Out of memory

The return value, if any, should be described in a dedicated section
named ``Return``.

.. note::

#) The multi-line descriptive text you provide does *not* recognize
line breaks, so if you try to format some text nicely, as in::

* Return:
* 0 - OK
* -EINVAL - invalid argument
* -ENOMEM - out of memory

this will all run together and produce::

Return: 0 - OK -EINVAL - invalid argument -ENOMEM - out of memory

So, in order to produce the desired line breaks, you need to use a
ReST list, e. g.::

* Return:
* * 0 - OK to runtime suspend the device
* * -EBUSY - Device should not be runtime suspended