]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
virtio: add ability to iterate over vqs
authorMichael S. Tsirkin <mst@redhat.com>
Fri, 20 Apr 2018 17:22:40 +0000 (20:22 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 May 2018 14:59:54 +0000 (07:59 -0700)
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>
include/linux/virtio.h

index 65261a7244fcea2e3d0c2562e40e6ba4e5b1bc48..8ffec6d9c24086ee9e122a95f5dfda5ff1cebc00 100644 (file)
@@ -122,6 +122,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).