aboutsummaryrefslogtreecommitdiff
path: root/chardev/spice.c
diff options
context:
space:
mode:
Diffstat (limited to 'chardev/spice.c')
-rw-r--r--chardev/spice.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/chardev/spice.c b/chardev/spice.c
index 051c23a84f..7d1fb17718 100644
--- a/chardev/spice.c
+++ b/chardev/spice.c
@@ -14,9 +14,6 @@ typedef struct SpiceCharSource {
SpiceChardev *scd;
} SpiceCharSource;
-static QLIST_HEAD(, SpiceChardev) spice_chars =
- QLIST_HEAD_INITIALIZER(spice_chars);
-
static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
{
SpiceChardev *scd = container_of(sin, SpiceChardev, sin);
@@ -216,8 +213,6 @@ static void char_spice_finalize(Object *obj)
vmc_unregister_interface(s);
- QLIST_SAFE_REMOVE(s, next);
-
g_free((char *)s->sin.subtype);
g_free((char *)s->sin.portname);
}
@@ -256,8 +251,6 @@ static void chr_open(Chardev *chr, const char *subtype)
s->active = false;
s->sin.subtype = g_strdup(subtype);
-
- QLIST_INSERT_HEAD(&spice_chars, s, next);
}
static void qemu_chr_open_spice_vmc(Chardev *chr,
@@ -310,28 +303,18 @@ static void qemu_chr_open_spice_port(Chardev *chr,
return;
}
+ if (!using_spice) {
+ error_setg(errp, "spice not enabled");
+ return;
+ }
+
chr_open(chr, "port");
*be_opened = false;
s = SPICE_CHARDEV(chr);
s->sin.portname = g_strdup(name);
- if (using_spice) {
- /* spice server already created */
- vmc_register_interface(s);
- }
-}
-
-void qemu_spice_register_ports(void)
-{
- SpiceChardev *s;
-
- QLIST_FOREACH(s, &spice_chars, next) {
- if (s->sin.portname == NULL) {
- continue;
- }
- vmc_register_interface(s);
- }
+ vmc_register_interface(s);
}
static void qemu_chr_parse_spice_vmc(QemuOpts *opts, ChardevBackend *backend,