qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Thomas Huth" <huth@tuxfamily.org>,
	"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
	"Alexandre Ratchov" <alex@caoua.org>,
	dirty.ice.hu@gmail.com,
	"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Volker Rümelin" <vr_qemu@t-online.de>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [RFC 09/24] audio: remove set_dbus_server from audio_driver
Date: Mon,  1 Dec 2025 15:22:50 +0400	[thread overview]
Message-ID: <20251201112309.4163921-10-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20251201112309.4163921-1-marcandre.lureau@redhat.com>

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

Use the QOM class vtable only instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 audio/audio_int.h |  6 ------
 audio/audio.c     | 28 +++-------------------------
 audio/dbusaudio.c | 34 ++++++++++++++++++----------------
 3 files changed, 21 insertions(+), 47 deletions(-)

diff --git a/audio/audio_int.h b/audio/audio_int.h
index 44e63318e8..e289ef5f66 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -147,12 +147,6 @@ struct audio_driver {
     const char *name;
     void *(*init) (Audiodev *, Error **);
     void (*fini) (void *);
-#ifdef CONFIG_GIO
-    bool (*set_dbus_server)(AudioBackend *be,
-                            GDBusObjectManagerServer *manager,
-                            bool p2p,
-                            Error **errp);
-#endif
     struct audio_pcm_ops *pcm_ops;
     int max_voices_out;
     int max_voices_in;
diff --git a/audio/audio.c b/audio/audio.c
index fab6024207..1693563c62 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1641,31 +1641,11 @@ static const char *audio_driver_get_id(AudioBackend *be)
     return AUDIO_DRIVER(be)->dev->id;
 }
 
-#ifdef CONFIG_GIO
-static bool audio_driver_set_dbus_server(AudioBackend *be,
-                                            GDBusObjectManagerServer *manager,
-                                            bool p2p,
-                                            Error **errp)
-{
-    AudioDriver *d = AUDIO_DRIVER(be);
-
-    if (!d->drv->set_dbus_server) {
-        return false;
-    }
-
-    return d->drv->set_dbus_server(be, manager, p2p, errp);
-}
-
-#endif
-
 static void audio_driver_class_init(ObjectClass *klass, const void *data)
 {
     AudioBackendClass *be = AUDIO_BACKEND_CLASS(klass);
 
     be->get_id = audio_driver_get_id;
-#ifdef CONFIG_GIO
-    be->set_dbus_server = audio_driver_set_dbus_server;
-#endif
 }
 
 static void audio_driver_init(Object *obj)
