2023-12-06 18:17:34

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH] xen/xenbus: client: fix kernel-doc comments

Correct function kernel-doc notation to prevent warnings from
scripts/kernel-doc.

xenbus_client.c:134: warning: No description found for return value of 'xenbus_watch_path'
xenbus_client.c:177: warning: No description found for return value of 'xenbus_watch_pathfmt'
xenbus_client.c:258: warning: missing initial short description on line:
* xenbus_switch_state
xenbus_client.c:267: warning: No description found for return value of 'xenbus_switch_state'
xenbus_client.c:308: warning: missing initial short description on line:
* xenbus_dev_error
xenbus_client.c:327: warning: missing initial short description on line:
* xenbus_dev_fatal
xenbus_client.c:350: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* Equivalent to xenbus_dev_fatal(dev, err, fmt, args), but helps
xenbus_client.c:457: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* Allocate an event channel for the given xenbus_device, assigning the newly
xenbus_client.c:486: warning: expecting prototype for Free an existing event channel. Returns 0 on success or(). Prototype was for xenbus_free_evtchn() instead
xenbus_client.c:502: warning: missing initial short description on line:
* xenbus_map_ring_valloc
xenbus_client.c:517: warning: No description found for return value of 'xenbus_map_ring_valloc'
xenbus_client.c:602: warning: missing initial short description on line:
* xenbus_unmap_ring
xenbus_client.c:614: warning: No description found for return value of 'xenbus_unmap_ring'
xenbus_client.c:715: warning: missing initial short description on line:
* xenbus_unmap_ring_vfree
xenbus_client.c:727: warning: No description found for return value of 'xenbus_unmap_ring_vfree'
xenbus_client.c:919: warning: missing initial short description on line:
* xenbus_read_driver_state
xenbus_client.c:926: warning: No description found for return value of 'xenbus_read_driver_state'

Signed-off-by: Randy Dunlap <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Oleksandr Tyshchenko <[email protected]>
Cc: [email protected]
---
drivers/xen/xenbus/xenbus_client.c | 59 +++++++++++++++------------
1 file changed, 34 insertions(+), 25 deletions(-)

diff -- a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -119,11 +119,13 @@ EXPORT_SYMBOL_GPL(xenbus_strstate);
* @callback: callback to register
*
* Register a @watch on the given path, using the given xenbus_watch structure
- * for storage, and the given @callback function as the callback. Return 0 on
- * success, or -errno on error. On success, the given @path will be saved as
- * @watch->node, and remains the caller's to free. On error, @watch->node will
+ * for storage, and the given @callback function as the callback. On success,
+ * the given @path will be saved as @watch->node, and remains the
+ * caller's to free. On error, @watch->node will
* be NULL, the device will switch to %XenbusStateClosing, and the error will
* be saved in the store.
+ *
+ * Returns: %0 on success or -errno on error
*/
int xenbus_watch_path(struct xenbus_device *dev, const char *path,
struct xenbus_watch *watch,
@@ -160,12 +162,14 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path);
* @pathfmt: format of path to watch
*
* Register a watch on the given @path, using the given xenbus_watch
- * structure for storage, and the given @callback function as the callback.
- * Return 0 on success, or -errno on error. On success, the watched path
- * (@path/@path2) will be saved as @watch->node, and becomes the caller's to
- * kfree(). On error, watch->node will be NULL, so the caller has nothing to
+ * structure for storage, and the given @callback function as the
+ * callback. On success, the watched path (@path/@path2) will be saved
+ * as @watch->node, and becomes the caller's to kfree().
+ * On error, watch->node will be NULL, so the caller has nothing to
* free, the device will switch to %XenbusStateClosing, and the error will be
* saved in the store.
+ *
+ * Returns: %0 on success or -errno on error
*/
int xenbus_watch_pathfmt(struct xenbus_device *dev,
struct xenbus_watch *watch,
@@ -255,13 +259,15 @@ abort:
}

