All of lore.kernel.org
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH v2 03/11] chardev: remove needless class method
Date: Wed,  4 Aug 2021 19:48:40 +0400	[thread overview]
Message-ID: <20210804154848.557328-4-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20210804154848.557328-1-marcandre.lureau@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

"chr_option_parsed" is only implemented by the "mux" chardev, we can
specialize the code there to avoid the needless generic class method.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/chardev/char.h | 1 -
 chardev/char-mux.c     | 6 ++----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/include/chardev/char.h b/include/chardev/char.h
index 7c0444f90d..589e7fe46d 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -273,7 +273,6 @@ struct ChardevClass {
     void (*chr_set_echo)(Chardev *chr, bool echo);
     void (*chr_set_fe_open)(Chardev *chr, int fe_open);
     void (*chr_be_event)(Chardev *s, QEMUChrEvent event);
-    void (*chr_options_parsed)(Chardev *chr);
 };
 
 Chardev *qemu_chardev_new(const char *id, const char *typename,
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index 5baf419010..ada0c6866f 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -386,10 +386,9 @@ void suspend_mux_open(void)
 static int chardev_options_parsed_cb(Object *child, void *opaque)
 {
     Chardev *chr = (Chardev *)child;
-    ChardevClass *class = CHARDEV_GET_CLASS(chr);
 
-    if (!chr->be_open && class->chr_options_parsed) {
-        class->chr_options_parsed(chr);
+    if (!chr->be_open && CHARDEV_IS_MUX(chr)) {
+        open_muxes(chr);
     }
 
     return 0;
@@ -412,7 +411,6 @@ static void char_mux_class_init(ObjectClass *oc, void *data)
     cc->chr_accept_input = mux_chr_accept_input;
     cc->chr_add_watch = mux_chr_add_watch;
     cc->chr_be_event = mux_chr_be_event;
-    cc->chr_options_parsed = open_muxes;
     cc->chr_update_read_handler = mux_chr_update_read_handlers;
 }
 
-- 
2.32.0.264.g75ae10bc75



  parent reply	other threads:[~2021-08-04 17:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 15:48 [PATCH v2 00/11] chardev related fixes marcandre.lureau
2021-08-04 15:48 ` [PATCH v2 01/11] util: fix abstract socket path copy marcandre.lureau
2021-08-04 15:48 ` [PATCH v2 02/11] chardev/socket: print a more correct command-line address marcandre.lureau
2021-08-05 10:29   ` Daniel P. Berrangé
2021-08-04 15:48 ` marcandre.lureau [this message]
2021-08-04 15:48 ` [PATCH v2 04/11] chardev: add some comments about the class methods marcandre.lureau
2021-08-04 15:48 ` [PATCH v2 05/11] chardev: mark explicitly first argument as poisoned marcandre.lureau
2021-08-05 10:36   ` Daniel P. Berrangé
2021-08-05 10:39     ` Marc-André Lureau
2021-08-05 10:43       ` Daniel P. Berrangé
2021-08-04 15:48 ` [PATCH v2 06/11] chardev: fix fd_chr_add_watch() when in != out marcandre.lureau
2021-08-05 10:38   ` Daniel P. Berrangé
2021-08-04 15:48 ` [PATCH v2 07/11] chardev: fix qemu_chr_open_fd() being called with fd=-1 marcandre.lureau
2021-08-05 10:39   ` Daniel P. Berrangé
2021-08-04 15:48 ` [PATCH v2 08/11] chardev: fix qemu_chr_open_fd() with fd_in==fd_out marcandre.lureau
2021-08-05 10:40   ` Daniel P. Berrangé
2021-08-04 15:48 ` [PATCH v2 09/11] chardev: give some context on chardev-add error marcandre.lureau
2021-08-04 15:48 ` [PATCH v2 10/11] chardev: report a simpler error about duplicated id marcandre.lureau
2021-08-05 10:41   ` Daniel P. Berrangé
2021-08-04 15:48 ` [PATCH v2 11/11] chardev: reuse qmp_chardev_new() marcandre.lureau
2021-08-05 10:42   ` Daniel P. Berrangé

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=20210804154848.557328-4-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=berrange@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.