virtio-snd: remove redundant fields
VirtIOSoundPCM does not need a pointer to VirtIOSound because each VirtIOSoundPCMStream already carries a pointer to it. Signed-off-by: Roman Kiryanov <rkir@google.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260305042523.335493-2-rkir@google.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Roman Kiryanov committed
Mar 5, 2026 at 04:25 UTC
248958526d9bbe47614165782c6357f5c3240f40
2 files changed
+2
-6
hw/audio/virtio-snd.c
+2
-4
@@ -402,10 +402,10 @@ static void virtio_snd_pcm_close(VirtIOSoundPCMStream *stream)
402
if (stream) {
403
virtio_snd_pcm_flush(stream);
404
if (stream->info.direction == VIRTIO_SND_D_OUTPUT) {
405
- audio_be_close_out(stream->pcm->snd->audio_be, stream->voice.out);
405
+ audio_be_close_out(stream->s->audio_be, stream->voice.out);
406
stream->voice.out = NULL;
407
} else if (stream->info.direction == VIRTIO_SND_D_INPUT) {
408
- audio_be_close_in(stream->pcm->snd->audio_be, stream->voice.in);
408
+ audio_be_close_in(stream->s->audio_be, stream->voice.in);
409
stream->voice.in = NULL;
410
}
411
}
@@ -440,7 +440,6 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, uint32_t stream_id)
440
stream = g_new0(VirtIOSoundPCMStream, 1);
441
stream->active = false;
442
stream->id = stream_id;
443
- stream->pcm = &s->pcm;
443
stream->s = s;
444
stream->latency_bytes = 0;
445
qemu_mutex_init(&stream->queue_mutex);
@@ -1064,7 +1063,6 @@ static void virtio_snd_realize(DeviceState *dev, Error **errp)
1063
vsnd->vmstate =
1064
qemu_add_vm_change_state_handler(virtio_snd_vm_state_change, vsnd);
1065
1067
- vsnd->pcm.snd = vsnd;
1066
vsnd->pcm.streams =
1067
g_new0(VirtIOSoundPCMStream *, vsnd->snd_conf.streams);
1068
vsnd->pcm.pcm_params =
include/hw/audio/virtio-snd.h
-2
@@ -122,7 +122,6 @@ struct VirtIOSoundPCMBuffer {
122
};
123
124
struct VirtIOSoundPCM {
125
- VirtIOSound *snd;
125
/*
126
* PCM parameters are a separate field instead of a VirtIOSoundPCMStream
127
* field, because the operation of PCM control requests is first
@@ -135,7 +134,6 @@ struct VirtIOSoundPCM {
134
};
135
136
struct VirtIOSoundPCMStream {
138
- VirtIOSoundPCM *pcm;
137
virtio_snd_pcm_info info;
138
virtio_snd_pcm_set_params params;
139
uint32_t id;