From patchwork Mon Nov 8 13:46:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 70419 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2AEB3B7105 for ; Tue, 9 Nov 2010 00:50:10 +1100 (EST) Received: from localhost ([127.0.0.1]:60210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFS6p-00020I-LV for incoming@patchwork.ozlabs.org; Mon, 08 Nov 2010 08:50:07 -0500 Received: from [140.186.70.92] (port=38763 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFS3B-0008Ia-Cn for qemu-devel@nongnu.org; Mon, 08 Nov 2010 08:46:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFS39-0005jv-Vy for qemu-devel@nongnu.org; Mon, 08 Nov 2010 08:46:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFS39-0005i7-OR for qemu-devel@nongnu.org; Mon, 08 Nov 2010 08:46:19 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA8DkEdt011958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 8 Nov 2010 08:46:14 -0500 Received: from rincewind.home.kraxel.org (vpn2-10-114.ams2.redhat.com [10.36.10.114]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oA8DkCv4002147; Mon, 8 Nov 2010 08:46:13 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 15D4C4582F; Mon, 8 Nov 2010 14:46:11 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 8 Nov 2010 14:46:08 +0100 Message-Id: <1289223970-31221-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1289223970-31221-1-git-send-email-kraxel@redhat.com> References: <1289223970-31221-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/4] hda-audio: exit cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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; + 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, };