Received: from eggs.gnu.org ([2001:4830:134:3::10]:55304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7fB3-0003eh-IP for qemu-devel@nongnu.org; Fri, 18 Nov 2016 04:09:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7fAy-0007uT-KL for qemu-devel@nongnu.org; Fri, 18 Nov 2016 04:09:45 -0500 From: Thomas Huth Date: Fri, 18 Nov 2016 10:09:37 +0100 Message-Id: <1479460177-9362-1-git-send-email-thuth@redhat.com> Subject: [Qemu-devel] [PATCH] hw/char/spapr_vty: Return amount of free buffer entries in vty_can_receive() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , qemu-ppc@nongnu.org Cc: qemu-devel@nongnu.org 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 --- hw/char/spapr_vty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index 06b9b39..7c22b8b 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) -- 1.8.3.1