qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 12/19] dev-serial: convert init to realize


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 12/19] dev-serial: convert init to realize
Date: Thu, 18 Sep 2014 12:14:27 +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-serial.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
> index 178ecb2..3384db6 100644
> --- a/hw/usb/dev-serial.c
> +++ b/hw/usb/dev-serial.c
> @@ -471,7 +471,7 @@ static void usb_serial_event(void *opaque, int event)
>      }
>  }
>  
> -static int usb_serial_initfn(USBDevice *dev)
> +static void usb_serial_realize(USBDevice *dev, Error **errp)
>  {
>      USBSerialState *s = DO_UPCAST(USBSerialState, dev, dev);
>  
> @@ -480,8 +480,8 @@ static int usb_serial_initfn(USBDevice *dev)
>      dev->auto_attach = 0;
>  
>      if (!s->cs) {
> -        error_report("Property chardev is required");
> -        return -1;
> +        error_setg(errp, "Property chardev is required");
> +        return;
>      }
>  
>      qemu_chr_add_handlers(s->cs, usb_serial_can_read, usb_serial_read,
> @@ -491,7 +491,6 @@ static int usb_serial_initfn(USBDevice *dev)
>      if (s->cs->be_open && !dev->attached) {
>          usb_device_attach(dev, NULL);
>      }
> -    return 0;
>  }
>  
>  static USBDevice *usb_serial_init(USBBus *bus, const char *filename)
> @@ -582,7 +581,7 @@ static void usb_serial_class_initfn(ObjectClass *klass, 
> void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>      USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
>  
> -    uc->init = usb_serial_initfn;
> +    uc->realize = usb_serial_realize;
>      uc->product_desc   = "QEMU USB Serial";
>      uc->usb_desc       = &desc_serial;
>      uc->handle_reset   = usb_serial_handle_reset;
> @@ -610,7 +609,7 @@ static void usb_braille_class_initfn(ObjectClass *klass, 
> void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>      USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
>  
> -    uc->init           = usb_serial_initfn;
> +    uc->realize           = usb_serial_realize;
>      uc->product_desc   = "QEMU USB Braille";
>      uc->usb_desc       = &desc_braille;
>      uc->handle_reset   = usb_serial_handle_reset;
> 

Reviewed-by: Paolo Bonzini <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]