diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-10-16 23:56:15 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-12-18 15:20:35 +1030 |
commit | 589575a23562b588c82bdb57ed8c09bee5f0f174 (patch) | |
tree | 491cdbd2ae154e2a7bc9011be66658dbb14ef5b6 /drivers/char | |
parent | 98e8c6bc66048db6f921ccd5b24f0e09804cfcca (diff) | |
download | linux-589575a23562b588c82bdb57ed8c09bee5f0f174.tar.gz linux-589575a23562b588c82bdb57ed8c09bee5f0f174.tar.xz |
virtio: console: make it clear that virtqueue_add_buf() no longer returns > 0
We simplified virtqueue_add_buf(), make it clear in the callers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/virtio_console.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 89bdc31a3dc6..6a369942da84 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -461,7 +461,7 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, vq = portdev->c_ovq; sg_init_one(sg, &cpkt, sizeof(cpkt)); - if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) >= 0) { + if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) { virtqueue_kick(vq); while (!virtqueue_get_buf(vq, &len)) cpu_relax(); @@ -526,7 +526,7 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg, struct buffer_token *tok, bool nonblock) { struct virtqueue *out_vq; - ssize_t ret; + int err; unsigned long flags; unsigned int len; @@ -536,17 +536,17 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg, reclaim_consumed_buffers(port); - ret = virtqueue_add_buf(out_vq, sg, nents, 0, tok, GFP_ATOMIC); + err = virtqueue_add_buf(out_vq, sg, nents, 0, tok, GFP_ATOMIC); /* Tell Host to go! */ virtqueue_kick(out_vq); - if (ret < 0) { + if (err) { in_count = 0; goto done; } - if (ret == 0) + if (out_vq->num_free == 0) port->outvq_full = true; if (nonblock) |