qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 3/3] hw/audio: Remove unused audio_register_model_with_cb()
Date: Tue, 21 Oct 2025 15:18:24 +0200	[thread overview]
Message-ID: <20251021131825.99390-4-philmd@linaro.org> (raw)
In-Reply-To: <20251021131825.99390-1-philmd@linaro.org>

We remove the last use of audio_register_model_with_cb(),
remove it as not needed anymore, simplifying audio_model_init().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/audio/model.h |  2 --
 hw/audio/model.c         | 26 +++++++-------------------
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/include/hw/audio/model.h b/include/hw/audio/model.h
index ebe456c22ff..b812c9211a0 100644
--- a/include/hw/audio/model.h
+++ b/include/hw/audio/model.h
@@ -1,8 +1,6 @@
 #ifndef HW_AUDIO_MODEL_H
 #define HW_AUDIO_MODEL_H
 
-void audio_register_model_with_cb(const char *name, const char *descr,
-                                  int (*init_audio_model)(const char *audiodev));
 void audio_register_model(const char *name, const char *descr,
                           const char *typename);
 
diff --git a/hw/audio/model.c b/hw/audio/model.c
index 924a41e0ac9..d1e00b4eaa4 100644
--- a/hw/audio/model.c
+++ b/hw/audio/model.c
@@ -34,22 +34,11 @@ struct audio_model {
     const char *name;
     const char *descr;
     const char *typename;
-    int (*init)(const char *audiodev);
 };
 
 static struct audio_model audio_models[9];
 static int audio_models_count;
 
-void audio_register_model_with_cb(const char *name, const char *descr,
-                                  int (*init_audio_model)(const char *audiodev))
-{
-    assert(audio_models_count < ARRAY_SIZE(audio_models) - 1);
-    audio_models[audio_models_count].name = name;
-    audio_models[audio_models_count].descr = descr;
-    audio_models[audio_models_count].init = init_audio_model;
-    audio_models_count++;
-}
-
 void audio_register_model(const char *name, const char *descr,
                           const char *typename)
 {
@@ -105,17 +94,16 @@ void audio_set_model(const char *name, const char *audiodev)
 void audio_model_init(void)
 {
     struct audio_model *c = selected;
+    DeviceState *dev;
+    BusState *bus;
 
     if (!c) {
         return;
     }
 
-    if (c->typename) {
-        DeviceState *dev = qdev_new(c->typename);
-        BusState *bus = qdev_find_default_bus(DEVICE_GET_CLASS(dev), &error_fatal);
-        qdev_prop_set_string(dev, "audiodev", audiodev_id);
-        qdev_realize_and_unref(dev, bus, &error_fatal);
-    } else {
-        c->init(audiodev_id);
-    }
+    g_assert(c->typename);
+    dev = qdev_new(c->typename);
+    bus = qdev_find_default_bus(DEVICE_GET_CLASS(dev), &error_fatal);
+    qdev_prop_set_string(dev, "audiodev", audiodev_id);
+    qdev_realize_and_unref(dev, bus, &error_fatal);
 }
-- 
2.51.0



      parent reply	other threads:[~2025-10-21 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 13:18 [PATCH 0/3] hw/audio: Remove legacy code related to '-soundhw hda' Philippe Mathieu-Daudé
2025-10-21 13:18 ` [PATCH 1/3] docs: Update mentions of removed '-soundhw' command line option Philippe Mathieu-Daudé
2025-10-21 13:26   ` Marc-André Lureau
2025-10-21 13:18 ` [PATCH 2/3] hw/audio: Remove intel_hda_and_codec_init() Philippe Mathieu-Daudé
2025-10-21 13:24   ` Marc-André Lureau
2025-10-21 14:17     ` Philippe Mathieu-Daudé
2025-10-21 13:18 ` Philippe Mathieu-Daudé [this message]

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=20251021131825.99390-4-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=berrange@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=kraxel@redhat.com \
    --cc=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).