qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 041/197] add class_init to deviceinfo


From: Anthony Liguori
Subject: [Qemu-devel] [PATCH v3 041/197] add class_init to deviceinfo
Date: Mon, 12 Dec 2011 14:18:37 -0600

---
 hw/ccid.h |    2 +-
 hw/qdev.c |    4 ++++
 hw/qdev.h |    5 +++++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/hw/ccid.h b/hw/ccid.h
index ad055d3..d8e0485 100644
--- a/hw/ccid.h
+++ b/hw/ccid.h
@@ -17,7 +17,7 @@ typedef struct CCIDCardInfo CCIDCardInfo;
 
 #define TYPE_CCID_CARD "ccid-card"
 #define CCID_CARD(obj) \
-     OBJECT_CHECK(CCIDCard, (obj), TYPE_CCID_CARD)
+     OBJECT_CHECK(CCIDCardState, (obj), TYPE_CCID_CARD)
 #define CCID_CARD_CLASS(klass) \
      OBJECT_CLASS_CHECK(CCIDCardClass, (klass), TYPE_CCID_CARD)
 #define CCID_CARD_GET_CLASS(obj) \
diff --git a/hw/qdev.c b/hw/qdev.c
index 09f8b4c..d062470 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -54,6 +54,10 @@ static void qdev_subclass_init(ObjectClass *klass, void 
*data)
 
     /* Poison to try to detect future uses */
     dc->info->reset = NULL;
+
+    if (dc->info->class_init) {
+        dc->info->class_init(klass, data);
+    }
 }
 
 DeviceInfo *qdev_get_info(DeviceState *dev)
diff --git a/hw/qdev.h b/hw/qdev.h
index aab8f42..6617a2b 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -225,6 +225,11 @@ struct DeviceInfo {
     /* device state */
     const VMStateDescription *vmsd;
 
+    /**
+     * See @TypeInfo::class_init()
+     */
+    void (*class_init)(ObjectClass *klass, void *data);
+
     /* Private to qdev / bus.  */
     qdev_initfn init;
     qdev_event unplug;
-- 
1.7.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]