From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUYm6-0003iB-RC for qemu-devel@nongnu.org; Thu, 18 Sep 2014 06:17:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUYm2-0006vj-0J for qemu-devel@nongnu.org; Thu, 18 Sep 2014 06:17:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUYm1-0006vC-OH for qemu-devel@nongnu.org; Thu, 18 Sep 2014 06:17:13 -0400 Message-ID: <541AB11C.70206@redhat.com> Date: Thu, 18 Sep 2014 12:17:00 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411032780-10692-1-git-send-email-arei.gonglei@huawei.com> <1411032780-10692-4-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1411032780-10692-4-git-send-email-arei.gonglei@huawei.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 03/19] usb-net: convert init to realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Il 18/09/2014 11:32, arei.gonglei@huawei.com ha scritto: > From: Gonglei > > meanwhile, qerror_report_err() is a transitional interface to > help with converting existing HMP commands to QMP. It should > not be used elsewhere. > > Signed-off-by: Gonglei > --- > hw/usb/dev-network.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c > index 518d536..686bd69 100644 > --- a/hw/usb/dev-network.c > +++ b/hw/usb/dev-network.c > @@ -27,7 +27,7 @@ > #include "hw/usb.h" > #include "hw/usb/desc.h" > #include "net/net.h" > -#include "qapi/qmp/qerror.h" > +#include "qemu/error-report.h" > #include "qemu/queue.h" > #include "qemu/config-file.h" > #include "sysemu/sysemu.h" > @@ -1341,7 +1341,7 @@ static NetClientInfo net_usbnet_info = { > .cleanup = usbnet_cleanup, > }; > > -static int usb_net_initfn(USBDevice *dev) > +static void usb_net_realize(USBDevice *dev, Error **errrp) > { > USBNetState *s = DO_UPCAST(USBNetState, dev, dev); > > @@ -1373,7 +1373,6 @@ static int usb_net_initfn(USBDevice *dev) > usb_desc_set_string(dev, STRING_ETHADDR, s->usbstring_mac); > > add_boot_device_path(s->conf.bootindex, &dev->qdev, "/ethernet@0"); > - return 0; > } > > static USBDevice *usb_net_init(USBBus *bus, const char *cmdline) > @@ -1392,7 +1391,7 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline) > > idx = net_client_init(opts, 0, &local_err); > if (local_err) { > - qerror_report_err(local_err); > + error_report("%s", error_get_pretty(local_err)); > error_free(local_err); > return NULL; > } > @@ -1421,7 +1420,7 @@ static void usb_net_class_initfn(ObjectClass *klass, void *data) > DeviceClass *dc = DEVICE_CLASS(klass); > USBDeviceClass *uc = USB_DEVICE_CLASS(klass); > > - uc->init = usb_net_initfn; > + uc->realize = usb_net_realize; > uc->product_desc = "QEMU USB Network Interface"; > uc->usb_desc = &desc_net; > uc->handle_reset = usb_net_handle_reset; > Reviewed-by: Paolo Bonzini