[PATCH 3.16 223/366] virtio: add ability to iterate over vqs

From: Ben Hutchings
Date: Sun Oct 14 2018 - 12:02:58 EST


3.16.60-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: "Michael S. Tsirkin" <mst@xxxxxxxxxx>

commit 24a7e4d20783c0514850f24a5c41ede46ab058f0 upstream.

For cleanup it's helpful to be able to simply scan all vqs and discard
all data. Add an iterator to do that.

Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
include/linux/virtio.h | 3 +++
1 file changed, 3 insertions(+)

--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -108,6 +108,9 @@ void unregister_virtio_device(struct vir

void virtio_break_device(struct virtio_device *dev);

+#define virtio_device_for_each_vq(vdev, vq) \
+ list_for_each_entry(vq, &vdev->vqs, list)
+
/**
* virtio_driver - operations for a virtio I/O driver
* @driver: underlying device driver (populate name and owner).