From bed3bb9b7e5ee28ebec50c30604cdfd522d6f6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 14 Dec 2016 14:40:45 +0300 Subject: mux: simplfy muxes_realize_done MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé --- chardev/char.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'chardev/char.c') diff --git a/chardev/char.c b/chardev/char.c index aad639b..674c097 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 = { -- cgit v1.1