/**
- * xenbus_switch_state
+ * xenbus_switch_state - save the new state of a driver
* @dev: xenbus device
* @state: new state
*
* Advertise in the store a change of the given driver to the given new_state.
- * Return 0 on success, or -errno on error. On error, the device will switch
- * to XenbusStateClosing, and the error will be saved in the store.
+ * On error, the device will switch to XenbusStateClosing, and the error
+ * will be saved in the store.
+ *
+ * Returns: %0 on success or -errno on error
*/
int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state state)
{
@@ -305,7 +311,7 @@ static void xenbus_va_dev_error(struct x
}

/**
- * xenbus_dev_error
+ * xenbus_dev_error - place an error message into the store
* @dev: xenbus device
* @err: error to report
* @fmt: error message format
@@ -324,7 +330,7 @@ void xenbus_dev_error(struct xenbus_devi
EXPORT_SYMBOL_GPL(xenbus_dev_error);

/**
- * xenbus_dev_fatal
+ * xenbus_dev_fatal - put an error messages into the store and then shutdown
* @dev: xenbus device
* @err: error to report
* @fmt: error message format
@@ -346,7 +352,7 @@ void xenbus_dev_fatal(struct xenbus_devi
}
EXPORT_SYMBOL_GPL(xenbus_dev_fatal);

-/**
+/*
* Equivalent to xenbus_dev_fatal(dev, err, fmt, args), but helps
* avoiding recursion within xenbus_switch_state.
*/
@@ -453,7 +459,7 @@ void xenbus_teardown_ring(void **vaddr,
}
EXPORT_SYMBOL_GPL(xenbus_teardown_ring);

-/**
+/*
* Allocate an event channel for the given xenbus_device, assigning the newly
* created local port to *port. Return 0 on success, or -errno on error. On
* error, the device will switch to XenbusStateClosing, and the error will be
@@ -479,7 +485,7 @@ int xenbus_alloc_evtchn(struct xenbus_de
EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn);


-/**
+/*
* Free an existing event channel. Returns 0 on success or -errno on error.
*/
int xenbus_free_evtchn(struct xenbus_device *dev, evtchn_port_t port)
@@ -499,7 +505,7 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn);


/**
- * xenbus_map_ring_valloc
+ * xenbus_map_ring_valloc - allocate & map pages of VA space
* @dev: xenbus device
* @gnt_refs: grant reference array
* @nr_grefs: number of grant references
@@ -507,10 +513,11 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn);
*
* Map @nr_grefs pages of memory into this domain from another
* domain's grant table. xenbus_map_ring_valloc allocates @nr_grefs
- * pages of virtual address space, maps the pages to that address, and
- * sets *vaddr to that address. Returns 0 on success, and -errno on
- * error. If an error is returned, device will switch to
+ * pages of virtual address space, maps the pages to that address, and sets
+ * *vaddr to that address. If an error is returned, device will switch to
* XenbusStateClosing and the error message will be saved in XenStore.
+ *
+ * Returns: %0 on success or -errno on error
*/
int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs,
unsigned int nr_grefs, void **vaddr)
@@ -599,14 +606,15 @@ static int __xenbus_map_ring(struct xenb
}

/**
- * xenbus_unmap_ring
+ * xenbus_unmap_ring - unmap memory from another domain
* @dev: xenbus device
* @handles: grant handle array
* @nr_handles: number of handles in the array
* @vaddrs: addresses to unmap
*
* Unmap memory in this domain that was imported from another domain.
- * Returns 0 on success and returns GNTST_* on error
+ *
+ * Returns: %0 on success or GNTST_* on error
* (see xen/include/interface/grant_table.h).
*/
static int xenbus_unmap_ring(struct xenbus_device *dev, grant_handle_t *handles,
@@ -712,7 +720,7 @@ static int xenbus_map_ring_hvm(struct xe
}

/**
- * xenbus_unmap_ring_vfree
+ * xenbus_unmap_ring_vfree - unmap a page of memory from another domain
* @dev: xenbus device
* @vaddr: addr to unmap
*
@@ -720,7 +728,8 @@ static int xenbus_map_ring_hvm(struct xe
* Unmap a page of memory in this domain that was imported from another domain.
* Use xenbus_unmap_ring_vfree if you mapped in your memory with
* xenbus_map_ring_valloc (it will free the virtual address space).
- * Returns 0 on success and returns GNTST_* on error
+ *
+ * Returns: %0 on success or GNTST_* on error
* (see xen/include/interface/grant_table.h).
*/
int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr)
@@ -916,10 +925,10 @@ static int xenbus_unmap_ring_hvm(struct
}

