From patchwork Mon Oct 12 08:03:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 528939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1E47A1402A8 for ; Mon, 12 Oct 2015 19:08:04 +1100 (AEDT) Received: from localhost ([::1]:53397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlY9J-00017h-UZ for incoming@patchwork.ozlabs.org; Mon, 12 Oct 2015 04:08:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlY5K-0003ls-61 for qemu-devel@nongnu.org; Mon, 12 Oct 2015 04:03:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlY5J-0006tl-3A for qemu-devel@nongnu.org; Mon, 12 Oct 2015 04:03:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36406) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlY5I-0006tg-Tr for qemu-devel@nongnu.org; Mon, 12 Oct 2015 04:03:53 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 893898EA3B for ; Mon, 12 Oct 2015 08:03:52 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-57.ams2.redhat.com [10.36.112.57]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9C83Po1032568; Mon, 12 Oct 2015 04:03:51 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 12 Oct 2015 10:03:18 +0200 Message-Id: <1444637004-20195-16-git-send-email-pbonzini@redhat.com> In-Reply-To: <1444637004-20195-1-git-send-email-pbonzini@redhat.com> References: <1444637004-20195-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: armbru@redhat.com Subject: [Qemu-devel] [PATCH 15/21] qemu-char: convert testdev backend to data-driven creation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake --- backends/testdev.c | 7 +++++-- include/sysemu/char.h | 3 --- qemu-char.c | 2 +- stubs/Makefile.objs | 1 - stubs/chr-testdev.c | 7 ------- 5 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 stubs/chr-testdev.c diff --git a/backends/testdev.c b/backends/testdev.c index 43787f6..26d5c73 100644 --- a/backends/testdev.c +++ b/backends/testdev.c @@ -108,7 +108,10 @@ static void testdev_close(struct CharDriverState *chr) g_free(testdev); } -CharDriverState *chr_testdev_init(void) +static CharDriverState *chr_testdev_init(const char *id, + ChardevBackend *backend, + ChardevReturn *ret, + Error **errp) { TestdevCharState *testdev; CharDriverState *chr; @@ -126,7 +129,7 @@ CharDriverState *chr_testdev_init(void) static void register_types(void) { register_char_driver("testdev", CHARDEV_BACKEND_KIND_TESTDEV, NULL, - NULL); + chr_testdev_init); } type_init(register_types); diff --git a/include/sysemu/char.h b/include/sysemu/char.h index 77415ec..5c28c16 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -356,9 +356,6 @@ extern int term_escape_char; CharDriverState *qemu_char_get_next_serial(void); -/* testdev.c */ -CharDriverState *chr_testdev_init(void); - /* console.c */ typedef CharDriverState *(VcHandler)(ChardevVC *vc); diff --git a/qemu-char.c b/qemu-char.c index 96f40f3..72658d2 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -4327,7 +4327,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend, abort(); break; case CHARDEV_BACKEND_KIND_TESTDEV: - chr = chr_testdev_init(); + abort(); break; case CHARDEV_BACKEND_KIND_STDIO: chr = qemu_chr_open_stdio(backend->stdio); diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 8cfa5a2..b5322a2 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -1,6 +1,5 @@ stub-obj-y += arch-query-cpu-def.o stub-obj-y += bdrv-commit-all.o -stub-obj-y += chr-testdev.o stub-obj-y += clock-warp.o stub-obj-y += cpu-get-clock.o stub-obj-y += cpu-get-icount.o diff --git a/stubs/chr-testdev.c b/stubs/chr-testdev.c deleted file mode 100644 index 23112a2..0000000 --- a/stubs/chr-testdev.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "qemu-common.h" -#include "sysemu/char.h" - -CharDriverState *chr_testdev_init(void) -{ - return 0; -}