@@ -2264,11 +2244,9 @@ AudioBackend *audio_be_by_name(const char *name, Error **errp)
 #ifdef CONFIG_GIO
 bool audio_be_can_set_dbus_server(AudioBackend *be)
 {
-    /*
-     * AudioBackendClass *klass = AUDIO_BACKEND_GET_CLASS(be);
-     * return klass->set_dbus_server != NULL;
-     */
-     return AUDIO_DRIVER(be)->drv->set_dbus_server != NULL;
+    AudioBackendClass *klass = AUDIO_BACKEND_GET_CLASS(be);
+
+    return klass->set_dbus_server != NULL;
 }
 
 bool audio_be_set_dbus_server(AudioBackend *be,
diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c
index f0b17be6e8..edd551a80f 100644
--- a/audio/dbusaudio.c
+++ b/audio/dbusaudio.c
@@ -54,21 +54,6 @@ struct AudioDbus {
 
 static struct audio_driver dbus_audio_driver;
 
-static void audio_dbus_class_init(ObjectClass *klass, const void *data)
-{
-    AudioDriverClass *k = AUDIO_DRIVER_CLASS(klass);
-
-    k->driver = &dbus_audio_driver;
-}
-
-static void audio_dbus_init(Object *obj)
-{
-}
-
-static void audio_dbus_finalize(Object *obj)
-{
-}
-
 typedef struct DBusAudio {
     Audiodev *dev;
     GDBusObjectManagerServer *server;
@@ -728,7 +713,6 @@ static struct audio_driver dbus_audio_driver = {
     .name            = "dbus",
     .init            = dbus_audio_init,
     .fini            = dbus_audio_fini,
-    .set_dbus_server = dbus_audio_set_server,
     .pcm_ops         = &dbus_pcm_ops,
     .max_voices_out  = INT_MAX,
     .max_voices_in   = INT_MAX,
@@ -736,6 +720,24 @@ static struct audio_driver dbus_audio_driver = {
     .voice_size_in   = sizeof(DBusVoiceIn)
 };
 
+static void audio_dbus_class_init(ObjectClass *klass, const void *data)
+{
+    AudioBackendClass *b = AUDIO_BACKEND_CLASS(klass);
+    AudioDriverClass *k = AUDIO_DRIVER_CLASS(klass);
+
+    b->set_dbus_server = dbus_audio_set_server;
+    k->driver = &dbus_audio_driver;
+}
+
+static void audio_dbus_init(Object *obj)
+{
+}
+
+static void audio_dbus_finalize(Object *obj)
+{
+}
+
+
 static const TypeInfo audio_dbus_info = {
     .name = TYPE_AUDIO_DBUS,
     .parent = TYPE_AUDIO_DRIVER,
-- 
2.51.1



  parent reply	other threads:[~2025-12-01 11:24 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 11:22 [RFC 00/24] audio: add GStreamer backend marcandre.lureau
2025-12-01 11:22 ` [RFC 01/24] rust: patch thiserror to work with meson marcandre.lureau
2025-12-01 11:22 ` [RFC 02/24] audio: remove obsolete/obscure functions marcandre.lureau
2025-12-10 14:02   ` Akihiko Odaki
2025-12-01 11:22 ` [RFC 03/24] audio/dbus: make "dbus" the default backend when using -display dbus marcandre.lureau
2025-12-10 14:03   ` Akihiko Odaki
2025-12-01 11:22 ` [RFC 04/24] qemu-options.hx: clarify default audio backend selection marcandre.lureau
2025-12-01 11:22 ` [RFC 05/24] audio: introduce AudioDriver marcandre.lureau
2025-12-11  5:22   ` Akihiko Odaki
2025-12-01 11:22 ` [RFC 06/24] audio: simplify audio_init() marcandre.lureau
2025-12-01 11:22 ` [RFC 07/24] audio: move object creation to audio_driver_init() marcandre.lureau
2025-12-01 11:22 ` [RFC 08/24] audio: add QOM module-objects for each backend marcandre.lureau
2025-12-01 13:20   ` BALATON Zoltan
2025-12-01 18:43     ` Marc-André Lureau
2025-12-01 11:22 ` marcandre.lureau [this message]
2025-12-01 11:22 ` [RFC 10/24] audio: lookup "audio-" object types, and realize them marcandre.lureau
2025-12-01 11:22 ` [RFC 11/24] audio: switch to module-object, drop audio driver registration marcandre.lureau
2025-12-01 11:22 ` [RFC 12/24] module: remove audio module support marcandre.lureau
2025-12-01 11:22 ` [RFC 13/24] audio: keep a strong reference on the backend marcandre.lureau
2025-12-01 11:22 ` [RFC 14/24] audio: make list type declaration private marcandre.lureau
2025-12-01 11:22 ` [RFC 15/24] audio: make create_pdos() private marcandre.lureau
2025-12-01 11:22 ` [RFC 16/24] replay: remove dependency on audio/ marcandre.lureau
2025-12-01 11:22 ` [RFC 17/24] audio: make all the backend-specific APIs take the be marcandre.lureau
2025-12-01 11:22 ` [RFC 18/24] audio: make AudioBackend truely abstract marcandre.lureau
2025-12-01 11:23 ` [RFC 19/24] audio: split AudioBackend marcandre.lureau
2025-12-01 11:23 ` [RFC 20/24] audio: AUD_ -> audio_be_ marcandre.lureau
2025-12-01 11:23 ` [RFC 21/24] audio-be: add common pre-conditions marcandre.lureau
2025-12-01 11:23 ` [RFC 22/24] audio-be: add some state trace marcandre.lureau
2025-12-01 11:23 ` [RFC 23/24] audio: split AudioDriver code in audio-driver.c marcandre.lureau
2025-12-01 11:23 ` [RFC 24/24] WIP: rust/audio: add GStreamer backend marcandre.lureau
2025-12-01 13:12   ` Markus Armbruster
2025-12-01 18:26     ` Marc-André Lureau
2025-12-01 13:02 ` [RFC 00/24] audio: " BALATON Zoltan
2025-12-01 13:41   ` Christian Schoenebeck
2025-12-01 18:20   ` Marc-André Lureau
2025-12-01 19:30     ` BALATON Zoltan
2025-12-01 19:44       ` Daniel P. Berrangé
2025-12-02 12:01         ` BALATON Zoltan
2025-12-01 20:58     ` Alexandre Ratchov
2025-12-02  7:55       ` Paolo Bonzini
2025-12-02 12:03         ` BALATON Zoltan
2025-12-02 12:25           ` Geoffrey McRae
2025-12-02 12:44             ` Marc-André Lureau
2025-12-02 13:25               ` Geoffrey McRae
2025-12-02 14:14                 ` Marc-André Lureau
2025-12-02 14:33                   ` Neal Gompa
2025-12-02 14:43                   ` Geoffrey McRae
2025-12-02 14:52                   ` Markus Armbruster
2025-12-03  9:19                     ` Akihiko Odaki
2025-12-02 15:39                   ` Christian Schoenebeck
2025-12-03  8:06                   ` Alexandre Ratchov

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=20251201112309.4163921-10-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=alex@caoua.org \
    --cc=dirty.ice.hu@gmail.com \
    --cc=huth@tuxfamily.org \
    --cc=kraxel@redhat.com \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=vr_qemu@t-online.de \
    /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).