From 248958526d9bbe47614165782c6357f5c3240f40 Mon Sep 17 00:00:00 2001 From: Roman Kiryanov Date: Thu, 5 Mar 2026 04:25:23 +0000 Subject: [PATCH] virtio-snd: remove redundant fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VirtIOSoundPCM does not need a pointer to VirtIOSound because each VirtIOSoundPCMStream already carries a pointer to it. Signed-off-by: Roman Kiryanov Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20260305042523.335493-2-rkir@google.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/audio/virtio-snd.c | 6 ++---- include/hw/audio/virtio-snd.h | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index 0f78cec967..fb5cff3866 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -402,10 +402,10 @@ static void virtio_snd_pcm_close(VirtIOSoundPCMStream *stream) if (stream) { virtio_snd_pcm_flush(stream); if (stream->info.direction == VIRTIO_SND_D_OUTPUT) { - audio_be_close_out(stream->pcm->snd->audio_be, stream->voice.out); + audio_be_close_out(stream->s->audio_be, stream->voice.out); stream->voice.out = NULL; } else if (stream->info.direction == VIRTIO_SND_D_INPUT) { - audio_be_close_in(stream->pcm->snd->audio_be, stream->voice.in); + audio_be_close_in(stream->s->audio_be, stream->voice.in); stream->voice.in = NULL; } } @@ -440,7 +440,6 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, uint32_t stream_id) stream = g_new0(VirtIOSoundPCMStream, 1); stream->active = false; stream->id = stream_id; - stream->pcm = &s->pcm; stream->s = s; stream->latency_bytes = 0; qemu_mutex_init(&stream->queue_mutex); @@ -1064,7 +1063,6 @@ static void virtio_snd_realize(DeviceState *dev, Error **errp) vsnd->vmstate = qemu_add_vm_change_state_handler(virtio_snd_vm_state_change, vsnd); - vsnd->pcm.snd = vsnd; vsnd->pcm.streams = g_new0(VirtIOSoundPCMStream *, vsnd->snd_conf.streams); vsnd->pcm.pcm_params = diff --git a/include/hw/audio/virtio-snd.h b/include/hw/audio/virtio-snd.h index da2ba9675e..e28f1be5db 100644 --- a/include/hw/audio/virtio-snd.h +++ b/include/hw/audio/virtio-snd.h @@ -122,7 +122,6 @@ struct VirtIOSoundPCMBuffer { }; struct VirtIOSoundPCM { - VirtIOSound *snd; /* * PCM parameters are a separate field instead of a VirtIOSoundPCMStream * field, because the operation of PCM control requests is first @@ -135,7 +134,6 @@ struct VirtIOSoundPCM { }; struct VirtIOSoundPCMStream { - VirtIOSoundPCM *pcm; virtio_snd_pcm_info info; virtio_snd_pcm_set_params params; uint32_t id;