aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/dev-smartcard-reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb/dev-smartcard-reader.c')
-rw-r--r--hw/usb/dev-smartcard-reader.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index fcfe216594..59b2248f34 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -46,6 +46,7 @@
#include "desc.h"
#include "ccid.h"
+#include "qom/object.h"
#define DPRINTF(s, lvl, fmt, ...) \
do { \
@@ -59,8 +60,10 @@ do { \
#define D_MORE_INFO 3
#define D_VERBOSE 4
-#define CCID_DEV_NAME "usb-ccid"
-#define USB_CCID_DEV(obj) OBJECT_CHECK(USBCCIDState, (obj), CCID_DEV_NAME)
+#define TYPE_USB_CCID_DEV "usb-ccid"
+typedef struct USBCCIDState USBCCIDState;
+DECLARE_INSTANCE_CHECKER(USBCCIDState, USB_CCID_DEV,
+ TYPE_USB_CCID_DEV)
/*
* The two options for variable sized buffers:
* make them constant size, for large enough constant,
@@ -274,14 +277,15 @@ typedef struct BulkIn {
uint32_t pos;
} BulkIn;
-typedef struct CCIDBus {
+struct CCIDBus {
BusState qbus;
-} CCIDBus;
+};
+typedef struct CCIDBus CCIDBus;
/*
* powered - defaults to true, changed by PowerOn/PowerOff messages
*/
-typedef struct USBCCIDState {
+struct USBCCIDState {
USBDevice dev;
USBEndpoint *intr;
USBEndpoint *bulk;
@@ -309,7 +313,7 @@ typedef struct USBCCIDState {
uint8_t powered;
uint8_t notify_slot_change;
uint8_t debug;
-} USBCCIDState;
+};
/*
* CCID Spec chapter 4: CCID uses a standard device descriptor per Chapter 9,
@@ -1173,7 +1177,8 @@ static Property ccid_props[] = {
};
#define TYPE_CCID_BUS "ccid-bus"
-#define CCID_BUS(obj) OBJECT_CHECK(CCIDBus, (obj), TYPE_CCID_BUS)
+DECLARE_INSTANCE_CHECKER(CCIDBus, CCID_BUS,
+ TYPE_CCID_BUS)
static const TypeInfo ccid_bus_info = {
.name = TYPE_CCID_BUS,
@@ -1457,7 +1462,7 @@ static void ccid_class_initfn(ObjectClass *klass, void *data)
}
static const TypeInfo ccid_info = {
- .name = CCID_DEV_NAME,
+ .name = TYPE_USB_CCID_DEV,
.parent = TYPE_USB_DEVICE,
.instance_size = sizeof(USBCCIDState),
.class_init = ccid_class_initfn,
@@ -1490,7 +1495,7 @@ static void ccid_register_types(void)
type_register_static(&ccid_bus_info);
type_register_static(&ccid_card_type_info);
type_register_static(&ccid_info);
- usb_legacy_register(CCID_DEV_NAME, "ccid", NULL);
+ usb_legacy_register(TYPE_USB_CCID_DEV, "ccid", NULL);
}
type_init(ccid_register_types)