From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXX6r-000727-E7 for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXX6i-0002ys-58 for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:07:01 -0400 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:55438) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXX6h-0002yJ-Rm for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:06:52 -0400 Received: by mail-we0-f174.google.com with SMTP id w62so9316498wes.33 for ; Fri, 26 Sep 2014 08:06:46 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <54258103.9090406@redhat.com> Date: Fri, 26 Sep 2014 17:06:43 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1409344310-5441-1-git-send-email-ehabkost@redhat.com> <1409344310-5441-11-git-send-email-ehabkost@redhat.com> In-Reply-To: <1409344310-5441-11-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 10/17] accel: Move qtest accel registration to qtest.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Michael Mueller , "Michael S. Tsirkin" , Marcel Apfelbaum , Alexander Graf , Christian Borntraeger , "Jason J. Herne" , =?windows-1252?Q?Andreas_?= =?windows-1252?Q?F=E4rber?= Il 29/08/2014 22:31, Eduardo Habkost ha scritto: > As qtest_availble() returns 1 only when CONFIG_POSIX is set, keep > setting AccelClass.available to keep current behavior (this is different > from what we did for KVM and Xen). Hmm... as extra patches, could we only register the type on CONFIG_POSIX and thus get rid of available completely? Paolo > This also allows us to make qtest_init_accel() static. > > Signed-off-by: Eduardo Habkost > --- > hw/core/accel.c | 18 ------------------ > include/sysemu/qtest.h | 1 - > qtest.c | 27 ++++++++++++++++++++++++++- > 3 files changed, 26 insertions(+), 20 deletions(-) > > diff --git a/hw/core/accel.c b/hw/core/accel.c > index ecd1efa..5853551 100644 > --- a/hw/core/accel.c > +++ b/hw/core/accel.c > @@ -132,28 +132,10 @@ static const TypeInfo tcg_accel_type = { > .class_init = tcg_accel_class_init, > }; > > -static void qtest_accel_class_init(ObjectClass *oc, void *data) > -{ > - AccelClass *ac = ACCEL_CLASS(oc); > - ac->name = "QTest"; > - ac->available = qtest_available; > - ac->init = qtest_init_accel; > - ac->allowed = &qtest_allowed; > -} > - > -#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest") > - > -static const TypeInfo qtest_accel_type = { > - .name = TYPE_QTEST_ACCEL, > - .parent = TYPE_ACCEL, > - .class_init = qtest_accel_class_init, > -}; > - > static void register_accel_types(void) > { > type_register_static(&accel_type); > type_register_static(&tcg_accel_type); > - type_register_static(&qtest_accel_type); > } > > type_init(register_accel_types); > diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h > index 95c9ade..05473b7 100644 > --- a/include/sysemu/qtest.h > +++ b/include/sysemu/qtest.h > @@ -26,7 +26,6 @@ static inline bool qtest_enabled(void) > > bool qtest_driver(void); > > -int qtest_init_accel(MachineClass *mc); > void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp); > > static inline int qtest_available(void) > diff --git a/qtest.c b/qtest.c > index ef0d991..829128e 100644 > --- a/qtest.c > +++ b/qtest.c > @@ -17,6 +17,7 @@ > #include "exec/ioport.h" > #include "exec/memory.h" > #include "hw/irq.h" > +#include "hw/accel.h" > #include "sysemu/sysemu.h" > #include "sysemu/cpus.h" > #include "qemu/config-file.h" > @@ -519,7 +520,7 @@ static void configure_qtest_icount(const char *options) > qemu_opts_del(opts); > } > > -int qtest_init_accel(MachineClass *mc) > +static int qtest_init_accel(MachineClass *mc) > { > configure_qtest_icount("0"); > return 0; > @@ -557,3 +558,27 @@ bool qtest_driver(void) > { > return qtest_chr; > } > + > +static void qtest_accel_class_init(ObjectClass *oc, void *data) > +{ > + AccelClass *ac = ACCEL_CLASS(oc); > + ac->name = "QTest"; > + ac->available = qtest_available; > + ac->init = qtest_init_accel; > + ac->allowed = &qtest_allowed; > +} > + > +#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest") > + > +static const TypeInfo qtest_accel_type = { > + .name = TYPE_QTEST_ACCEL, > + .parent = TYPE_ACCEL, > + .class_init = qtest_accel_class_init, > +}; > + > +static void qtest_type_init(void) > +{ > + type_register_static(&qtest_accel_type); > +} > + > +type_init(qtest_type_init); >