[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/27] qdev: add a interface to register subclasses
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 07/27] qdev: add a interface to register subclasses |
Date: |
Tue, 20 Dec 2011 10:51:36 -0600 |
In order to introduce inheritance while still using the qdev registration
interfaces, we need to be able to use a parent other than TYPE_DEVICE. Add a
new interface that allows this.
Signed-off-by: Anthony Liguori <address@hidden>
---
hw/qdev.c | 9 +++++++--
hw/qdev.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index 3a7c98f..40ca081 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -61,7 +61,7 @@ DeviceInfo *qdev_get_info(DeviceState *dev)
return DEVICE_GET_CLASS(dev)->info;
}
-void qdev_register(DeviceInfo *info)
+void qdev_register_subclass(DeviceInfo *info, const char *parent)
{
TypeInfo type_info = {};
@@ -69,7 +69,7 @@ void qdev_register(DeviceInfo *info)
assert(!info->next);
type_info.name = info->name;
- type_info.parent = TYPE_DEVICE;
+ type_info.parent = parent;
type_info.instance_size = info->size;
type_info.class_init = qdev_subclass_init;
type_info.class_data = info;
@@ -80,6 +80,11 @@ void qdev_register(DeviceInfo *info)
device_info_list = info;
}
+void qdev_register(DeviceInfo *info)
+{
+ qdev_register_subclass(info, TYPE_DEVICE);
+}
+
static DeviceInfo *qdev_find_info(BusInfo *bus_info, const char *name)
{
DeviceInfo *info;
diff --git a/hw/qdev.h b/hw/qdev.h
index c1fcf28..c366174 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -240,6 +240,7 @@ struct DeviceInfo {
extern DeviceInfo *device_info_list;
void qdev_register(DeviceInfo *info);
+void qdev_register_subclass(DeviceInfo *info, const char *parent);
/* Register device properties. */
/* GPIO inputs also double as IRQ sinks. */
--
1.7.4.1
- Re: [Qemu-devel] [PATCH 01/27] qom: add the base Object class, (continued)
- Re: [Qemu-devel] [PATCH 01/27] qom: add the base Object class, Paolo Bonzini, 2011/12/21
- Re: [Qemu-devel] [PATCH 01/27] qom: add the base Object class, Anthony Liguori, 2011/12/21
- Re: [Qemu-devel] [PATCH 01/27] qom: add the base Object class, Paolo Bonzini, 2011/12/21
- Re: [Qemu-devel] [PATCH 01/27] qom: add the base Object class, Kevin O'Connor, 2011/12/22
- Re: [Qemu-devel] [PATCH 01/27] qom: add the base Object class, Anthony Liguori, 2011/12/22
- Re: [Qemu-devel] [PATCH 01/27] qom: add the base Object class, Kevin O'Connor, 2011/12/22
[Qemu-devel] [PATCH 03/27] qdev: move qdev->info to class, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 06/27] pci: check for an initialized QOM object instead of looking for an info link, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 04/27] qdev: don't access name through info, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 08/27] qdev: add class_init to DeviceInfo, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 07/27] qdev: add a interface to register subclasses,
Anthony Liguori <=
[Qemu-devel] [PATCH 10/27] not-for-upstream: disable non-qdev pci devices, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 11/27] isa: convert to QEMU Object Model, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 13/27] ccid: convert to QEMU Object Model, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 09/27] qdev: prepare source tree for code conversion, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 12/27] usb: convert to QEMU Object Model, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 14/27] ssi: convert to QEMU Object Model, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 15/27] i2c: rename i2c_slave -> I2CSlave, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 17/27] hda-codec: convert to QEMU Object Model, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 19/27] scsi: convert to QEMU Object Model, Anthony Liguori, 2011/12/20
[Qemu-devel] [PATCH 26/27] pci: convert to QEMU Object Model, Anthony Liguori, 2011/12/20