Message ID | 20200921221045.699690-3-ehabkost@redhat.com |
---|---|
State | New |
Headers | show |
Series | qom: Convert some properties to class properties | expand |
> -----Original Message----- > From: Eduardo Habkost [mailto:ehabkost@redhat.com] > Sent: Tuesday, September 22, 2020 6:10 AM > To: qemu-devel@nongnu.org > Cc: Paolo Bonzini <pbonzini@redhat.com>; Daniel P. Berrange > <berrange@redhat.com>; John Snow <jsnow@redhat.com>; Gonglei (Arei) > <arei.gonglei@huawei.com> > Subject: [PATCH 02/24] cryptodev-backend: 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> > --- > Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com> > Cc: qemu-devel@nongnu.org > --- > backends/cryptodev.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > Reviewed-by: Gonglei <arei.gonglei@huawei.com> Regards, -Gonglei > diff --git a/backends/cryptodev.c b/backends/cryptodev.c index > ada4ebe78b1..3f141f61ed6 100644 > --- a/backends/cryptodev.c > +++ b/backends/cryptodev.c > @@ -206,10 +206,6 @@ cryptodev_backend_can_be_deleted(UserCreatable > *uc) > > static void cryptodev_backend_instance_init(Object *obj) { > - object_property_add(obj, "queues", "uint32", > - cryptodev_backend_get_queues, > - cryptodev_backend_set_queues, > - NULL, NULL); > /* Initialize devices' queues property to 1 */ > object_property_set_int(obj, "queues", 1, NULL); } @@ -230,6 +226,10 > @@ cryptodev_backend_class_init(ObjectClass *oc, void *data) > ucc->can_be_deleted = cryptodev_backend_can_be_deleted; > > QTAILQ_INIT(&crypto_clients); > + object_class_property_add(oc, "queues", "uint32", > + cryptodev_backend_get_queues, > + cryptodev_backend_set_queues, > + NULL, NULL); > } > > static const TypeInfo cryptodev_backend_info = { > -- > 2.26.2
diff --git a/backends/cryptodev.c b/backends/cryptodev.c index ada4ebe78b1..3f141f61ed6 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -206,10 +206,6 @@ cryptodev_backend_can_be_deleted(UserCreatable *uc) static void cryptodev_backend_instance_init(Object *obj) { - object_property_add(obj, "queues", "uint32", - cryptodev_backend_get_queues, - cryptodev_backend_set_queues, - NULL, NULL); /* Initialize devices' queues property to 1 */ object_property_set_int(obj, "queues", 1, NULL); } @@ -230,6 +226,10 @@ cryptodev_backend_class_init(ObjectClass *oc, void *data) ucc->can_be_deleted = cryptodev_backend_can_be_deleted; QTAILQ_INIT(&crypto_clients); + object_class_property_add(oc, "queues", "uint32", + cryptodev_backend_get_queues, + cryptodev_backend_set_queues, + NULL, NULL); } static const TypeInfo cryptodev_backend_info = {
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> --- Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com> Cc: qemu-devel@nongnu.org --- backends/cryptodev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)