From nobody Sat May 4 17:08:35 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504945992749868.9044535917212; Sat, 9 Sep 2017 01:33:12 -0700 (PDT) Received: from localhost ([::1]:48663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqbCR-0007EX-4q for importer@patchew.org; Sat, 09 Sep 2017 04:33:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqbBW-0006kc-Ok for qemu-devel@nongnu.org; Sat, 09 Sep 2017 04:32:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqbBT-0005xP-Ky for qemu-devel@nongnu.org; Sat, 09 Sep 2017 04:32:14 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:5806 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqbBT-0005wI-96 for qemu-devel@nongnu.org; Sat, 09 Sep 2017 04:32:11 -0400 Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Sep 2017 16:32:07 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 77B4646BA6B3; Sat, 9 Sep 2017 16:32:07 +0800 (CST) Received: from maozy.g08.fujitsu.local (10.167.225.76) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Sat, 9 Sep 2017 16:32:07 +0800 X-IronPort-AV: E=Sophos;i="5.42,365,1500912000"; d="scan'208";a="25555107" From: Mao Zhongyi To: Date: Sat, 9 Sep 2017 16:30:01 +0800 Message-ID: <20170909083001.17451-1-maozy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.9.4 MIME-Version: 1.0 X-Originating-IP: [10.167.225.76] X-yoursite-MailScanner-ID: 77B4646BA6B3.A1111 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: maozy.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 183.91.158.132 Subject: [Qemu-devel] [PATCH] usb/dev-smartcard-reader: convert to realize 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Convert CCID Device to realize and rename the ccid_card_init() to ccid_card_realize(). Cc: Gerd Hoffmann Signed-off-by: Mao Zhongyi --- hw/usb/dev-smartcard-reader.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index bef1f03..27cd48d 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -1306,27 +1306,25 @@ static int ccid_card_exit(DeviceState *qdev) return 0; } =20 -static int ccid_card_init(DeviceState *qdev) +static void ccid_card_realize(DeviceState *qdev, Error **errp) { CCIDCardState *card =3D CCID_CARD(qdev); USBDevice *dev =3D USB_DEVICE(qdev->parent_bus->parent); USBCCIDState *s =3D USB_CCID_DEV(dev); - int ret =3D 0; =20 if (card->slot !=3D 0) { - warn_report("usb-ccid supports one slot, can't add %d", + error_setg(errp, "usb-ccid supports one slot, can't add %d", card->slot); - return -1; + return; } if (s->card !=3D NULL) { - warn_report("usb-ccid card already full, not adding"); - return -1; + error_setg(errp, "usb-ccid card already full, not adding"); + return; } - ret =3D ccid_card_initfn(card); - if (ret =3D=3D 0) { + + if (!ccid_card_initfn(card)) { s->card =3D card; } - return ret; } =20 static void ccid_realize(USBDevice *dev, Error **errp) @@ -1496,7 +1494,7 @@ static void ccid_card_class_init(ObjectClass *klass, = void *data) { DeviceClass *k =3D DEVICE_CLASS(klass); k->bus_type =3D TYPE_CCID_BUS; - k->init =3D ccid_card_init; + k->realize =3D ccid_card_realize; k->exit =3D ccid_card_exit; k->props =3D ccid_props; } --=20 2.9.4