Skip to contentSkip to conversation

virtio: Add missing documentation for structure fields

PATCH Superseded Simon Horman 2 participants 3 messages May 11, 2023 – May 19, 2023 virtio core

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 virtio: Add missing documentation for structure fields

Add missing documentation for the vqs_list_lock field of struct virtio_device, and the validate field of struct virtio_driver.

./scripts/kernel-doc says:

.../virtio.h:131: warning: Function parameter or member 'vqs_list_lock' not described in 'virtio_device' .../virtio.h:192: warning: Function parameter or member 'validate' not described in 'virtio_driver' 2 warnings as Errors

No functional changes intended.

---
Changes in v2:
- As suggested by Michael S. Tsirkin
+ @validate is not called on probe
+ @validate does validates config space
+ embarrassingly, validate was misspelt
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 include/linux/virtio.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/virtio.h +2 -0
index b93238db94e3..3abe8e9c8090 100644
@@ -103,6 +103,7 @@ int virtqueue_resize(struct virtqueue *vq, u32 num,
  * @config_enabled: configuration change reporting enabled
  * @config_change_pending: configuration change reported while disabled
  * @config_lock: protects configuration change reporting
+ * @vqs_list_lock: protects @vqs.
  * @dev: underlying device.
  * @id: the device type identification (used to match it with a driver).
  * @config: the configuration ops for this device.
@@ -160,6 +161,7 @@ size_t virtio_max_dma_size(const struct virtio_device *vdev);
  * @feature_table_size: number of entries in the feature table array.
  * @feature_table_legacy: same as feature_table but when working in legacy mode.
  * @feature_table_size_legacy: number of entries in feature table legacy array.
+ * @validate: the function to call to validate features and config space
  * @probe: the function to call when a device is found.  Returns 0 or -errno.
  * @scan: optional function to call after successful probe; intended
  *    for virtio-scsi to invoke a scan.
Reviewed-by on v2 1/1
#1 lore raw
Quoted 21 lines · Simon Horman

Add missing documentation for the vqs_list_lock field of struct virtio_device, and the validate field of struct virtio_driver.

./scripts/kernel-doc says:

.../virtio.h:131: warning: Function parameter or member 'vqs_list_lock' not described in 'virtio_device' .../virtio.h:192: warning: Function parameter or member 'validate' not described in 'virtio_driver' 2 warnings as Errors

No functional changes intended.

---
Changes in v2:
- As suggested by Michael S. Tsirkin
+ @validate is not called on probe
+ @validate does validates config space
+ embarrassingly, validate was misspelt
- Link to v1: https://lore.kernel.org/r/[email protected]
---
include/linux/virtio.h | 2 ++

Quoted 1 line
1 file changed, 2 insertions(+)

I left some minor comments, anyway this version LGTM:

include/linux/virtio.h int virtqueue_resize(struct virtqueue *vq, u32 num, · line 106

Quoted 10 lines
include/linux/virtio.h +1 -0
index b93238db94e3..3abe8e9c8090 100644
@@ -103,6 +103,7 @@ int virtqueue_resize(struct virtqueue *vq, u32 num,
 * @config_enabled: configuration change reporting enabled
 * @config_change_pending: configuration change reported while disabled
 * @config_lock: protects configuration change reporting
+ * @vqs_list_lock: protects @vqs.

Maybe we can now remove /* Protects VQs list access */

include/linux/virtio.h size_t virtio_max_dma_size(const struct virtio_device *vdev); · line 164

Quoted 8 lines
include/linux/virtio.h +1 -0
 * @dev: underlying device.
 * @id: the device type identification (used to match it with a driver).
 * @config: the configuration ops for this device.
@@ -160,6 +161,7 @@ size_t virtio_max_dma_size(const struct virtio_device *vdev);
 * @feature_table_size: number of entries in the feature table array.
 * @feature_table_legacy: same as feature_table but when working in legacy mode.
 * @feature_table_size_legacy: number of entries in feature table legacy array.
+ * @validate: the function to call to validate features and config space

Maybe we can add ". Returns 0 or -errno."

Thanks,
Stefano

include/linux/virtio.h size_t virtio_max_dma_size(const struct virtio_device *vdev); · line 167

Quoted 4 lines
include/linux/virtio.h +0 -0
 * @probe: the function to call when a device is found.  Returns 0 or -errno.
 * @scan: optional function to call after successful probe; intended
 *    for virtio-scsi to invoke a scan.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#2 lore raw
Quoted 24 lines · Stefano Garzarella
Quoted 21 lines · Simon Horman

Add missing documentation for the vqs_list_lock field of struct virtio_device, and the validate field of struct virtio_driver.

./scripts/kernel-doc says:

.../virtio.h:131: warning: Function parameter or member 'vqs_list_lock' not described in 'virtio_device' .../virtio.h:192: warning: Function parameter or member 'validate' not described in 'virtio_driver' 2 warnings as Errors

No functional changes intended.

---
Changes in v2:
- As suggested by Michael S. Tsirkin
+ @validate is not called on probe
+ @validate does validates config space
+ embarrassingly, validate was misspelt
- Link to v1: https://lore.kernel.org/r/[email protected]
---
include/linux/virtio.h | 2 ++

Quoted 1 line
1 file changed, 2 insertions(+)
Quoted 3 lines

I left some minor comments, anyway this version LGTM:

Thanks, and sorry for the delay.

Quoted 11 lines

include/linux/virtio.h int virtqueue_resize(struct virtqueue *vq, u32 num, · line 106

Quoted 9 lines
include/linux/virtio.h +1 -0
index b93238db94e3..3abe8e9c8090 100644
@@ -103,6 +103,7 @@ int virtqueue_resize(struct virtqueue *vq, u32 num,
 * @config_enabled: configuration change reporting enabled
 * @config_change_pending: configuration change reported while disabled
 * @config_lock: protects configuration change reporting
+ * @vqs_list_lock: protects @vqs.

Maybe we can now remove /* Protects VQs list access */

Yes, I think so.

Quoted 10 lines

include/linux/virtio.h size_t virtio_max_dma_size(const struct virtio_device *vdev); · line 164

Quoted 8 lines
include/linux/virtio.h +1 -0
 * @dev: underlying device.
 * @id: the device type identification (used to match it with a driver).
 * @config: the configuration ops for this device.
@@ -160,6 +161,7 @@ size_t virtio_max_dma_size(const struct virtio_device *vdev);
 * @feature_table_size: number of entries in the feature table array.
 * @feature_table_legacy: same as feature_table but when working in legacy mode.
 * @feature_table_size_legacy: number of entries in feature table legacy array.
+ * @validate: the function to call to validate features and config space

Maybe we can add ". Returns 0 or -errno."

Sure, I'll plan to include this in v3.

* @validate: the function to call to validate features and config space.
* Returns 0 or -errno.

...