Received: from eggs.gnu.org ([208.118.235.92]:53980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHvo1-0006sG-3z for qemu-devel@nongnu.org; Tue, 19 Mar 2013 08:38:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHvnz-0007QD-Mr for qemu-devel@nongnu.org; Tue, 19 Mar 2013 08:38:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHvnz-0007Pr-G5 for qemu-devel@nongnu.org; Tue, 19 Mar 2013 08:38:15 -0400 From: Kevin Wolf Date: Tue, 19 Mar 2013 13:38:09 +0100 Message-Id: <1363696689-26849-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] char: Fix return type of qemu_chr_fe_add_watch() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, amit.shah@redhat.com, aliguori@us.ibm.com qemu_chr_fe_add_watch() can return negative errors, therefore it must not have an unsigned return type. For consistency with other qemu_chr_fe_* functions, this uses a standard C int instead of glib types. In situations where qemu_chr_fe_add_watch() is falsely assumed to have succeeded, the serial ports would go into a state where it never becomes ready for transmitting more data; this is fixed by this patch. Signed-off-by: Kevin Wolf --- include/char/char.h | 4 ++-- qemu-char.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/char/char.h b/include/char/char.h index d6a0351..0326b2a 100644 --- a/include/char/char.h +++ b/include/char/char.h @@ -153,8 +153,8 @@ void qemu_chr_fe_close(struct CharDriverState *chr); void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -guint qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, - GIOFunc func, void *user_data); +int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, + GIOFunc func, void *user_data); /** * @qemu_chr_fe_write: diff --git a/qemu-char.c b/qemu-char.c index e633797..4e011df 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3397,8 +3397,8 @@ void qemu_chr_fe_close(struct CharDriverState *chr) } } -guint qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, - GIOFunc func, void *user_data) +int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, + GIOFunc func, void *user_data) { GSource *src; guint tag; -- 1.8.1.4