aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-04-12 09:18:32 -0400
committerRusty Russell <rusty@rustcorp.com.au>2010-05-19 08:45:42 -0400
commit505b0451c47699ca63db70bd5ec3bba187ec4bfd (patch)
treed7d786bc911c8ffa821d7bf63c2bde747fdbc3c7 /drivers/char
parent946cfe0e05664543b22ed674fff3764f41a372c7 (diff)
virtio_console: use virtqueue_xxx wrappers
Switch virtio_console to new virtqueue_xxx wrappers. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/virtio_console.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 196428c2287a..48ce834306b5 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -328,7 +328,7 @@ static void *get_inbuf(struct port *port)
328 unsigned int len; 328 unsigned int len;
329 329
330 vq = port->in_vq; 330 vq = port->in_vq;
331 buf = vq->vq_ops->get_buf(vq, &len); 331 buf = virtqueue_get_buf(vq, &len);
332 if (buf) { 332 if (buf) {
333 buf->len = len; 333 buf->len = len;
334 buf->offset = 0; 334 buf->offset = 0;
@@ -349,8 +349,8 @@ static int add_inbuf(struct virtqueue *vq, struct port_buffer *buf)
349 349
350 sg_init_one(sg, buf->buf, buf->size); 350 sg_init_one(sg, buf->buf, buf->size);
351 351
352 ret = vq->vq_ops->add_buf(vq, sg, 0, 1, buf); 352 ret = virtqueue_add_buf(vq, sg, 0, 1, buf);
353 vq->vq_ops->kick(vq); 353 virtqueue_kick(vq);
354 return ret; 354 return ret;
355} 355}
356 356
@@ -366,7 +366,7 @@ static void discard_port_data(struct port *port)
366 if (port->inbuf) 366 if (port->inbuf)
367 buf = port->inbuf; 367 buf = port->inbuf;
368 else 368 else
369 buf = vq->vq_ops->get_buf(vq, &len); 369 buf = virtqueue_get_buf(vq, &len);
370 370
371 ret = 0; 371 ret = 0;
372 while (buf) { 372 while (buf) {
@@ -374,7 +374,7 @@ static void discard_port_data(struct port *port)
374 ret++; 374 ret++;
375 free_buf(buf); 375 free_buf(buf);
376 } 376 }
377 buf = vq->vq_ops->get_buf(vq, &len); 377 buf = virtqueue_get_buf(vq, &len);
378 } 378 }
379 port->inbuf = NULL; 379 port->inbuf = NULL;
380 if (ret) 380 if (ret)
@@ -421,9 +421,9 @@ static ssize_t send_control_msg(struct port *port, unsigned int event,
421 vq = port->portdev->c_ovq; 421 vq = port->portdev->c_ovq;
422 422
423 sg_init_one(sg, &cpkt, sizeof(cpkt)); 423 sg_init_one(sg, &cpkt, sizeof(cpkt));
424 if (vq->vq_ops->add_buf(vq, sg, 1, 0, &cpkt) >= 0) { 424 if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt) >= 0) {
425 vq->vq_ops->kick(vq); 425 virtqueue_kick(vq);
426 while (!vq->vq_ops->get_buf(vq, &len)) 426 while (!virtqueue_get_buf(vq, &len))
427 cpu_relax(); 427 cpu_relax();
428 } 428 }
429 return 0; 429 return 0;
@@ -439,10 +439,10 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count)
439 out_vq = port->out_vq; 439 out_vq = port->out_vq;
440 440
441 sg_init_one(sg, in_buf, in_count); 441 sg_init_one(sg, in_buf, in_count);
442 ret = out_vq->vq_ops->add_buf(out_vq, sg, 1, 0, in_buf); 442 ret = virtqueue_add_buf(out_vq, sg, 1, 0, in_buf);
443 443
444 /* Tell Host to go! */ 444 /* Tell Host to go! */
445 out_vq->vq_ops->kick(out_vq); 445 virtqueue_kick(out_vq);
446 446
447 if (ret < 0) { 447 if (ret < 0) {
448 in_count = 0; 448 in_count = 0;
@@ -450,7 +450,7 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count)
450 } 450 }
451 451
452 /* Wait till the host acknowledges it pushed out the data we sent. */ 452 /* Wait till the host acknowledges it pushed out the data we sent. */
453 while (!out_vq->vq_ops->get_buf(out_vq, &len)) 453 while (!virtqueue_get_buf(out_vq, &len))
454 cpu_relax(); 454 cpu_relax();
455fail: 455fail:
456 /* We're expected to return the amount of data we wrote */ 456 /* We're expected to return the amount of data we wrote */
@@ -901,7 +901,7 @@ static int remove_port(struct port *port)
901 discard_port_data(port); 901 discard_port_data(port);
902 902
903 /* Remove buffers we queued up for the Host to send us data in. */ 903 /* Remove buffers we queued up for the Host to send us data in. */
904 while ((buf = port->in_vq->vq_ops->detach_unused_buf(port->in_vq))) 904 while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
905 free_buf(buf); 905 free_buf(buf);
906 906
907 kfree(port->name); 907 kfree(port->name);
@@ -1030,7 +1030,7 @@ static void control_work_handler(struct work_struct *work)
1030 vq = portdev->c_ivq; 1030 vq = portdev->c_ivq;
1031 1031
1032 spin_lock(&portdev->cvq_lock); 1032 spin_lock(&portdev->cvq_lock);
1033 while ((buf = vq->vq_ops->get_buf(vq, &len))) { 1033 while ((buf = virtqueue_get_buf(vq, &len))) {
1034 spin_unlock(&portdev->cvq_lock); 1034 spin_unlock(&portdev->cvq_lock);
1035 1035
1036 buf->len = len; 1036 buf->len = len;
@@ -1224,7 +1224,7 @@ static int add_port(struct ports_device *portdev, u32 id)
1224 return 0; 1224 return 0;
1225 1225
1226free_inbufs: 1226free_inbufs:
1227 while ((buf = port->in_vq->vq_ops->detach_unused_buf(port->in_vq))) 1227 while ((buf = virtqueue_detach_unused_buf(port->in_vq)))
1228 free_buf(buf); 1228 free_buf(buf);
1229free_device: 1229free_device:
1230 device_destroy(pdrvdata.class, port->dev->devt); 1230 device_destroy(pdrvdata.class, port->dev->devt);
@@ -1536,10 +1536,10 @@ static void virtcons_remove(struct virtio_device *vdev)
1536 1536
1537 unregister_chrdev(portdev->chr_major, "virtio-portsdev"); 1537 unregister_chrdev(portdev->chr_major, "virtio-portsdev");
1538 1538
1539 while ((buf = portdev->c_ivq->vq_ops->get_buf(portdev->c_ivq, &len))) 1539 while ((buf = virtqueue_get_buf(portdev->c_ivq, &len)))
1540 free_buf(buf); 1540 free_buf(buf);
1541 1541
1542 while ((buf = portdev->c_ivq->vq_ops->detach_unused_buf(portdev->c_ivq))) 1542 while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq)))
1543 free_buf(buf); 1543 free_buf(buf);
1544 1544
1545 vdev->config->del_vqs(vdev); 1545 vdev->config->del_vqs(vdev);