Browse Source

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>
staging^2
Roman Kiryanov 5 months ago
committed by Philippe Mathieu-Daudé
parent
commit
248958526d
  1. 6
      hw/audio/virtio-snd.c
  2. 2
      include/hw/audio/virtio-snd.h

6
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 =

2
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;

Loading…
Cancel
Save