aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-net.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-net.c
parent8f04ee0882aec9fe91fb70f767edf5dacff59835 (diff)
usb: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/usb-net.c')
-rw-r--r--hw/usb-net.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/hw/usb-net.c b/hw/usb-net.c
index fd4106b99b..57b58ac1da 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1385,29 +1385,34 @@ static const VMStateDescription vmstate_usb_net = {
.unmigratable = 1,
};
-static struct USBDeviceInfo net_info = {
- .product_desc = "QEMU USB Network Interface",
- .qdev.name = "usb-net",
- .qdev.fw_name = "network",
- .qdev.size = sizeof(USBNetState),
- .qdev.vmsd = &vmstate_usb_net,
- .usb_desc = &desc_net,
- .init = usb_net_initfn,
- .handle_packet = usb_generic_handle_packet,
- .handle_reset = usb_net_handle_reset,
- .handle_control = usb_net_handle_control,
- .handle_data = usb_net_handle_data,
- .handle_destroy = usb_net_handle_destroy,
- .usbdevice_name = "net",
- .usbdevice_init = usb_net_init,
- .qdev.props = (Property[]) {
+static void usb_net_class_initfn(ObjectClass *klass, void *data)
+{
+ USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
+
+ uc->init = usb_net_initfn;
+ uc->product_desc = "QEMU USB Network Interface";
+ uc->usb_desc = &desc_net;
+ uc->handle_packet = usb_generic_handle_packet;
+ uc->handle_reset = usb_net_handle_reset;
+ uc->handle_control = usb_net_handle_control;
+ uc->handle_data = usb_net_handle_data;
+ uc->handle_destroy = usb_net_handle_destroy;
+}
+
+static struct DeviceInfo net_info = {
+ .name = "usb-net",
+ .fw_name = "network",
+ .size = sizeof(USBNetState),
+ .vmsd = &vmstate_usb_net,
+ .class_init= usb_net_class_initfn,
+ .props = (Property[]) {
DEFINE_NIC_PROPERTIES(USBNetState, conf),
DEFINE_PROP_END_OF_LIST(),
- }
+ },
};
static void usb_net_register_devices(void)
{
- usb_qdev_register(&net_info);
+ usb_qdev_register(&net_info, "net", usb_net_init);
}
device_init(usb_net_register_devices)