Commit c11f4bc9 authored by Gonglei's avatar Gonglei Committed by Gerd Hoffmann
Browse files

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: default avatarGonglei <arei.gonglei@huawei.com>
Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent e25524ef
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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)