[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/19] libusb: convert init to realize
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 04/19] libusb: convert init to realize |
Date: |
Thu, 18 Sep 2014 12:11:56 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
Il 18/09/2014 11:32, address@hidden ha scritto:
> From: Gonglei <address@hidden>
>
> In this way, all the implementations now use
> error_setg instead of error_report for reporting error.
>
> Signed-off-by: Gonglei <address@hidden>
> ---
> hw/usb/host-libusb.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index 9f92705..863be64 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -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);
>
> if (s->match.vendor_id > 0xffff) {
> - error_report("vendorid out of range");
> - return -1;
> + error_setg(errp, "vendorid out of range");
> + return;
> }
> if (s->match.product_id > 0xffff) {
> - error_report("productid out of range");
> - return -1;
> + error_setg(errp, "productid out of range");
> + return;
> }
> if (s->match.addr > 127) {
> - error_report("hostaddr out of range");
> - return -1;
> + error_setg(errp, "hostaddr out of range");
> + return;
> }
>
> loglevel = s->loglevel;
> @@ -980,7 +980,6 @@ static int usb_host_initfn(USBDevice *udev)
> QTAILQ_INSERT_TAIL(&hostdevs, s, next);
> add_boot_device_path(s->bootindex, &udev->qdev, NULL);
> usb_host_auto_check(NULL);
> - return 0;
> }
>
> 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);
> USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
>
> - uc->init = usb_host_initfn;
> + uc->realize = usb_host_realize;
> uc->product_desc = "USB Host Device";
> uc->cancel_packet = usb_host_cancel_packet;
> uc->handle_data = usb_host_handle_data;
>
Reviewed-by: Paolo Bonzini <address@hidden>
- [Qemu-devel] [PATCH 02/19] usb-bus: convert USBDeviceClass init to realize, (continued)
- [Qemu-devel] [PATCH 02/19] usb-bus: convert USBDeviceClass init to realize, arei.gonglei, 2014/09/18
- [Qemu-devel] [PATCH 06/19] usb-hub: convert init to realize, arei.gonglei, 2014/09/18
- [Qemu-devel] [PATCH 01/19] usb-storage: fix possible memory leak and missing error message, arei.gonglei, 2014/09/18
- [Qemu-devel] [PATCH 04/19] libusb: convert init to realize, arei.gonglei, 2014/09/18
- Re: [Qemu-devel] [PATCH 04/19] libusb: convert init to realize,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 08/19] dev-storage: usring error_report instead of fprintf/printf, arei.gonglei, 2014/09/18
- [Qemu-devel] [PATCH 12/19] dev-serial: convert init to realize, arei.gonglei, 2014/09/18
- [Qemu-devel] [PATCH 10/19] dev-uas: using error_report instead of fprintf, arei.gonglei, 2014/09/18
- [Qemu-devel] [PATCH 18/19] usb-mtp: convert init to realize, arei.gonglei, 2014/09/18
- [Qemu-devel] [PATCH 19/19] usb-bus: remove "init" from USBDeviceClass struct, arei.gonglei, 2014/09/18