[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/12] can_host: Use class properties
From: |
Eduardo Habkost |
Subject: |
[PATCH 06/12] can_host: Use class properties |
Date: |
Fri, 9 Oct 2020 12:01:16 -0400 |
Instance properties make introspection hard and are not shown by
"-object ...,help". Convert them to class properties.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Cc: Vikram Garhwal <fnu.vikram@xilinx.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org
---
net/can/can_host.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/net/can/can_host.c b/net/can/can_host.c
index be4547d913..bec88b9620 100644
--- a/net/can/can_host.c
+++ b/net/can/can_host.c
@@ -72,21 +72,16 @@ static void can_host_complete(UserCreatable *uc, Error
**errp)
can_host_connect(CAN_HOST(uc), errp);
}
-static void can_host_instance_init(Object *obj)
-{
- CanHostState *ch = CAN_HOST(obj);
-
- object_property_add_link(obj, "canbus", TYPE_CAN_BUS,
- (Object **)&ch->bus,
- object_property_allow_set_link,
- OBJ_PROP_LINK_STRONG);
-}
-
static void can_host_class_init(ObjectClass *klass,
void *class_data G_GNUC_UNUSED)
{
UserCreatableClass *uc_klass = USER_CREATABLE_CLASS(klass);
+ object_class_property_add_link(klass, "canbus", TYPE_CAN_BUS,
+ offsetof(CanHostState, bus),
+ object_property_allow_set_link,
+ OBJ_PROP_LINK_STRONG);
+
klass->unparent = can_host_unparent;
uc_klass->complete = can_host_complete;
}
@@ -97,7 +92,6 @@ static const TypeInfo can_host_info = {
.instance_size = sizeof(CanHostState),
.class_size = sizeof(CanHostClass),
.abstract = true,
- .instance_init = can_host_instance_init,
.class_init = can_host_class_init,
.interfaces = (InterfaceInfo[]) {
{ TYPE_USER_CREATABLE },
--
2.26.2
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, (continued)
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Igor Mammedov, 2020/10/21
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Igor Mammedov, 2020/10/23
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Eduardo Habkost, 2020/10/27
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Paolo Bonzini, 2020/10/28
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Igor Mammedov, 2020/10/28
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Eduardo Habkost, 2020/10/29
- Re: [PATCH 03/12] qom: Make object_class_property_add_uint*_ptr() get offset, Igor Mammedov, 2020/10/29
[PATCH 06/12] can_host: Use class properties,
Eduardo Habkost <=
[PATCH 05/12] rng: Use class properties, Eduardo Habkost, 2020/10/09
[PATCH 07/12] colo: Use class properties, Eduardo Habkost, 2020/10/09
[PATCH 09/12] netfilter: Use class properties, Eduardo Habkost, 2020/10/09
[PATCH 10/12] input: Use class properties, Eduardo Habkost, 2020/10/09
[PATCH 08/12] netfilter: Reorder functions, Eduardo Habkost, 2020/10/09
[PATCH 12/12] [RFC] qom: Lock properties of all TYPE_USER_CREATABLE types, Eduardo Habkost, 2020/10/09
[PATCH 11/12] [RFC] qom: Property lock mechanism, Eduardo Habkost, 2020/10/09