aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/dev-smartcard-reader.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-01-25 14:14:32 -0300
committerGerd Hoffmann <kraxel@redhat.com>2018-01-26 07:59:33 +0100
commit80ae865468bde918363a123aa26c6fc4385023ac (patch)
tree2b00678ecb67754b6c06e1c08da36bf790688826 /hw/usb/dev-smartcard-reader.c
parentc7516699fc416ed836639dff12115f9d806bfc82 (diff)
usb-ccid: convert CCIDCardClass::exitfn() -> unrealize()
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20180125171432.13554-4-f4bug@amsat.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/dev-smartcard-reader.c')
-rw-r--r--hw/usb/dev-smartcard-reader.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index 85f5f2247b..e6468057a0 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -500,16 +500,6 @@ static void ccid_card_apdu_from_guest(CCIDCardState *card,
}
}
-static void ccid_card_exitfn(CCIDCardState *card)
-{
- CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
-
- if (cc->exitfn) {
- cc->exitfn(card);
- }
-
-}
-
static bool ccid_has_pending_answers(USBCCIDState *s)
{
return s->pending_answers_num > 0;
@@ -1271,18 +1261,25 @@ void ccid_card_card_inserted(CCIDCardState *card)
ccid_on_slot_change(s, true);
}
-static int ccid_card_exit(DeviceState *qdev)
+static void ccid_card_unrealize(DeviceState *qdev, Error **errp)
{
CCIDCardState *card = CCID_CARD(qdev);
+ CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
+ Error *local_err = NULL;
if (ccid_card_inserted(s)) {
ccid_card_card_removed(card);
}
- ccid_card_exitfn(card);
+ if (cc->unrealize) {
+ cc->unrealize(card, &local_err);
+ if (local_err != NULL) {
+ error_propagate(errp, local_err);
+ return;
+ }
+ }
s->card = NULL;
- return 0;
}
static void ccid_card_realize(DeviceState *qdev, Error **errp)
@@ -1472,7 +1469,7 @@ static void ccid_card_class_init(ObjectClass *klass, void *data)
DeviceClass *k = DEVICE_CLASS(klass);
k->bus_type = TYPE_CCID_BUS;
k->realize = ccid_card_realize;
- k->exit = ccid_card_exit;
+ k->unrealize = ccid_card_unrealize;
k->props = ccid_props;
}