On 27/10/25 16:10, [email protected] wrote:
From: Marc-André Lureau <[email protected]>

There is no clear need for this extra intermediary structure between
the audio backend and its user.

Signed-off-by: Marc-André Lureau <[email protected]>
Suggested-by: Paolo Bonzini <[email protected]>
---
  audio/audio.h                       | 18 ++++++------------
  audio/audio_int.h                   |  3 ---
  audio/audio_template.h              | 22 ++++++++++------------
  hw/audio/lm4549.h                   |  2 +-
  include/hw/audio/asc.h              |  2 +-
  include/hw/audio/virtio-snd.h       |  2 +-
  include/hw/display/xlnx_dp.h        |  2 +-
  include/hw/isa/vt82c686.h           |  2 +-
  include/hw/qdev-properties-system.h |  2 +-
  audio/audio.c                       | 29 ++++++++++-------------------
  hw/audio/ac97.c                     | 25 ++++++++++++-------------
  hw/audio/adlib.c                    |  9 ++++-----
  hw/audio/asc.c                      |  9 +++------
  hw/audio/cs4231a.c                  |  8 ++++----
  hw/audio/es1370.c                   | 23 +++++++++++------------
  hw/audio/gus.c                      |  9 ++++-----
  hw/audio/hda-codec.c                | 15 +++++++--------
  hw/audio/lm4549.c                   |  8 ++++----
  hw/audio/pcspk.c                    |  9 +++++----
  hw/audio/pl041.c                    |  2 +-
  hw/audio/sb16.c                     | 16 ++++++++--------
  hw/audio/via-ac97.c                 |  9 ++++-----
  hw/audio/virtio-snd.c               | 13 ++++++-------
  hw/audio/wm8750.c                   | 23 +++++++++++------------
  hw/core/qdev-properties-system.c    | 11 +++++------
  hw/display/xlnx_dp.c                |  6 +++---
  hw/usb/dev-audio.c                  | 11 +++++------
  27 files changed, 129 insertions(+), 161 deletions(-)

diff --git a/audio/audio.h b/audio/audio.h
index 1d56f111ea..fdbc33ae0c 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -69,18 +69,12 @@ struct AudioBackendClass {
  };
typedef struct AudioBackend AudioBackend;
-typedef struct QEMUSoundCard {
-    char *name;
-    AudioBackend *be;
-    QLIST_ENTRY (QEMUSoundCard) entries;
-} QEMUSoundCard;
typedef struct QEMUAudioTimeStamp {
      uint64_t old_ts;
  } QEMUAudioTimeStamp;
-bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp);
-void AUD_remove_card (QEMUSoundCard *card);
+bool AUD_backend_check (AudioBackend **be, Error **errp);
  CaptureVoiceOut *AUD_add_capture(
      AudioBackend *s,
      struct audsettings *as,
@@ -90,7 +84,7 @@ CaptureVoiceOut *AUD_add_capture(
  void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque);
SWVoiceOut *AUD_open_out (
-    QEMUSoundCard *card,
+    AudioBackend *be,
      SWVoiceOut *sw,
      const char *name,
      void *callback_opaque,
@@ -98,7 +92,7 @@ SWVoiceOut *AUD_open_out (
      struct audsettings *settings
      );
-void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw);
+void AUD_close_out (AudioBackend *be, SWVoiceOut *sw);
  size_t AUD_write (SWVoiceOut *sw, void *pcm_buf, size_t size);
  int  AUD_get_buffer_size_out (SWVoiceOut *sw);
  void AUD_set_active_out (SWVoiceOut *sw, int on);
@@ -132,7 +126,7 @@ AUD_set_volume_in_lr(SWVoiceIn *sw, bool mut, uint8_t lvol, 
uint8_t rvol) {
  }
SWVoiceIn *AUD_open_in (
-    QEMUSoundCard *card,
+    AudioBackend *be,
      SWVoiceIn *sw,
      const char *name,
      void *callback_opaque,
@@ -140,7 +134,7 @@ SWVoiceIn *AUD_open_in (
      struct audsettings *settings
      );
-void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw);
+void AUD_close_in (AudioBackend *be, SWVoiceIn *sw);

I know this is painful, but please fix ./checkpatch.pl errors before
posting your pull request.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>


Reply via email to