[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 14/19] dev-hid: convert init to realize
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v2 14/19] dev-hid: convert init to realize |
Date: |
Thu, 18 Sep 2014 20:47:22 +0800 |
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-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..05dc03b 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.7.12.4
- Re: [Qemu-devel] [PATCH v2 12/19] dev-serial: convert init to realize, (continued)
- Re: [Qemu-devel] [PATCH v2 12/19] dev-serial: convert init to realize, Gonglei (Arei), 2014/09/18
- Re: [Qemu-devel] [PATCH v2 12/19] dev-serial: convert init to realize, Paolo Bonzini, 2014/09/18
- Re: [Qemu-devel] [PATCH v2 12/19] dev-serial: convert init to realize, Gonglei (Arei), 2014/09/18
- Re: [Qemu-devel] [PATCH v2 12/19] dev-serial: convert init to realize, Paolo Bonzini, 2014/09/18
- Re: [Qemu-devel] [PATCH v2 12/19] dev-serial: convert init to realize, Gonglei (Arei), 2014/09/18
[Qemu-devel] [PATCH v2 13/19] usb-ccid: convert init to realize, arei.gonglei, 2014/09/18
[Qemu-devel] [PATCH v2 05/19] libusb: using error_report instead of fprintf, arei.gonglei, 2014/09/18
[Qemu-devel] [PATCH v2 15/19] dev-wacom: convert init to realize, arei.gonglei, 2014/09/18
[Qemu-devel] [PATCH v2 14/19] dev-hid: convert init to realize,
arei.gonglei <=
[Qemu-devel] [PATCH v2 16/19] usb-audio: convert init to realize, arei.gonglei, 2014/09/18
[Qemu-devel] [PATCH v2 19/19] usb-bus: remove "init" from USBDeviceClass struct, arei.gonglei, 2014/09/18
[Qemu-devel] [PATCH v2 18/19] usb-mtp: convert init to realize, arei.gonglei, 2014/09/18
[Qemu-devel] [PATCH v2 17/19] usb-redir: convert init to realize, arei.gonglei, 2014/09/18
Re: [Qemu-devel] [PATCH v2 00/19] usb: convert device init to realize, Paolo Bonzini, 2014/09/18
Re: [Qemu-devel] [PATCH v2 00/19] usb: convert device init to realize, Markus Armbruster, 2014/09/18
Re: [Qemu-devel] [PATCH v2 00/19] usb: convert device init to realize, Gerd Hoffmann, 2014/09/19