[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 51/53] qdev: Remove DeviceClass::init() and ::exit()
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 51/53] qdev: Remove DeviceClass::init() and ::exit() |
Date: |
Thu, 31 May 2018 19:16:04 +0200 |
From: Philippe Mathieu-Daudé <address@hidden>
Since no devices use it, we can safely remove it.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
[Removal of DeviceClass::init() moved from previous patch, missing
documentation updates supplied]
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/core/qdev.c | 28 ----------------------------
include/hw/qdev-core.h | 20 ++++----------------
2 files changed, 4 insertions(+), 44 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index f6f92473b8..ffec461791 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -208,32 +208,6 @@ void device_listener_unregister(DeviceListener *listener)
QTAILQ_REMOVE(&device_listeners, listener, link);
}
-static void device_realize(DeviceState *dev, Error **errp)
-{
- DeviceClass *dc = DEVICE_GET_CLASS(dev);
-
- if (dc->init) {
- int rc = dc->init(dev);
- if (rc < 0) {
- error_setg(errp, "Device initialization failed.");
- return;
- }
- }
-}
-
-static void device_unrealize(DeviceState *dev, Error **errp)
-{
- DeviceClass *dc = DEVICE_GET_CLASS(dev);
-
- if (dc->exit) {
- int rc = dc->exit(dev);
- if (rc < 0) {
- error_setg(errp, "Device exit failed.");
- return;
- }
- }
-}
-
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
int required_for_version)
{
@@ -1065,8 +1039,6 @@ static void device_class_init(ObjectClass *class, void
*data)
DeviceClass *dc = DEVICE_CLASS(class);
class->unparent = device_unparent;
- dc->realize = device_realize;
- dc->unrealize = device_unrealize;
/* by default all devices were considered as hotpluggable,
* so with intent to check it in generic qdev_unplug() /
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 9453588160..f1fd0f8736 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -29,8 +29,6 @@ typedef enum DeviceCategory {
DEVICE_CATEGORY_MAX
} DeviceCategory;
-typedef int (*qdev_initfn)(DeviceState *dev);
-typedef int (*qdev_event)(DeviceState *dev);
typedef void (*DeviceRealize)(DeviceState *dev, Error **errp);
typedef void (*DeviceUnrealize)(DeviceState *dev, Error **errp);
typedef void (*DeviceReset)(DeviceState *dev);
@@ -43,13 +41,9 @@ struct VMStateDescription;
* DeviceClass:
* @props: Properties accessing state fields.
* @realize: Callback function invoked when the #DeviceState:realized
- * property is changed to %true. The default invokes @init if not %NULL.
+ * property is changed to %true.
* @unrealize: Callback function invoked when the #DeviceState:realized
* property is changed to %false.
- * @init: Callback function invoked when the #DeviceState::realized property
- * is changed to %true. Deprecated, new types inheriting directly from
- * TYPE_DEVICE should use @realize instead, new leaf types should consult
- * their respective parent type.
* @hotpluggable: indicates if #DeviceClass is hotpluggable, available
* as readonly "hotpluggable" property of #DeviceState instance
*
@@ -73,19 +67,15 @@ struct VMStateDescription;
* object_initialize() in their own #TypeInfo.instance_init and forward the
* realization events appropriately.
*
- * The @init callback is considered private to a particular bus implementation
- * (immediate abstract child types of TYPE_DEVICE). Derived leaf types set an
- * "init" callback on their parent class instead.
- *
* Any type may override the @realize and/or @unrealize callbacks but needs
* to call the parent type's implementation if keeping their functionality
* is desired. Refer to QOM documentation for further discussion and examples.
*
* <note>
* <para>
- * If a type derived directly from TYPE_DEVICE implements @realize, it does
- * not need to implement @init and therefore does not need to store and call
- * #DeviceClass' default @realize callback.
+ * Since TYPE_DEVICE doesn't implement @realize and @unrealize, types
+ * derived directly from it need not call their parent's @realize and
+ * @unrealize.
* For other types consult the documentation and implementation of the
* respective parent types.
* </para>
@@ -124,8 +114,6 @@ typedef struct DeviceClass {
const struct VMStateDescription *vmsd;
/* Private to qdev / bus. */
- qdev_initfn init; /* TODO remove, once users are converted to realize */
- qdev_event exit; /* TODO remove, once users are converted to unrealize */
const char *bus_type;
} DeviceClass;
--
2.17.0
- [Qemu-devel] [PULL 39/53] ipmi: Use proper struct reference for KCS vmstate, (continued)
- [Qemu-devel] [PULL 39/53] ipmi: Use proper struct reference for KCS vmstate, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 43/53] scripts/update-linux-headers: Handle __aligned_u64, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 41/53] gdbstub: Prevent fd leakage, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 45/53] target/i386/kvm.c: Handle renaming of KVM_HINTS_DEDICATED, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 40/53] docs/interop: add "firmware.json", Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 44/53] scripts/update-linux-headers: Handle kernel license no longer being one file, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 47/53] target/i386/kvm.c: Remove compatibility shim for KVM_HINTS_REALTIME, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 42/53] virtio-gpu-3d: Define VIRTIO_GPU_CAPSET_VIRGL2 elsewhere, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 48/53] hw/i2c/smbus: Use DeviceClass::realize instead of SMBusDeviceClass::init, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 52/53] char: Remove unwanted crlf conversion, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 51/53] qdev: Remove DeviceClass::init() and ::exit(),
Paolo Bonzini <=
- [Qemu-devel] [PULL 53/53] memory: Make operations using MemoryRegionIoeventfd struct pass by pointer., Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 49/53] hw/i2c: Use DeviceClass::realize instead of I2CSlaveClass::init, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 50/53] qdev: Simplify the SysBusDeviceClass::init path, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 46/53] Update Linux headers to 4.17-rc6, Paolo Bonzini, 2018/05/31
- [Qemu-devel] [PULL 37/53] tcg: remove softfloat from --disable-tcg builds, Paolo Bonzini, 2018/05/31
- Re: [Qemu-devel] [PULL 00/53] Misc patches for 2018-05-31, Peter Maydell, 2018/05/31