/**
- * xenbus_read_driver_state
+ * xenbus_read_driver_state - read from state from a store path
* @path: path for driver
*
- * Return the state of the driver rooted at the given store path, or
+ * Returns: the state of the driver rooted at the given store path, or
* XenbusStateUnknown if no state can be read.
*/
enum xenbus_state xenbus_read_driver_state(const char *path)


2023-12-07 09:28:43

by Juergen Gross

[permalink] [raw]
Subject: Re: [PATCH] xen/xenbus: client: fix kernel-doc comments

On 06.12.23 19:17, Randy Dunlap wrote:
> Correct function kernel-doc notation to prevent warnings from
> scripts/kernel-doc.
>
> xenbus_client.c:134: warning: No description found for return value of 'xenbus_watch_path'
> xenbus_client.c:177: warning: No description found for return value of 'xenbus_watch_pathfmt'
> xenbus_client.c:258: warning: missing initial short description on line:
> * xenbus_switch_state
> xenbus_client.c:267: warning: No description found for return value of 'xenbus_switch_state'
> xenbus_client.c:308: warning: missing initial short description on line:
> * xenbus_dev_error
> xenbus_client.c:327: warning: missing initial short description on line:
> * xenbus_dev_fatal
> xenbus_client.c:350: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
> * Equivalent to xenbus_dev_fatal(dev, err, fmt, args), but helps
> xenbus_client.c:457: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
> * Allocate an event channel for the given xenbus_device, assigning the newly
> xenbus_client.c:486: warning: expecting prototype for Free an existing event channel. Returns 0 on success or(). Prototype was for xenbus_free_evtchn() instead
> xenbus_client.c:502: warning: missing initial short description on line:
> * xenbus_map_ring_valloc
> xenbus_client.c:517: warning: No description found for return value of 'xenbus_map_ring_valloc'
> xenbus_client.c:602: warning: missing initial short description on line:
> * xenbus_unmap_ring
> xenbus_client.c:614: warning: No description found for return value of 'xenbus_unmap_ring'
> xenbus_client.c:715: warning: missing initial short description on line:
> * xenbus_unmap_ring_vfree
> xenbus_client.c:727: warning: No description found for return value of 'xenbus_unmap_ring_vfree'
> xenbus_client.c:919: warning: missing initial short description on line:
> * xenbus_read_driver_state
> xenbus_client.c:926: warning: No description found for return value of 'xenbus_read_driver_state'
>
> Signed-off-by: Randy Dunlap <[email protected]>
> Cc: Juergen Gross <[email protected]>
> Cc: Stefano Stabellini <[email protected]>
> Cc: Oleksandr Tyshchenko <[email protected]>
> Cc: [email protected]

Reviewed-by: Juergen Gross <[email protected]>

with one nit below (can be fixed while committing) ...

