summaryrefslogtreecommitdiffstats
path: root/hw/usb-ccid.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-15 14:53:10 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-27 10:50:47 -0600
commit62aed76583fe8bf8e6ba5955b2ecfa3619ea3540 (patch)
treea536e59eab00a94fccfbb8b3ad8b32e902e77ea2 /hw/usb-ccid.c
parent8f04ee0882aec9fe91fb70f767edf5dacff59835 (diff)
downloadhqemu-62aed76583fe8bf8e6ba5955b2ecfa3619ea3540.zip
hqemu-62aed76583fe8bf8e6ba5955b2ecfa3619ea3540.tar.gz
usb: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/usb-ccid.c')
-rw-r--r--hw/usb-ccid.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c
index 3b7f95d..eb63dfc 100644
--- a/hw/usb-ccid.c
+++ b/hw/usb-ccid.c
@@ -1286,28 +1286,34 @@ static VMStateDescription ccid_vmstate = {
}
};
-static struct USBDeviceInfo ccid_info = {
- .product_desc = "QEMU USB CCID",
- .qdev.name = CCID_DEV_NAME,
- .qdev.desc = "CCID Rev 1.1 smartcard reader",
- .qdev.size = sizeof(USBCCIDState),
- .init = ccid_initfn,
- .usb_desc = &desc_ccid,
- .handle_packet = usb_generic_handle_packet,
- .handle_reset = ccid_handle_reset,
- .handle_control = ccid_handle_control,
- .handle_data = ccid_handle_data,
- .handle_destroy = ccid_handle_destroy,
- .usbdevice_name = "ccid",
- .qdev.props = (Property[]) {
+static void ccid_class_initfn(ObjectClass *klass, void *data)
+{
+ USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
+
+ uc->init = ccid_initfn;
+ uc->product_desc = "QEMU USB CCID";
+ uc->usb_desc = &desc_ccid;
+ uc->handle_packet = usb_generic_handle_packet;
+ uc->handle_reset = ccid_handle_reset;
+ uc->handle_control = ccid_handle_control;
+ uc->handle_data = ccid_handle_data;
+ uc->handle_destroy = ccid_handle_destroy;
+}
+
+static struct DeviceInfo ccid_info = {
+ .name = CCID_DEV_NAME,
+ .desc = "CCID Rev 1.1 smartcard reader",
+ .size = sizeof(USBCCIDState),
+ .class_init= ccid_class_initfn,
+ .vmsd = &ccid_vmstate,
+ .props = (Property[]) {
DEFINE_PROP_UINT8("debug", USBCCIDState, debug, 0),
DEFINE_PROP_END_OF_LIST(),
},
- .qdev.vmsd = &ccid_vmstate,
};
static void ccid_register_devices(void)
{
- usb_qdev_register(&ccid_info);
+ usb_qdev_register(&ccid_info, "ccid", NULL);
}
device_init(ccid_register_devices)
OpenPOWER on IntegriCloud