All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: arei.gonglei@huawei.com, qemu-devel@nongnu.org
Cc: luonengjun@huawei.com, peter.huangpeng@huawei.com,
	weidong.huang@huawei.com, kraxel@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 07/19] dev-storage: convert init to realize
Date: Thu, 18 Sep 2014 12:13:10 +0200	[thread overview]
Message-ID: <541AB036.8040902@redhat.com> (raw)
In-Reply-To: <1411032780-10692-8-git-send-email-arei.gonglei@huawei.com>

Il 18/09/2014 11:32, arei.gonglei@huawei.com ha scritto:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> 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>
> ---
>  hw/usb/dev-storage.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
> index a9f31f0..6dc5f47 100644
> --- a/hw/usb/dev-storage.c
> +++ b/hw/usb/dev-storage.c
> @@ -595,7 +595,7 @@ static const struct SCSIBusInfo usb_msd_scsi_info_bot = {
>      .load_request = usb_msd_load_request,
>  };
>  
> -static int usb_msd_initfn_storage(USBDevice *dev)
> +static void usb_msd_realize_storage(USBDevice *dev, Error **errp)
>  {
>      MSDState *s = DO_UPCAST(MSDState, dev, dev);
>      BlockDriverState *bs = s->conf.bs;
> @@ -603,8 +603,8 @@ static int usb_msd_initfn_storage(USBDevice *dev)
>      Error *err = NULL;
>  
>      if (!bs) {
> -        error_report("drive property not set");
> -        return -1;
> +        error_setg(errp, "drive property not set");
> +        return;
>      }
>  
>      blkconf_serial(&s->conf, &dev->serial);
> @@ -629,9 +629,8 @@ static int usb_msd_initfn_storage(USBDevice *dev)
>                                           s->conf.bootindex, dev->serial,
>                                           &err);
>      if (!scsi_dev) {
> -        error_report("%s", error_get_pretty(err));
> -        error_free(err);
> -        return -1;
> +        error_propagate(errp, err);
> +        return;
>      }
>      s->bus.qbus.allow_hotplug = 0;
>      usb_msd_handle_reset(dev);
> @@ -644,11 +643,9 @@ static int usb_msd_initfn_storage(USBDevice *dev)
>              autostart = 0;
>          }
>      }
> -
> -    return 0;
>  }
>  
> -static int usb_msd_initfn_bot(USBDevice *dev)
> +static void usb_msd_realize_bot(USBDevice *dev, Error **errp)
>  {
>      MSDState *s = DO_UPCAST(MSDState, dev, dev);
>  
> @@ -658,8 +655,6 @@ static int usb_msd_initfn_bot(USBDevice *dev)
>                   &usb_msd_scsi_info_bot, NULL);
>      s->bus.qbus.allow_hotplug = 0;
>      usb_msd_handle_reset(dev);
> -
> -    return 0;
>  }
>  
>  static USBDevice *usb_msd_init(USBBus *bus, const char *filename)
> @@ -765,7 +760,7 @@ static void usb_msd_class_initfn_storage(ObjectClass *klass, void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>      USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
>  
> -    uc->init = usb_msd_initfn_storage;
> +    uc->realize = usb_msd_realize_storage;
>      dc->props = msd_properties;
>      usb_msd_class_initfn_common(klass);
>  }
> @@ -774,7 +769,7 @@ static void usb_msd_class_initfn_bot(ObjectClass *klass, void *data)
>  {
>      USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
>  
> -    uc->init = usb_msd_initfn_bot;
> +    uc->realize = usb_msd_realize_bot;
>      usb_msd_class_initfn_common(klass);
>  }
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

  reply	other threads:[~2014-09-18 10:13 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18  9:32 [Qemu-devel] [PATCH 00/19] usb: convert device init to realize arei.gonglei
2014-09-18  9:32 ` [Qemu-devel] [PATCH 01/19] usb-storage: fix possible memory leak and missing error message arei.gonglei
2014-09-18 10:17   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 02/19] usb-bus: convert USBDeviceClass init to realize arei.gonglei
2014-09-18 10:08   ` Paolo Bonzini
2014-09-18 10:19     ` Gonglei (Arei)
2014-09-18 10:09   ` Paolo Bonzini
2014-09-18 10:21     ` Gonglei (Arei)
2014-09-18  9:32 ` [Qemu-devel] [PATCH 03/19] usb-net: convert " arei.gonglei
2014-09-18 10:17   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 04/19] libusb: " arei.gonglei
2014-09-18 10:11   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 05/19] libusb: using error_report instead of fprintf arei.gonglei
2014-09-18 10:12   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 06/19] usb-hub: convert init to realize arei.gonglei
2014-09-18 10:12   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 07/19] dev-storage: " arei.gonglei
2014-09-18 10:13   ` Paolo Bonzini [this message]
2014-09-18  9:32 ` [Qemu-devel] [PATCH 08/19] dev-storage: usring error_report instead of fprintf/printf arei.gonglei
2014-09-18 10:13   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 09/19] dev-uas: convert init to realize arei.gonglei
2014-09-18 10:13   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 10/19] dev-uas: using error_report instead of fprintf arei.gonglei
2014-09-18 10:14   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 11/19] dev-bluetooth: convert init to realize arei.gonglei
2014-09-18 10:14   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 12/19] dev-serial: " arei.gonglei
2014-09-18 10:14   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 13/19] usb-ccid: " arei.gonglei
2014-09-18 10:14   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 14/19] dev-hid: " arei.gonglei
2014-09-18 10:15   ` Paolo Bonzini
2014-09-18 10:23     ` Gonglei (Arei)
2014-09-18  9:32 ` [Qemu-devel] [PATCH 15/19] dev-wacom: " arei.gonglei
2014-09-18 10:15   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 16/19] usb-audio: " arei.gonglei
2014-09-18 10:16   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 17/19] usb-redir: " arei.gonglei
2014-09-18 10:16   ` Paolo Bonzini
2014-09-18  9:32 ` [Qemu-devel] [PATCH 18/19] usb-mtp: " arei.gonglei
2014-09-18 10:16   ` Paolo Bonzini
2014-09-18  9:33 ` [Qemu-devel] [PATCH 19/19] usb-bus: remove "init" from USBDeviceClass struct arei.gonglei
2014-09-18 10:16   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=541AB036.8040902@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weidong.huang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.