[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/19] usb: usb-net QOMify
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 12/19] usb: usb-net QOMify |
Date: |
Fri, 8 May 2015 13:45:46 +0200 |
From: Gonglei <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/dev-network.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
index 9be3a64..743c231 100644
--- a/hw/usb/dev-network.c
+++ b/hw/usb/dev-network.c
@@ -648,6 +648,9 @@ typedef struct USBNetState {
QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp;
} USBNetState;
+#define TYPE_USB_NET "usb-net"
+#define USB_NET(obj) OBJECT_CHECK(USBNetState, (obj), TYPE_USB_NET)
+
static int is_rndis(USBNetState *s)
{
return s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE;
@@ -1347,7 +1350,7 @@ static NetClientInfo net_usbnet_info = {
static void usb_net_realize(USBDevice *dev, Error **errrp)
{
- USBNetState *s = DO_UPCAST(USBNetState, dev, dev);
+ USBNetState *s = USB_NET(dev);
usb_desc_create_serial(dev);
usb_desc_init(dev);
@@ -1380,7 +1383,7 @@ static void usb_net_realize(USBDevice *dev, Error **errrp)
static void usb_net_instance_init(Object *obj)
{
USBDevice *dev = USB_DEVICE(obj);
- USBNetState *s = DO_UPCAST(USBNetState, dev, dev);
+ USBNetState *s = USB_NET(dev);
device_add_bootindex_property(obj, &s->conf.bootindex,
"bootindex", "/address@hidden",
@@ -1441,7 +1444,7 @@ static void usb_net_class_initfn(ObjectClass *klass, void
*data)
}
static const TypeInfo net_info = {
- .name = "usb-net",
+ .name = TYPE_USB_NET,
.parent = TYPE_USB_DEVICE,
.instance_size = sizeof(USBNetState),
.class_init = usb_net_class_initfn,
@@ -1451,7 +1454,7 @@ static const TypeInfo net_info = {
static void usb_net_register_types(void)
{
type_register_static(&net_info);
- usb_legacy_register("usb-net", "net", usb_net_init);
+ usb_legacy_register(TYPE_USB_NET, "net", usb_net_init);
}
type_init(usb_net_register_types)
--
1.8.3.1
- [Qemu-devel] [PULL 00/19] usb: qomify, bugfixes for xhci & uhci., Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 03/19] Revert "xhci: generate a Transfer Event for each Transfer TRB with the IOC bit set", Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 07/19] usb: usb-bt QOMify, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 09/19] usb: usb-hub QOMify, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 19/19] uhci: controller is halted after reset, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 12/19] usb: usb-net QOMify,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 05/19] uhci: QOMify, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 08/19] usb: usb-hid QOMify, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 04/19] xhci: fix events for setup trb., Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 10/19] usb: usb-mtp QOMify, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 06/19] usb: usb-audio QOMify, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 02/19] xhci: set timer to retry xfers, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 01/19] usb: fix usb-net segfault, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 16/19] usb: usb-wacom-tablet QOMify, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 15/19] usb: usb-uas QOMify, Gerd Hoffmann, 2015/05/08
- [Qemu-devel] [PULL 14/19] usb: usb-storage QOMify, Gerd Hoffmann, 2015/05/08