aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-11-18 10:09:37 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2016-11-23 12:00:48 +1100
commit8a273cbe53221d28abfc98f33a0d057b26e53d6a (patch)
tree4cc83f7dbbfacf62b6bb95f98c950f636568071f
parent0d28aa197dd91d1bd3bc1bdc46b0eca306460040 (diff)
hw/char/spapr_vty: Return amount of free buffer entries in vty_can_receive()
The can_receive() callbacks of the character devices should return the amount of characters that can be accepted at once, not just a boolean value (which rather means only one character at a time). Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--hw/char/spapr_vty.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c
index 06b9b3917f..7c22b8bd0e 100644
--- a/hw/char/spapr_vty.c
+++ b/hw/char/spapr_vty.c
@@ -25,7 +25,7 @@ static int vty_can_receive(void *opaque)
{
VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(opaque);
- return (dev->in - dev->out) < VTERM_BUFSIZE;
+ return VTERM_BUFSIZE - (dev->in - dev->out);
}
static void vty_receive(void *opaque, const uint8_t *buf, int size)