mirror of https://github.com/xqemu/xqemu.git
libusb: convert init to realize
In this way, all the implementations now use error_setg instead of error_report for reporting error. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
d73ad35990
commit
2aa76dc18c
|
@ -951,21 +951,21 @@ static void usb_host_exit_notifier(struct Notifier *n, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usb_host_initfn(USBDevice *udev)
|
static void usb_host_realize(USBDevice *udev, Error **errp)
|
||||||
{
|
{
|
||||||
USBHostDevice *s = USB_HOST_DEVICE(udev);
|
USBHostDevice *s = USB_HOST_DEVICE(udev);
|
||||||
|
|
||||||
if (s->match.vendor_id > 0xffff) {
|
if (s->match.vendor_id > 0xffff) {
|
||||||
error_report("vendorid out of range");
|
error_setg(errp, "vendorid out of range");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
if (s->match.product_id > 0xffff) {
|
if (s->match.product_id > 0xffff) {
|
||||||
error_report("productid out of range");
|
error_setg(errp, "productid out of range");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
if (s->match.addr > 127) {
|
if (s->match.addr > 127) {
|
||||||
error_report("hostaddr out of range");
|
error_setg(errp, "hostaddr out of range");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loglevel = s->loglevel;
|
loglevel = s->loglevel;
|
||||||
|
@ -980,7 +980,6 @@ static int usb_host_initfn(USBDevice *udev)
|
||||||
QTAILQ_INSERT_TAIL(&hostdevs, s, next);
|
QTAILQ_INSERT_TAIL(&hostdevs, s, next);
|
||||||
add_boot_device_path(s->bootindex, &udev->qdev, NULL);
|
add_boot_device_path(s->bootindex, &udev->qdev, NULL);
|
||||||
usb_host_auto_check(NULL);
|
usb_host_auto_check(NULL);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usb_host_handle_destroy(USBDevice *udev)
|
static void usb_host_handle_destroy(USBDevice *udev)
|
||||||
|
@ -1480,7 +1479,7 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
|
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
uc->init = usb_host_initfn;
|
uc->realize = usb_host_realize;
|
||||||
uc->product_desc = "USB Host Device";
|
uc->product_desc = "USB Host Device";
|
||||||
uc->cancel_packet = usb_host_cancel_packet;
|
uc->cancel_packet = usb_host_cancel_packet;
|
||||||
uc->handle_data = usb_host_handle_data;
|
uc->handle_data = usb_host_handle_data;
|
||||||
|
|
Loading…
Reference in New Issue