qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gonglei <arei.gonglei@huawei.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 16/26] dev-hid: convert init to realize
Date: Tue, 23 Sep 2014 14:13:27 +0200	[thread overview]
Message-ID: <1411474417-9704-17-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1411474417-9704-1-git-send-email-kraxel@redhat.com>

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>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/dev-hid.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index 67a57f1..467ec86 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -566,7 +566,7 @@ static void usb_hid_handle_destroy(USBDevice *dev)
     hid_free(&us->hid);
 }
 
-static int usb_hid_initfn(USBDevice *dev, int kind)
+static void usb_hid_initfn(USBDevice *dev, int kind)
 {
     USBHIDState *us = DO_UPCAST(USBHIDState, dev, dev);
 
@@ -579,10 +579,9 @@ static int usb_hid_initfn(USBDevice *dev, int kind)
     if (us->display && us->hid.s) {
         qemu_input_handler_bind(us->hid.s, us->display, us->head, NULL);
     }
-    return 0;
 }
 
-static int usb_tablet_initfn(USBDevice *dev)
+static void usb_tablet_realize(USBDevice *dev, Error **errp)
 {
     USBHIDState *us = DO_UPCAST(USBHIDState, dev, dev);
 
@@ -594,22 +593,22 @@ static int usb_tablet_initfn(USBDevice *dev)
         dev->usb_desc = &desc_tablet2;
         break;
     default:
-        error_report("Invalid usb version %d for usb-tabler (must be 1 or 2)",
-                     us->usb_version);
-        return -1;
+        error_setg(errp, "Invalid usb version %d for usb-tablet "
+                   "(must be 1 or 2)", us->usb_version);
+        return;
     }
 
-    return usb_hid_initfn(dev, HID_TABLET);
+    usb_hid_initfn(dev, HID_TABLET);
 }
 
-static int usb_mouse_initfn(USBDevice *dev)
+static void usb_mouse_realize(USBDevice *dev, Error **errp)
 {
-    return usb_hid_initfn(dev, HID_MOUSE);
+    usb_hid_initfn(dev, HID_MOUSE);
 }
 
-static int usb_keyboard_initfn(USBDevice *dev)
+static void usb_keyboard_realize(USBDevice *dev, Error **errp)
 {
-    return usb_hid_initfn(dev, HID_KEYBOARD);
+    usb_hid_initfn(dev, HID_KEYBOARD);
 }
 
 static int usb_ptr_post_load(void *opaque, int version_id)
@@ -669,7 +668,7 @@ static void usb_tablet_class_initfn(ObjectClass *klass, void *data)
     USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
 
     usb_hid_class_initfn(klass, data);
-    uc->init           = usb_tablet_initfn;
+    uc->realize        = usb_tablet_realize;
     uc->product_desc   = "QEMU USB Tablet";
     dc->vmsd = &vmstate_usb_ptr;
     dc->props = usb_tablet_properties;
@@ -689,7 +688,7 @@ static void usb_mouse_class_initfn(ObjectClass *klass, void *data)
     USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
 
     usb_hid_class_initfn(klass, data);
-    uc->init           = usb_mouse_initfn;
+    uc->realize        = usb_mouse_realize;
     uc->product_desc   = "QEMU USB Mouse";
     uc->usb_desc       = &desc_mouse;
     dc->vmsd = &vmstate_usb_ptr;
@@ -714,7 +713,7 @@ static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
     USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
 
     usb_hid_class_initfn(klass, data);
-    uc->init           = usb_keyboard_initfn;
+    uc->realize        = usb_keyboard_realize;
     uc->product_desc   = "QEMU USB Keyboard";
     uc->usb_desc       = &desc_keyboard;
     dc->vmsd = &vmstate_usb_kbd;
-- 
1.8.3.1

  parent reply	other threads:[~2014-09-23 12:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 12:13 [Qemu-devel] [PULL 00/26] usb patch queue Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 01/26] usb-storage: Fix how legacy init handles option ID clash Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 02/26] usb-storage: fix possible memory leak and missing error message Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 03/26] ohci: Convert fprint/DPRINTF/print to traces Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 04/26] usb-bus: convert USBDeviceClass init to realize Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 05/26] usb-net: convert " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 06/26] libusb: " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 07/26] libusb: using error_report instead of fprintf Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 08/26] usb-hub: convert init to realize Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 09/26] dev-storage: " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 10/26] dev-storage: usring error_report instead of fprintf/printf Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 11/26] dev-uas: convert init to realize Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 12/26] dev-uas: using error_report instead of fprintf Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 13/26] dev-bluetooth: convert init to realize Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 14/26] dev-serial: " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 15/26] usb-ccid: " Gerd Hoffmann
2014-09-23 12:13 ` Gerd Hoffmann [this message]
2014-09-23 12:13 ` [Qemu-devel] [PULL 17/26] dev-wacom: " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 18/26] usb-audio: " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 19/26] usb-redir: " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 20/26] usb-mtp: " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 21/26] usb-bus: remove "init" from USBDeviceClass struct Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 22/26] usb-bus: introduce a wrapper function to check speed Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 23/26] usb-serial: only check speed once at realize time Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 24/26] usb: tag xhci as hotpluggable Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 25/26] usb: tag standalone uhci " Gerd Hoffmann
2014-09-23 12:13 ` [Qemu-devel] [PULL 26/26] usb: tag standalone ehci " Gerd Hoffmann
2014-09-23 15:56 ` [Qemu-devel] [PULL 00/26] usb patch queue Peter Maydell

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=1411474417-9704-17-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).