> ---
> drivers/xen/xenbus/xenbus_client.c | 59 +++++++++++++++------------
> 1 file changed, 34 insertions(+), 25 deletions(-)
>
> diff -- a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
> --- a/drivers/xen/xenbus/xenbus_client.c
> +++ b/drivers/xen/xenbus/xenbus_client.c
> @@ -119,11 +119,13 @@ EXPORT_SYMBOL_GPL(xenbus_strstate);
> * @callback: callback to register
> *
> * Register a @watch on the given path, using the given xenbus_watch structure
> - * for storage, and the given @callback function as the callback. Return 0 on
> - * success, or -errno on error. On success, the given @path will be saved as
> - * @watch->node, and remains the caller's to free. On error, @watch->node will
> + * for storage, and the given @callback function as the callback. On success,
> + * the given @path will be saved as @watch->node, and remains the
> + * caller's to free. On error, @watch->node will
> * be NULL, the device will switch to %XenbusStateClosing, and the error will
> * be saved in the store.
> + *
> + * Returns: %0 on success or -errno on error
> */
> int xenbus_watch_path(struct xenbus_device *dev, const char *path,
> struct xenbus_watch *watch,
> @@ -160,12 +162,14 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path);
> * @pathfmt: format of path to watch
> *
> * Register a watch on the given @path, using the given xenbus_watch
> - * structure for storage, and the given @callback function as the callback.
> - * Return 0 on success, or -errno on error. On success, the watched path
> - * (@path/@path2) will be saved as @watch->node, and becomes the caller's to
> - * kfree(). On error, watch->node will be NULL, so the caller has nothing to
> + * structure for storage, and the given @callback function as the
> + * callback. On success, the watched path (@path/@path2) will be saved
> + * as @watch->node, and becomes the caller's to kfree().
> + * On error, watch->node will be NULL, so the caller has nothing to
> * free, the device will switch to %XenbusStateClosing, and the error will be
> * saved in the store.
> + *
> + * Returns: %0 on success or -errno on error
> */
> int xenbus_watch_pathfmt(struct xenbus_device *dev,
> struct xenbus_watch *watch,
> @@ -255,13 +259,15 @@ abort:
> }
>
> /**
> - * xenbus_switch_state
> + * xenbus_switch_state - save the new state of a driver
> * @dev: xenbus device
> * @state: new state
> *
> * Advertise in the store a change of the given driver to the given new_state.
> - * Return 0 on success, or -errno on error. On error, the device will switch
> - * to XenbusStateClosing, and the error will be saved in the store.
> + * On error, the device will switch to XenbusStateClosing, and the error
> + * will be saved in the store.
> + *
> + * Returns: %0 on success or -errno on error
> */
> int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state state)
> {
> @@ -305,7 +311,7 @@ static void xenbus_va_dev_error(struct x
> }
>
> /**
> - * xenbus_dev_error
> + * xenbus_dev_error - place an error message into the store
> * @dev: xenbus device
> * @err: error to report
> * @fmt: error message format
> @@ -324,7 +330,7 @@ void xenbus_dev_error(struct xenbus_devi
> EXPORT_SYMBOL_GPL(xenbus_dev_error);
>
> /**
> - * xenbus_dev_fatal
> + * xenbus_dev_fatal - put an error messages into the store and then shutdown
> * @dev: xenbus device
> * @err: error to report
> * @fmt: error message format
> @@ -346,7 +352,7 @@ void xenbus_dev_fatal(struct xenbus_devi
> }
> EXPORT_SYMBOL_GPL(xenbus_dev_fatal);
>
> -/**
> +/*
> * Equivalent to xenbus_dev_fatal(dev, err, fmt, args), but helps
> * avoiding recursion within xenbus_switch_state.
> */
> @@ -453,7 +459,7 @@ void xenbus_teardown_ring(void **vaddr,
> }
> EXPORT_SYMBOL_GPL(xenbus_teardown_ring);
>
> -/**
> +/*
> * Allocate an event channel for the given xenbus_device, assigning the newly
> * created local port to *port. Return 0 on success, or -errno on error. On
> * error, the device will switch to XenbusStateClosing, and the error will be
> @@ -479,7 +485,7 @@ int xenbus_alloc_evtchn(struct xenbus_de
> EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn);
>
>
> -/**
> +/*
> * Free an existing event channel. Returns 0 on success or -errno on error.
> */
> int xenbus_free_evtchn(struct xenbus_device *dev, evtchn_port_t port)
> @@ -499,7 +505,7 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn);
>
>
> /**
> - * xenbus_map_ring_valloc
> + * xenbus_map_ring_valloc - allocate & map pages of VA space
> * @dev: xenbus device
> * @gnt_refs: grant reference array
> * @nr_grefs: number of grant references
> @@ -507,10 +513,11 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn);
> *
> * Map @nr_grefs pages of memory into this domain from another
> * domain's grant table. xenbus_map_ring_valloc allocates @nr_grefs
> - * pages of virtual address space, maps the pages to that address, and
> - * sets *vaddr to that address. Returns 0 on success, and -errno on
> - * error. If an error is returned, device will switch to
> + * pages of virtual address space, maps the pages to that address, and sets
> + * *vaddr to that address. If an error is returned, device will switch to
> * XenbusStateClosing and the error message will be saved in XenStore.
> + *
> + * Returns: %0 on success or -errno on error
> */
> int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs,
> unsigned int nr_grefs, void **vaddr)
> @@ -599,14 +606,15 @@ static int __xenbus_map_ring(struct xenb
> }
>
> /**
> - * xenbus_unmap_ring
> + * xenbus_unmap_ring - unmap memory from another domain
> * @dev: xenbus device
> * @handles: grant handle array
> * @nr_handles: number of handles in the array
> * @vaddrs: addresses to unmap
> *
> * Unmap memory in this domain that was imported from another domain.
> - * Returns 0 on success and returns GNTST_* on error
> + *
> + * Returns: %0 on success or GNTST_* on error
> * (see xen/include/interface/grant_table.h).
> */
> static int xenbus_unmap_ring(struct xenbus_device *dev, grant_handle_t *handles,
> @@ -712,7 +720,7 @@ static int xenbus_map_ring_hvm(struct xe
> }
>
> /**
> - * xenbus_unmap_ring_vfree
> + * xenbus_unmap_ring_vfree - unmap a page of memory from another domain
> * @dev: xenbus device
> * @vaddr: addr to unmap
> *
> @@ -720,7 +728,8 @@ static int xenbus_map_ring_hvm(struct xe
> * Unmap a page of memory in this domain that was imported from another domain.
> * Use xenbus_unmap_ring_vfree if you mapped in your memory with
> * xenbus_map_ring_valloc (it will free the virtual address space).
> - * Returns 0 on success and returns GNTST_* on error
> + *
> + * Returns: %0 on success or GNTST_* on error
> * (see xen/include/interface/grant_table.h).
> */
> int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr)
> @@ -916,10 +925,10 @@ static int xenbus_unmap_ring_hvm(struct
> }
>
> /**
> - * xenbus_read_driver_state
> + * xenbus_read_driver_state - read from state from a store path

s/read from/read/

> * @path: path for driver
> *
> - * Return the state of the driver rooted at the given store path, or
> + * Returns: the state of the driver rooted at the given store path, or
> * XenbusStateUnknown if no state can be read.
> */
> enum xenbus_state xenbus_read_driver_state(const char *path)


Juergen


Attachments:
OpenPGP_0xB0DE9DD628BF132F.asc (3.66 kB)
OpenPGP public key
OpenPGP_signature.asc (505.00 B)
OpenPGP digital signature
Download all attachments

2023-12-07 16:57:01

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] xen/xenbus: client: fix kernel-doc comments



On 12/7/23 01:27, Juergen Gross wrote:
> On 06.12.23 19:17, Randy Dunlap wrote:
>> Correct function kernel-doc notation to prevent warnings from
>> scripts/kernel-doc.
>>

>>
>> Signed-off-by: Randy Dunlap <[email protected]>
>> Cc: Juergen Gross <[email protected]>
>> Cc: Stefano Stabellini <[email protected]>
>> Cc: Oleksandr Tyshchenko <[email protected]>
>> Cc: [email protected]
>
> Reviewed-by: Juergen Gross <[email protected]>
>
> with one nit below (can be fixed while committing) ...

Ah yes, thanks.

--
~Randy