summary refs log tree commit diff stats
path: root/chardev/char.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-12-14 14:40:45 +0300
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-05-04 15:34:41 +0400
commitbed3bb9b7e5ee28ebec50c30604cdfd522d6f6e6 (patch)
tree6eacf8d68d87bcecae55a8bb87a7f796b15e12a6 /chardev/char.c
parent636181352788f7ba570e9055ec9352ba2badb751 (diff)
downloadfocaccia-qemu-bed3bb9b7e5ee28ebec50c30604cdfd522d6f6e6.tar.gz
focaccia-qemu-bed3bb9b7e5ee28ebec50c30604cdfd522d6f6e6.zip
mux: simplfy muxes_realize_done
mux_chr_event() already send events to all backends, rename it,
export it, and use it from muxes_realize_done. This should help abstract
away mux implementation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'chardev/char.c')
-rw-r--r--chardev/char.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/chardev/char.c b/chardev/char.c
index aad639b620..674c097fbe 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -451,22 +451,17 @@ static void muxes_realize_done(Notifier *notifier, void *unused)
 {
     Chardev *chr;
 
+    muxes_realized = true;
     QTAILQ_FOREACH(chr, &chardevs, next) {
         if (CHARDEV_IS_MUX(chr)) {
-            MuxChardev *d = MUX_CHARDEV(chr);
-            int i;
-
             /* send OPENED to all already-attached FEs */
-            for (i = 0; i < d->mux_cnt; i++) {
-                mux_chr_send_event(d, i, CHR_EVENT_OPENED);
-            }
+            mux_chr_send_all_event(CHARDEV(chr), CHR_EVENT_OPENED);
             /* mark mux as OPENED so any new FEs will immediately receive
              * OPENED event
              */
             qemu_chr_be_event(chr, CHR_EVENT_OPENED);
         }
     }
-    muxes_realized = true;
 }
 
 static Notifier muxes_realize_notify = {