From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=35498 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFVrn-0005Rj-Ue for qemu-devel@nongnu.org; Mon, 08 Nov 2010 12:50:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFVrm-00030E-J0 for qemu-devel@nongnu.org; Mon, 08 Nov 2010 12:50:51 -0500 Received: from fe01x03-cgp.akado.ru ([77.232.31.164]:59925 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFVrm-0002zP-AP for qemu-devel@nongnu.org; Mon, 08 Nov 2010 12:50:50 -0500 Date: Mon, 8 Nov 2010 20:50:41 +0300 (MSK) From: malc In-Reply-To: <1289223970-31221-3-git-send-email-kraxel@redhat.com> Message-ID: References: <1289223970-31221-1-git-send-email-kraxel@redhat.com> <1289223970-31221-3-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: [Qemu-devel] Re: [PATCH 2/4] hda-audio: exit cleanup List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On Mon, 8 Nov 2010, Gerd Hoffmann wrote: > Add exit callback to the driver. Unregister the sound card properly > on exit. > > Signed-off-by: Gerd Hoffmann > --- > hw/hda-audio.c | 23 +++++++++++++++++++++++ > 1 files changed, 23 insertions(+), 0 deletions(-) > > diff --git a/hw/hda-audio.c b/hw/hda-audio.c > index 1035774..5593c84 100644 > --- a/hw/hda-audio.c > +++ b/hw/hda-audio.c > @@ -808,6 +808,27 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc) > return 0; > } > > +static int hda_audio_exit(HDACodecDevice *hda) > +{ > + HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda); > + HDAAudioStream *st; > + int i; > + > + dprint(a, 1, "%s\n", __FUNCTION__); > + for (i = 0; i < ARRAY_SIZE(a->st); i++) { > + st = a->st + i; > + if (st->node == NULL) > + continue; Braces > + if (st->output) { > + AUD_close_out(&a->card, st->voice.out); > + } else { > + AUD_close_in(&a->card, st->voice.in); > + } > + } > + AUD_remove_card(&a->card); > + return 0; > +} > + > static int hda_audio_post_load(void *opaque, int version) > { > HDAAudioState *a = opaque; > @@ -879,6 +900,7 @@ static HDACodecDeviceInfo hda_audio_info_output = { > .qdev.vmsd = &vmstate_hda_audio, > .qdev.props = hda_audio_properties, > .init = hda_audio_init_output, > + .exit = hda_audio_exit, > .command = hda_audio_command, > .stream = hda_audio_stream, > }; > @@ -890,6 +912,7 @@ static HDACodecDeviceInfo hda_audio_info_duplex = { > .qdev.vmsd = &vmstate_hda_audio, > .qdev.props = hda_audio_properties, > .init = hda_audio_init_duplex, > + .exit = hda_audio_exit, > .command = hda_audio_command, > .stream = hda_audio_stream, > }; > -- mailto:av1474@comtv.ru