diff options
author | Andreas Färber <afaerber@suse.de> | 2013-01-09 03:58:10 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-01-15 18:26:30 -0600 |
commit | 7983c8a335dd09fec49f99a44d4404aa87828c0a (patch) | |
tree | c69919e4bfc2de020b0d9b12df47bfd8527aa50d /hw/qdev.c | |
parent | 2c9ee0291f8ca7e18f8e96a34e8f4be7867219d2 (diff) | |
download | qemu-7983c8a335dd09fec49f99a44d4404aa87828c0a.zip qemu-7983c8a335dd09fec49f99a44d4404aa87828c0a.tar.gz qemu-7983c8a335dd09fec49f99a44d4404aa87828c0a.tar.bz2 |
qdev: Fold state enum into bool realized
Whether the device was initialized or not is QOM-level information and
currently unused. Drop it from device. This leaves the boolean state of
whether or not DeviceClass::init was called or not, a.k.a. "realized".
Suggested-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r-- | hw/qdev.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -151,7 +151,7 @@ int qdev_init(DeviceState *dev) DeviceClass *dc = DEVICE_GET_CLASS(dev); int rc; - assert(dev->state == DEV_STATE_CREATED); + assert(!dev->realized); rc = dc->init(dev); if (rc < 0) { @@ -174,7 +174,7 @@ int qdev_init(DeviceState *dev) dev->instance_id_alias, dev->alias_required_for_version); } - dev->state = DEV_STATE_INITIALIZED; + dev->realized = true; if (dev->hotplugged) { device_reset(dev); } @@ -184,7 +184,7 @@ int qdev_init(DeviceState *dev) void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id, int required_for_version) { - assert(dev->state == DEV_STATE_CREATED); + assert(!dev->realized); dev->instance_id_alias = alias_id; dev->alias_required_for_version = required_for_version; } @@ -546,7 +546,7 @@ static void qdev_set_legacy_property(Object *obj, Visitor *v, void *opaque, char *ptr = NULL; int ret; - if (dev->state != DEV_STATE_CREATED) { + if (dev->realized) { error_set(errp, QERR_PERMISSION_DENIED); return; } @@ -653,7 +653,7 @@ static void device_initfn(Object *obj) } dev->instance_id_alias = -1; - dev->state = DEV_STATE_CREATED; + dev->realized = false; class = object_get_class(OBJECT(dev)); do { @@ -676,7 +676,7 @@ static void device_finalize(Object *obj) BusState *bus; DeviceClass *dc = DEVICE_GET_CLASS(dev); - if (dev->state == DEV_STATE_INITIALIZED) { + if (dev->realized) { while (dev->num_child_bus) { bus = QLIST_FIRST(&dev->child_bus); qbus_free(bus); |