From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9NdH-0005VS-L3 for qemu-devel@nongnu.org; Tue, 22 Nov 2016 21:50:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9NdE-0001tY-GG for qemu-devel@nongnu.org; Tue, 22 Nov 2016 21:49:59 -0500 From: David Gibson Date: Wed, 23 Nov 2016 13:49:36 +1100 Message-Id: <1479869383-16162-5-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1479869383-16162-1-git-send-email-david@gibson.dropbear.id.au> References: <1479869383-16162-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PULL 04/11] 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: peter.maydell@linaro.org, stefanha@redhat.com Cc: agraf@suse.de, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Thomas Huth , David Gibson From: Thomas Huth 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 Signed-off-by: David Gibson --- 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) -- 2.7.4