diff mbox

[22/54] char-pty: convert to finalize

Message ID 20161212224325.20790-23-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Dec. 12, 2016, 10:42 p.m. UTC
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qemu-char.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/qemu-char.c b/qemu-char.c
index ea8b12fa4f..21eb2d9135 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1654,9 +1654,10 @@  static void pty_chr_state(Chardev *chr, int connected)
     }
 }
 
-static void pty_chr_free(struct Chardev *chr)
+static void char_pty_finalize(Object *obj)
 {
-    PtyChardev *s = PTY_CHARDEV(chr);
+    Chardev *chr = CHARDEV(obj);
+    PtyChardev *s = PTY_CHARDEV(obj);
 
     qemu_mutex_lock(&chr->chr_write_lock);
     pty_chr_state(chr, 0);
@@ -1713,13 +1714,13 @@  static void char_pty_class_init(ObjectClass *oc, void *data)
     cc->chr_write = char_pty_chr_write;
     cc->chr_update_read_handler = pty_chr_update_read_handler;
     cc->chr_add_watch = pty_chr_add_watch;
-    cc->chr_free = pty_chr_free;
 }
 
 static const TypeInfo char_pty_type_info = {
     .name = TYPE_CHARDEV_PTY,
     .parent = TYPE_CHARDEV,
     .instance_size = sizeof(PtyChardev),
+    .instance_finalize = char_pty_finalize,
     .class_init = char_pty_class_init,
 };