summaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-10-16 15:26:15 +0200
committerRusty Russell <rusty@rustcorp.com.au>2012-12-18 05:50:34 +0100
commit98e8c6bc66048db6f921ccd5b24f0e09804cfcca (patch)
tree42ba3a2f6e3ce22741c6a970ca99b7beab0ffbbb /drivers/virtio
parentvirtio: console: don't rely on virtqueue_add_buf() returning capacity. (diff)
downloadlinux-98e8c6bc66048db6f921ccd5b24f0e09804cfcca.tar.xz
linux-98e8c6bc66048db6f921ccd5b24f0e09804cfcca.zip
virtio: make virtqueue_add_buf() returning 0 on success, not capacity.
Now noone relies on this behavior, we simplify virtqueue_add_buf() so it return 0 or -errno. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_ring.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 33a4ce009bcc..ffd7e7da5d3b 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -188,10 +188,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq,
* Caller must ensure we don't call this with other virtqueue operations
* at the same time (except where noted).
*
- * Returns remaining capacity of queue or a negative error
- * (ie. ENOSPC). Note that it only really makes sense to treat all
- * positive return values as "available": indirect buffers mean that
- * we can put an entire sg[] array inside a single queue entry.
+ * Returns zero or a negative error (ie. ENOSPC, ENOMEM).
*/
int virtqueue_add_buf(struct virtqueue *_vq,
struct scatterlist sg[],
@@ -291,7 +288,7 @@ add_head:
pr_debug("Added buffer head %i to %p\n", head, vq);
END_USE(vq);
- return vq->vq.num_free;
+ return 0;
}
EXPORT_SYMBOL_GPL(virtqueue_add_buf);