From nobody Thu Nov 6 12:14:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540843635355950.010493865415; Mon, 29 Oct 2018 13:07:15 -0700 (PDT) Received: from localhost ([::1]:48728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHDog-0006eD-7c for importer@patchew.org; Mon, 29 Oct 2018 16:07:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHDkX-00039h-IC for qemu-devel@nongnu.org; Mon, 29 Oct 2018 16:02:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHDkS-0005wk-HJ for qemu-devel@nongnu.org; Mon, 29 Oct 2018 16:02:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50160) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHDkS-0005wZ-AW for qemu-devel@nongnu.org; Mon, 29 Oct 2018 16:02:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E3C358E41; Mon, 29 Oct 2018 20:02:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36F4416BF6; Mon, 29 Oct 2018 20:02:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 76B36B3E02; Mon, 29 Oct 2018 21:02:50 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 Oct 2018 21:02:49 +0100 Message-Id: <20181029200250.24029-3-kraxel@redhat.com> In-Reply-To: <20181029200250.24029-1-kraxel@redhat.com> References: <20181029200250.24029-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 29 Oct 2018 20:02:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] hw: ccid-card-emulated: introduce clean_event_notifier X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Li Qiang Call it in device unrealize function. Signed-off-by: Li Qiang Message-id: 1539946236-18028-2-git-send-email-liq3ea@gmail.com Signed-off-by: Gerd Hoffmann --- hw/usb/ccid-card-emulated.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 5c8b3c9907..b356edb0f3 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -409,6 +409,12 @@ static int init_event_notifier(EmulatedState *card, Er= ror **errp) return 0; } =20 +static void clean_event_notifier(EmulatedState *card) +{ + event_notifier_set_handler(&card->notifier, NULL); + event_notifier_cleanup(&card->notifier); +} + #define CERTIFICATES_DEFAULT_DB "/etc/pki/nssdb" #define CERTIFICATES_ARGS_TEMPLATE\ "db=3D\"%s\" use_hw=3Dno soft=3D(,Virtual Reader,CAC,,%s,%s,%s)" @@ -556,6 +562,7 @@ static void emulated_unrealize(CCIDCardState *base, Err= or **errp) qemu_cond_signal(&card->handle_apdu_cond); qemu_thread_join(&card->apdu_thread_id); =20 + clean_event_notifier(card); /* threads exited, can destroy all condvars/mutexes */ qemu_cond_destroy(&card->handle_apdu_cond); qemu_mutex_destroy(&card->handle_apdu_mutex); --=20 2.9.3