[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/28] qdev: add class_init to DeviceInfo
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 10/28] qdev: add class_init to DeviceInfo |
Date: |
Tue, 24 Jan 2012 13:33:02 -0600 |
Since we are still dynamically creating TypeInfo, we need to chain the
class_init function in order to be able to make use of it within subclasses of
TYPE_DEVICE.
This will disappear once we register TypeInfos directly.
Signed-off-by: Anthony Liguori <address@hidden>
---
hw/qdev.c | 4 ++++
hw/qdev.h | 5 +++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index c4b5284..81996bb 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 48f80a5..c9572a5 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -231,6 +231,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
- [Qemu-devel] [PATCH 08/28] qdev: use a wrapper to access reset and promote reset to a class method, (continued)
- [Qemu-devel] [PATCH 08/28] qdev: use a wrapper to access reset and promote reset to a class method, Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 04/28] qom: add the base Object class (v2), Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 06/28] qdev: move qdev->info to class, Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 16/28] i2c: rename i2c_slave -> I2CSlave, Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 18/28] hda-codec: convert to QEMU Object Model, Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 05/28] qdev: integrate with QEMU Object Model (v2), Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 03/28] pci: call reset unconditionally, Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 14/28] ccid: convert to QEMU Object Model, Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 10/28] qdev: add class_init to DeviceInfo,
Anthony Liguori <=
- [Qemu-devel] [PATCH 13/28] usb: convert to QEMU Object Model, Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 22/28] virtio-serial: convert to QEMU Object Model, Anthony Liguori, 2012/01/24
- [Qemu-devel] [PATCH 15/28] ssi: convert to QEMU Object Model, Anthony Liguori, 2012/01/24
- Re: [Qemu-devel] [PATCH v3 0/28] qom: add QEMU Object Model type hierarchy to qdev, Peter Maydell, 2012/01/24
- Re: [Qemu-devel] [PATCH v3 0/28] qom: add QEMU Object Model type hierarchy to qdev, Blue Swirl, 2012/01/25