Commit 98e8c6bc66048db6f921ccd5b24f0e09804cfcca
1 parent
49e86f1686
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 2 additions and 5 deletions Side-by-side Diff
drivers/virtio/virtio_ring.c
... | ... | @@ -188,10 +188,7 @@ |
188 | 188 | * Caller must ensure we don't call this with other virtqueue operations |
189 | 189 | * at the same time (except where noted). |
190 | 190 | * |
191 | - * Returns remaining capacity of queue or a negative error | |
192 | - * (ie. ENOSPC). Note that it only really makes sense to treat all | |
193 | - * positive return values as "available": indirect buffers mean that | |
194 | - * we can put an entire sg[] array inside a single queue entry. | |
191 | + * Returns zero or a negative error (ie. ENOSPC, ENOMEM). | |
195 | 192 | */ |
196 | 193 | int virtqueue_add_buf(struct virtqueue *_vq, |
197 | 194 | struct scatterlist sg[], |
... | ... | @@ -291,7 +288,7 @@ |
291 | 288 | pr_debug("Added buffer head %i to %p\n", head, vq); |
292 | 289 | END_USE(vq); |
293 | 290 | |
294 | - return vq->vq.num_free; | |
291 | + return 0; | |
295 | 292 | } |
296 | 293 | EXPORT_SYMBOL_GPL(virtqueue_add_buf); |
297 | 294 |