summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-21 18:10:22 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-22 16:46:09 -0400
commit07b0db0efbd3b37c5d44e846e74d26b7495637e6 (patch)
tree438f04e8fe52208852fe032525179a05379a9f6f
parentc4332cd1dcf2964c23893ab4c0bf8d774e42a3cf (diff)
downloadfocaccia-qemu-07b0db0efbd3b37c5d44e846e74d26b7495637e6.tar.gz
focaccia-qemu-07b0db0efbd3b37c5d44e846e74d26b7495637e6.zip
cryptodev-vhost-user: Register "chardev" as class property
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <20200921221045.699690-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to '')
-rw-r--r--backends/cryptodev-vhost-user.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index 60ec4908aa..e1df073de2 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -334,13 +334,6 @@ cryptodev_vhost_user_get_chardev(Object *obj, Error **errp)
     return NULL;
 }
 
-static void cryptodev_vhost_user_instance_int(Object *obj)
-{
-    object_property_add_str(obj, "chardev",
-                            cryptodev_vhost_user_get_chardev,
-                            cryptodev_vhost_user_set_chardev);
-}
-
 static void cryptodev_vhost_user_finalize(Object *obj)
 {
     CryptoDevBackendVhostUser *s =
@@ -361,13 +354,17 @@ cryptodev_vhost_user_class_init(ObjectClass *oc, void *data)
     bc->create_session = cryptodev_vhost_user_sym_create_session;
     bc->close_session = cryptodev_vhost_user_sym_close_session;
     bc->do_sym_op = NULL;
+
+    object_class_property_add_str(oc, "chardev",
+                                  cryptodev_vhost_user_get_chardev,
+                                  cryptodev_vhost_user_set_chardev);
+
 }
 
 static const TypeInfo cryptodev_vhost_user_info = {
     .name = TYPE_CRYPTODEV_BACKEND_VHOST_USER,
     .parent = TYPE_CRYPTODEV_BACKEND,
     .class_init = cryptodev_vhost_user_class_init,
-    .instance_init = cryptodev_vhost_user_instance_int,
     .instance_finalize = cryptodev_vhost_user_finalize,
     .instance_size = sizeof(CryptoDevBackendVhostUser),
 };