@samitouri / QOSamiQemu / commits / e70c55fee9

audio/wav: convert to QOM lifecycle methods

Remove the legacy driver init/fini callbacks from the WAV audio backend. The wav_audio_init() just returned the Audiodev pointer and wav_audio_fini() only logged a debug message. Access to the Audiodev is now through hw->s->dev instead of the drv_opaque pointer. Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Marc-André Lureau committed Jan 16, 2026 at 11:48 UTC e70c55fee99e66bf0b84816ca095dc9da71819e3
1 file changed +1 -14
audio/wavaudio.c
+1 -14
@@ -89,7 +89,7 @@ static int wav_init_out(HWVoiceOut *hw, struct audsettings *as,
89 0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04,
90 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00
91 };
92 - Audiodev *dev = drv_opaque;
92 + Audiodev *dev = hw->s->dev;
93 AudiodevWavOptions *wopts = &dev->u.wav;
94 struct audsettings wav_as = audiodev_to_audsettings(dev->u.wav.out);
95 const char *wav_path = wopts->path ?: "qemu.wav";
@@ -200,17 +200,6 @@ static void wav_enable_out(HWVoiceOut *hw, bool enable)
200 }
201 }
202
203 -static void *wav_audio_init(Audiodev *dev, Error **errp)
204 -{
205 - assert(dev->driver == AUDIODEV_DRIVER_WAV);
206 - return dev;
207 -}
208 -
209 -static void wav_audio_fini (void *opaque)
210 -{
211 - ldebug ("wav_fini");
212 -}
213 -
203 static struct audio_pcm_ops wav_pcm_ops = {
204 .init_out = wav_init_out,
205 .fini_out = wav_fini_out,
@@ -222,8 +211,6 @@ static struct audio_pcm_ops wav_pcm_ops = {
211
212 static struct audio_driver wav_audio_driver = {
213 .name = "wav",
225 - .init = wav_audio_init,
226 - .fini = wav_audio_fini,
214 .pcm_ops = &wav_pcm_ops,
215 .max_voices_out = 1,
216 .max_voices_in = 0,