]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
virtio: console: make it clear that virtqueue_add_buf() no longer returns > 0
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 16 Oct 2012 13:26:15 +0000 (23:56 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 16 Oct 2012 14:13:42 +0000 (00:43 +1030)
We simplified virtqueue_add_buf(), make it clear in the callers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/char/virtio_console.c

index 8ab9c3d4bf134c23bda43adafc688485a1c9e764..82ebe027166059a8100d2250128ad32db6eaec1d 100644 (file)
@@ -459,7 +459,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();
@@ -524,7 +524,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;
 
@@ -534,17 +534,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)