Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273210
b: refs/heads/master
c: d25a9dd
h: refs/heads/master
v: v3
  • Loading branch information
Amit Shah authored and Rusty Russell committed Nov 2, 2011
1 parent afe653e commit 3c57508
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: defde66996476295dc7b1b60ea318965f8c3ad86
refs/heads/master: d25a9ddae93ca97aa03fdab1363baf0e0c35d960
22 changes: 8 additions & 14 deletions trunk/drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,12 @@ static struct port_buffer *alloc_buf(size_t buf_size)
static struct port_buffer *get_inbuf(struct port *port)
{
struct port_buffer *buf;
struct virtqueue *vq;
unsigned int len;

vq = port->in_vq;
buf = virtqueue_get_buf(vq, &len);
if (port->inbuf)
return port->inbuf;

buf = virtqueue_get_buf(port->in_vq, &len);
if (buf) {
buf->len = len;
buf->offset = 0;
Expand Down Expand Up @@ -418,18 +419,12 @@ static bool port_has_data(struct port *port)
unsigned long flags;
bool ret;

ret = false;
spin_lock_irqsave(&port->inbuf_lock, flags);
if (port->inbuf) {
ret = true;
goto out;
}
port->inbuf = get_inbuf(port);
if (port->inbuf) {
if (port->inbuf)
ret = true;
goto out;
}
ret = false;
out:

spin_unlock_irqrestore(&port->inbuf_lock, flags);
return ret;
}
Expand Down Expand Up @@ -1489,8 +1484,7 @@ static void in_intr(struct virtqueue *vq)
return;

spin_lock_irqsave(&port->inbuf_lock, flags);
if (!port->inbuf)
port->inbuf = get_inbuf(port);
port->inbuf = get_inbuf(port);

/*
* Don't queue up data when port is closed. This condition
Expand Down

0 comments on commit 3c57508

Please sign in to comment.