summary refs log tree commit diff stats
path: root/hw/qdev-properties-system.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-03-27 20:29:39 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-04 19:21:25 -0500
commit44c473decd4de5559487430f876de53c607b1e9d (patch)
tree8b00d24b4297565dd29de621891b38e32f1706a3 /hw/qdev-properties-system.c
parent4dbb9ed3263e0f48282a2fc3d05099ba63e5b0e2 (diff)
downloadfocaccia-qemu-44c473decd4de5559487430f876de53c607b1e9d.tar.gz
focaccia-qemu-44c473decd4de5559487430f876de53c607b1e9d.zip
qemu-char: Add qemu_chr_fe_claim / _release helper functions
Add qemu_chr_fe_claim / _release helper functions for properly dealing with
avail_connections.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1364412581-3672-2-git-send-email-hdegoede@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev-properties-system.c')
-rw-r--r--hw/qdev-properties-system.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/qdev-properties-system.c b/hw/qdev-properties-system.c
index d9934b5b9c..a22b155b6f 100644
--- a/hw/qdev-properties-system.c
+++ b/hw/qdev-properties-system.c
@@ -123,11 +123,10 @@ static int parse_chr(DeviceState *dev, const char *str, void **ptr)
     if (chr == NULL) {
         return -ENOENT;
     }
-    if (chr->avail_connections < 1) {
+    if (qemu_chr_fe_claim(chr) != 0) {
         return -EEXIST;
     }
     *ptr = chr;
-    --chr->avail_connections;
     return 0;
 }
 
@@ -140,7 +139,7 @@ static void release_chr(Object *obj, const char *name, void *opaque)
 
     if (chr) {
         qemu_chr_add_handlers(chr, NULL, NULL, NULL, NULL);
-        ++chr->avail_connections;
+        qemu_chr_fe_release(chr);
     }
 }