[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 06/19] usb-hub: convert init to realize
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 06/19] usb-hub: convert init to realize |
Date: |
Thu, 18 Sep 2014 12:12:49 +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/dev-hub.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
> index 7492174..8e3f7a8 100644
> --- a/hw/usb/dev-hub.c
> +++ b/hw/usb/dev-hub.c
> @@ -511,15 +511,15 @@ static USBPortOps usb_hub_port_ops = {
> .complete = usb_hub_complete,
> };
>
> -static int usb_hub_initfn(USBDevice *dev)
> +static void usb_hub_realize(USBDevice *dev, Error **errp)
> {
> USBHubState *s = DO_UPCAST(USBHubState, dev, dev);
> USBHubPort *port;
> int i;
>
> if (dev->port->hubcount == 5) {
> - error_report("usb hub chain too deep");
> - return -1;
> + error_setg(errp, "usb hub chain too deep");
> + return;
> }
>
> usb_desc_create_serial(dev);
> @@ -533,7 +533,6 @@ static int usb_hub_initfn(USBDevice *dev)
> usb_port_location(&port->port, dev->port, i+1);
> }
> usb_hub_handle_reset(dev);
> - return 0;
> }
>
> static const VMStateDescription vmstate_usb_hub_port = {
> @@ -564,7 +563,7 @@ static void usb_hub_class_initfn(ObjectClass *klass, void
> *data)
> DeviceClass *dc = DEVICE_CLASS(klass);
> USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
>
> - uc->init = usb_hub_initfn;
> + uc->realize = usb_hub_realize;
> uc->product_desc = "QEMU USB Hub";
> uc->usb_desc = &desc_hub;
> uc->find_device = usb_hub_find_device;
>
Reviewed-by: Paolo Bonzini <address@hidden>
- [Qemu-devel] [PATCH 00/19] usb: convert device init to realize, arei.gonglei, 2014/09/18
- [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
- Re: [Qemu-devel] [PATCH 06/19] usb-hub: convert init to realize,
Paolo Bonzini <=
- [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
- [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