>From void user_creatable_complete(Object *obj, Error **errp)
to   void user_creatable_complete(UserCreatable *uc, Error **errp)

Signed-off-by: Lin Ma <l...@suse.com>
---
 hw/block/dataplane/virtio-blk.c |  3 ++-
 hw/virtio/virtio-rng.c          |  2 +-
 include/qom/object_interfaces.h |  7 +++----
 qmp.c                           |  2 +-
 qom/object_interfaces.c         | 11 ++---------
 5 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index cd41478..2941574 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -188,7 +188,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, 
VirtIOBlkConf *conf,
         object_initialize(&s->internal_iothread_obj,
                           sizeof(s->internal_iothread_obj),
                           TYPE_IOTHREAD);
-        user_creatable_complete(OBJECT(&s->internal_iothread_obj), 
&error_abort);
+        user_creatable_complete(USER_CREATABLE(&s->internal_iothread_obj),
+                                &error_abort);
         s->iothread = &s->internal_iothread_obj;
     }
     s->ctx = iothread_get_aio_context(s->iothread);
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 06e7178..65afc9e 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -165,7 +165,7 @@ static void virtio_rng_device_realize(DeviceState *dev, 
Error **errp)
     if (vrng->conf.rng == NULL) {
         vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM));
 
-        user_creatable_complete(OBJECT(vrng->conf.default_backend),
+        user_creatable_complete(USER_CREATABLE(vrng->conf.default_backend),
                                 &local_err);
         if (local_err) {
             error_propagate(errp, local_err);
diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index b792283..5e7fcb3 100644
--- a/include/qom/object_interfaces.h
+++ b/include/qom/object_interfaces.h
@@ -51,12 +51,11 @@ typedef struct UserCreatableClass {
 
 /**
  * user_creatable_complete:
- * @obj: the object whose complete() method is called if defined
+ * @uc: the object whose complete() method is called if defined
  * @errp: if an error occurs, a pointer to an area to store the error
  *
  * Wrapper to call complete() method if one of types it's inherited
- * from implements USER_CREATABLE interface, otherwise the call does
- * nothing.
+ * from implements USER_CREATABLE interface.
  */
-void user_creatable_complete(Object *obj, Error **errp);
+void user_creatable_complete(UserCreatable *uc, Error **errp);
 #endif
diff --git a/qmp.c b/qmp.c
index c479e77..b944507 100644
--- a/qmp.c
+++ b/qmp.c
@@ -656,7 +656,7 @@ void object_add(const char *type, const char *id, const 
QDict *qdict,
         goto out;
     }
 
-    user_creatable_complete(obj, &local_err);
+    user_creatable_complete(USER_CREATABLE(obj), &local_err);
     if (local_err) {
         object_property_del(container_get(object_get_root(), "/objects"),
                             id, &error_abort);
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 6360818..3aa26c7 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -1,18 +1,11 @@
 #include "qom/object_interfaces.h"
 #include "qemu/module.h"
 
-void user_creatable_complete(Object *obj, Error **errp)
+void user_creatable_complete(UserCreatable *uc, Error **errp)
 {
 
-    UserCreatableClass *ucc;
-    UserCreatable *uc =
-        (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE);
+    UserCreatableClass *ucc = USER_CREATABLE_GET_CLASS(uc);
 
-    if (!uc) {
-        return;
-    }
-
-    ucc = USER_CREATABLE_GET_CLASS(uc);
     if (ucc->complete) {
         ucc->complete(uc, errp);
     }
-- 
2.1.4


Reply via email to