aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-10-16 09:26:15 -0400
committerRusty Russell <rusty@rustcorp.com.au>2012-12-17 23:50:35 -0500
commit589575a23562b588c82bdb57ed8c09bee5f0f174 (patch)
tree491cdbd2ae154e2a7bc9011be66658dbb14ef5b6 /drivers/char
parent98e8c6bc66048db6f921ccd5b24f0e09804cfcca (diff)
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.c10
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,
461 vq = portdev->c_ovq; 461 vq = portdev->c_ovq;
462 462
463 sg_init_one(sg, &cpkt, sizeof(cpkt)); 463 sg_init_one(sg, &cpkt, sizeof(cpkt));
464 if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) >= 0) { 464 if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) {
465 virtqueue_kick(vq); 465 virtqueue_kick(vq);
466 while (!virtqueue_get_buf(vq, &len)) 466 while (!virtqueue_get_buf(vq, &len))
467 cpu_relax(); 467 cpu_relax();
@@ -526,7 +526,7 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg,
526 struct buffer_token *tok, bool nonblock) 526 struct buffer_token *tok, bool nonblock)
527{ 527{
528 struct virtqueue *out_vq; 528 struct virtqueue *out_vq;
529 ssize_t ret; 529 int err;
530 unsigned long flags; 530 unsigned long flags;
531 unsigned int len; 531 unsigned int len;
532 532
@@ -536,17 +536,17 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg,
536 536
537 reclaim_consumed_buffers(port); 537 reclaim_consumed_buffers(port);
538 538
539 ret = virtqueue_add_buf(out_vq, sg, nents, 0, tok, GFP_ATOMIC); 539 err = virtqueue_add_buf(out_vq, sg, nents, 0, tok, GFP_ATOMIC);
540 540
541 /* Tell Host to go! */ 541 /* Tell Host to go! */
542 virtqueue_kick(out_vq); 542 virtqueue_kick(out_vq);
543 543
544 if (ret < 0) { 544 if (err) {
545 in_count = 0; 545 in_count = 0;
546 goto done; 546 goto done;
547 } 547 }
548 548
549 if (ret == 0) 549 if (out_vq->num_free == 0)
550 port->outvq_full = true; 550 port->outvq_full = true;
551 551
552 if (nonblock) 552 if (nonblock)