summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-10-07 16:00:20 +0800
committerGerd Hoffmann <kraxel@redhat.com>2014-10-15 09:52:54 +0200
commitc11f4bc9ff7e727aedc57c796158e4af0261c56c (patch)
tree3843bbcddc671c8804f03ee9e9766d7b08291b86
parente25524efb041230b4cb15c5941f09b2138fefaa2 (diff)
downloadqemu-c11f4bc9ff7e727aedc57c796158e4af0261c56c.zip
usb-net: add bootindex to qom property
Add a qom property with the same name 'bootindex', when we remove it form qdev property, things will continue to work just fine, and we can use qom features which are not supported by qdev property. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/usb/dev-network.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
index 23e3c45b5f..f341b3317b 100644
--- a/hw/usb/dev-network.c
+++ b/hw/usb/dev-network.c
@@ -1375,6 +1375,16 @@ static void usb_net_realize(USBDevice *dev, Error **errrp)
add_boot_device_path(s->conf.bootindex, &dev->qdev, "/ethernet@0");
}
+static void usb_net_instance_init(Object *obj)
+{
+ USBDevice *dev = USB_DEVICE(obj);
+ USBNetState *s = DO_UPCAST(USBNetState, dev, dev);
+
+ device_add_bootindex_property(obj, &s->conf.bootindex,
+ "bootindex", "/ethernet-phy@0",
+ &dev->qdev, NULL);
+}
+
static USBDevice *usb_net_init(USBBus *bus, const char *cmdline)
{
Error *local_err = NULL;
@@ -1438,6 +1448,7 @@ static const TypeInfo net_info = {
.parent = TYPE_USB_DEVICE,
.instance_size = sizeof(USBNetState),
.class_init = usb_net_class_initfn,
+ .instance_init = usb_net_instance_init,
};
static void usb_net_register_types(void)