[PULL v2 44/85] audio/wav: convert to QOM lifecycle methods

marcandre.lureau@redhat.com posted 85 patches 1 month, 2 weeks ago
There is a newer version of this series
[PULL v2 44/85] audio/wav: convert to QOM lifecycle methods
Posted by marcandre.lureau@redhat.com 1 month, 2 weeks ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

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>
---
 audio/wavaudio.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index cd2ceffd42b..f1a414f208c 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -89,7 +89,7 @@ static int wav_init_out(HWVoiceOut *hw, struct audsettings *as,
         0x02, 0x00, 0x44, 0xac, 0x00, 0x00, 0x10, 0xb1, 0x02, 0x00, 0x04,
         0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00
     };
-    Audiodev *dev = drv_opaque;
+    Audiodev *dev = hw->s->dev;
     AudiodevWavOptions *wopts = &dev->u.wav;
     struct audsettings wav_as = audiodev_to_audsettings(dev->u.wav.out);
     const char *wav_path = wopts->path ?: "qemu.wav";
@@ -200,17 +200,6 @@ static void wav_enable_out(HWVoiceOut *hw, bool enable)
     }
 }
 
-static void *wav_audio_init(Audiodev *dev, Error **errp)
-{
-    assert(dev->driver == AUDIODEV_DRIVER_WAV);
-    return dev;
-}
-
-static void wav_audio_fini (void *opaque)
-{
-    ldebug ("wav_fini");
-}
-
 static struct audio_pcm_ops wav_pcm_ops = {
     .init_out = wav_init_out,
     .fini_out = wav_fini_out,
@@ -222,8 +211,6 @@ static struct audio_pcm_ops wav_pcm_ops = {
 
 static struct audio_driver wav_audio_driver = {
     .name           = "wav",
-    .init           = wav_audio_init,
-    .fini           = wav_audio_fini,
     .pcm_ops        = &wav_pcm_ops,
     .max_voices_out = 1,
     .max_voices_in  = 0,
-- 
2.53.0