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).
This also allows us to make qtest_init_accel() static. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- 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 34995fd..95fbf1e 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 "qtest-accel" - -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 04a6dc1..f7c0432 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" @@ -509,7 +510,7 @@ static void qtest_event(void *opaque, int event) } } -int qtest_init_accel(MachineClass *mc) +static int qtest_init_accel(MachineClass *mc) { configure_icount("0"); @@ -548,3 +549,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 "qtest-accel" + +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); -- 1.9.3