qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PATCH v2 1/6] char: update the mux handlers in class callback
Date: Wed,  6 Feb 2019 18:43:23 +0100	[thread overview]
Message-ID: <20190206174328.9736-2-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20190206174328.9736-1-marcandre.lureau@redhat.com>

Instead of handling mux chardev in a special way in
qemu_chr_fe_set_handlers(), we may use the chr_update_read_handler
class callback instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/chardev/char-mux.h | 1 -
 chardev/char-fe.c          | 4 ----
 chardev/char-mux.c         | 5 +++--
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/chardev/char-mux.h b/include/chardev/char-mux.h
index 1e13187767..572cefd517 100644
--- a/include/chardev/char-mux.h
+++ b/include/chardev/char-mux.h
@@ -55,7 +55,6 @@ typedef struct MuxChardev {
 #define CHARDEV_IS_MUX(chr)                             \
     object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)
 
-void mux_chr_set_handlers(Chardev *chr, GMainContext *context);
 void mux_set_focus(Chardev *chr, int focus);
 void mux_chr_send_all_event(Chardev *chr, int event);
 
diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index a8931f7afd..f69ca18647 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -289,10 +289,6 @@ void qemu_chr_fe_set_handlers(CharBackend *b,
             qemu_chr_be_event(s, CHR_EVENT_OPENED);
         }
     }
-
-    if (CHARDEV_IS_MUX(s)) {
-        mux_chr_set_handlers(s, context);
-    }
 }
 
 void qemu_chr_fe_take_focus(CharBackend *b)
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index 6055e76293..9406eaf08d 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -278,7 +278,7 @@ static void char_mux_finalize(Object *obj)
     qemu_chr_fe_deinit(&d->chr, false);
 }
 
-void mux_chr_set_handlers(Chardev *chr, GMainContext *context)
+static void mux_chr_update_read_handlers(Chardev *chr)
 {
     MuxChardev *d = MUX_CHARDEV(chr);
 
@@ -289,7 +289,7 @@ void mux_chr_set_handlers(Chardev *chr, GMainContext *context)
                              mux_chr_event,
                              NULL,
                              chr,
-                             context, true);
+                             chr->gcontext, true);
 }
 
 void mux_set_focus(Chardev *chr, int focus)
@@ -383,6 +383,7 @@ static void char_mux_class_init(ObjectClass *oc, void *data)
     cc->chr_add_watch = mux_chr_add_watch;
     cc->chr_be_event = mux_chr_be_event;
     cc->chr_machine_done = open_muxes;
+    cc->chr_update_read_handler = mux_chr_update_read_handlers;
 }
 
 static const TypeInfo char_mux_type_info = {
-- 
2.20.1.519.g8feddda32c

  reply	other threads:[~2019-02-06 17:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 17:43 [Qemu-devel] [PATCH v2 0/6] chardev: various cleanups and improvements (resend) Marc-André Lureau
2019-02-06 17:43 ` Marc-André Lureau [this message]
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 2/6] char-fe: set_handlers() needs an associated chardev Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 3/6] terminal3270: do not use backend timer sources Marc-André Lureau
2019-02-07 17:14   ` Cornelia Huck
2019-02-11  7:12     ` Peter Xu
2019-02-11  9:57       ` Marc-André Lureau
2019-02-11 10:27         ` Peter Xu
2019-02-11 10:35           ` Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 4/6] chardev: add a note about frontend sources and context switch Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 5/6] char-pty: remove the check for connection on write Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 6/6] char-pty: remove write_lock usage Marc-André Lureau
2019-02-13 14:35 ` [Qemu-devel] [PATCH v2 0/6] chardev: various cleanups and improvements (resend) Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190206174328.9736-2-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).