summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2018-04-20 20:22:40 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-01 15:13:05 -0700
commit90488aaaf37f7cf3b49f834b4fd9a66bf773d7ec (patch)
tree5974698d8efeea6a131f9ed1555f3e364542a5be /include
parent0160bda77b3360ee3a2993ae8ac64fed90998375 (diff)
virtio: add ability to iterate over vqs
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. Cc: stable@vger.kernel.org Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/virtio.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index d5eb5479a425..3f8f35053260 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -143,6 +143,9 @@ int virtio_device_freeze(struct virtio_device *dev);
int virtio_device_restore(struct virtio_device *dev);
#endif
+#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).