qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 01/23] usb-hid: simplify class initialization a bit
@ 2012-01-30 21:08 Anthony Liguori
  2012-01-30 21:08 ` [Qemu-devel] [PATCH 03/23] qdev: make DeviceInfo private Anthony Liguori
                   ` (21 more replies)
  0 siblings, 22 replies; 45+ messages in thread
From: Anthony Liguori @ 2012-01-30 21:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Andreas Faerber, Anthony Liguori, Peter Maydell

We can probably model USBHidDevice as a base class to get even better code
sharing but for now, just use a common function to initialize the common class
members.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/usb-hid.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 88fdd35..4af27a2 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -553,13 +553,10 @@ static const VMStateDescription vmstate_usb_kbd = {
     }
 };
 
-static void usb_tablet_class_initfn(ObjectClass *klass, void *data)
+static void usb_hid_class_initfn(ObjectClass *klass, void *data)
 {
     USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
 
-    uc->init           = usb_tablet_initfn;
-    uc->product_desc   = "QEMU USB Tablet";
-    uc->usb_desc       = &desc_tablet;
     uc->handle_packet  = usb_generic_handle_packet;
     uc->handle_reset   = usb_hid_handle_reset;
     uc->handle_control = usb_hid_handle_control;
@@ -567,6 +564,16 @@ static void usb_tablet_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_hid_handle_destroy;
 }
 
+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->product_desc   = "QEMU USB Tablet";
+    uc->usb_desc       = &desc_tablet;
+}
+
 static struct DeviceInfo usb_tablet_info = {
     .name      = "usb-tablet",
     .size      = sizeof(USBHIDState),
@@ -578,14 +585,10 @@ 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->product_desc   = "QEMU USB Mouse";
     uc->usb_desc       = &desc_mouse;
-    uc->handle_packet  = usb_generic_handle_packet;
-    uc->handle_reset   = usb_hid_handle_reset;
-    uc->handle_control = usb_hid_handle_control;
-    uc->handle_data    = usb_hid_handle_data;
-    uc->handle_destroy = usb_hid_handle_destroy;
 }
 
 static struct DeviceInfo usb_mouse_info = {
@@ -599,14 +602,10 @@ 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->product_desc   = "QEMU USB Keyboard";
     uc->usb_desc       = &desc_keyboard;
-    uc->handle_packet  = usb_generic_handle_packet;
-    uc->handle_reset   = usb_hid_handle_reset;
-    uc->handle_control = usb_hid_handle_control;
-    uc->handle_data    = usb_hid_handle_data;
-    uc->handle_destroy = usb_hid_handle_destroy;
 }
 
 static struct DeviceInfo usb_keyboard_info = {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2012-02-01 20:33 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-30 21:08 [Qemu-devel] [PATCH 01/23] usb-hid: simplify class initialization a bit Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 03/23] qdev: make DeviceInfo private Anthony Liguori
2012-01-30 22:31   ` Andreas Färber
2012-01-30 21:08 ` [Qemu-devel] [PATCH 04/23] qdev: remove info from class Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 05/23] qdev: allow classes to overload qdev functions Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 06/23] qdev: refactor device creation to allow bus_info to be set only in class Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 07/23] qdev: kill off DeviceInfo list Anthony Liguori
2012-01-31 13:51   ` Andreas Färber
2012-01-30 21:08 ` [Qemu-devel] [PATCH 08/23] qdev: register all types natively through QEMU Object Model Anthony Liguori
2012-01-30 22:29   ` Peter Maydell
2012-01-30 22:43     ` Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 09/23] qdev: kill of DeviceInfo Anthony Liguori
2012-01-31 13:34   ` Andreas Färber
2012-02-01 19:46   ` Peter Maydell
2012-02-01 19:56     ` Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 10/23] qdev: remove baked in notion of aliases Anthony Liguori
2012-01-31  7:44   ` Paolo Bonzini
2012-01-30 21:08 ` [Qemu-devel] [PATCH 11/23] qom: allow object_class_foreach to take additional parameters to refine search Anthony Liguori
2012-01-31 13:42   ` Andreas Färber
2012-01-30 21:08 ` [Qemu-devel] [PATCH 12/23] qom: add new command to search for types Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 13/23] qdev: split out common init to instance_init Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 14/23] qdev: refactor away qdev_create_from_info Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 15/23] qdev: split out UI portions into a new function Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 16/23] qdev: nuke qdev_init_chardev() Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 17/23] qom: move properties from qdev to object Anthony Liguori
2012-01-31  7:46   ` Paolo Bonzini
2012-02-01 20:01     ` Anthony Liguori
2012-02-01 20:33       ` Paolo Bonzini
2012-01-30 21:08 ` [Qemu-devel] [PATCH 18/23] qom: accept any compatible type when setting a link property Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 19/23] qdev: implement cleanup logic in finalize Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 20/23] info qdm: do not require a parent_bus to be set Anthony Liguori
2012-01-30 21:08 ` [Qemu-devel] [PATCH 21/23] object: sure up reference counting Anthony Liguori
2012-01-31  7:49   ` Paolo Bonzini
2012-02-01 19:47   ` Peter Maydell
2012-02-01 19:55     ` Anthony Liguori
2012-01-30 21:09 ` [Qemu-devel] [PATCH 22/23] container: make a decendent of Object Anthony Liguori
2012-01-31  7:50   ` Paolo Bonzini
2012-01-31  9:21     ` Andreas Färber
2012-01-31  9:31       ` Paolo Bonzini
2012-02-01 19:48   ` Peter Maydell
2012-01-30 21:09 ` [Qemu-devel] [PATCH 23/23] not-for-upstream: fix device_del Anthony Liguori
2012-01-30 21:16 ` [Qemu-devel] [PATCH 00/23] qom: use Type system to register all devices Anthony Liguori
2012-01-30 22:46   ` Anthony Liguori
2012-02-01 19:55   ` Peter Maydell
2012-02-01 20:10     ` Anthony Liguori

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).