]> git.proxmox.com Git - mirror_qemu.git/commitdiff
accel: Move qtest accel registration to qtest.c
authorEduardo Habkost <ehabkost@redhat.com>
Fri, 26 Sep 2014 20:45:26 +0000 (17:45 -0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 4 Oct 2014 06:59:15 +0000 (08:59 +0200)
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.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel.c
include/sysemu/qtest.h
qtest.c

diff --git a/accel.c b/accel.c
index 2cefbb0aa7a511a7dba85db399b83299a997f77e..2cf47337af449536a13b2ec51b89c3b6191ff293 100644 (file)
--- a/accel.c
+++ b/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);
index 95c9ade7784259097e84be16e651af5ebfdaa5c6..05473b75a54507db16fa070cd39d5907026e38d2 100644 (file)
@@ -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 ef0d99191c58589107b9cd06f160be635768cc16..0af8b747520360f9df130ee62228e577f6b05f7c 100644 (file)
--- a/qtest.c
+++ b/qtest.c
@@ -17,6 +17,7 @@
 #include "exec/ioport.h"
 #include "exec/memory.h"
 #include "hw/irq.h"
+#include "sysemu/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);