[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 08/12] can_host: Use class properties
From: |
Pavel Pisa |
Subject: |
Re: [PATCH v2 08/12] can_host: Use class properties |
Date: |
Thu, 12 Nov 2020 00:02:01 +0100 |
User-agent: |
KMail/1.9.10 |
Hello Eduardo,
thanks for contribution.
On Wednesday 11 of November 2020 19:38:19 Eduardo Habkost wrote:
> 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>
> ---
> This was originally submitted as part of the series:
> Subject: [PATCH 00/12] qom: Make all -object types use only class
> properties Message-Id: <20201009160122.1662082-1-ehabkost@redhat.com>
> https://lore.kernel.org/qemu-devel/20201009160122.1662082-1-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 },
I have rerun successfully my basic test (1x SJA1000 CAN FD tolerant, 2x CTU
CAN FD and 1x host interface) based on actual updated sources
with Peter Maydell coverity fixes. You can add my
Tested-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
I cannot confirm that this is the right direction because I do not have
knowledge about long term intentions of core developers. But change
and description look good.
Somebody with a commit rights need to push patch to the mainline direction.
Best wishes,
Pavel Pisa
- Re: [PATCH v2 02/12] vexpress-a15: Register "virtualization" as class property, (continued)
- [PATCH v2 04/12] i386: Register feature bit properties as class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 06/12] virt: Register "its" as class property, Eduardo Habkost, 2020/11/11
- [PATCH v2 07/12] arm/cpu64: Register "aarch64" as class property, Eduardo Habkost, 2020/11/11
- [PATCH v2 09/12] colo: Use class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 10/12] netfilter: Reorder functions, Eduardo Habkost, 2020/11/11
- [PATCH v2 08/12] can_host: Use class properties, Eduardo Habkost, 2020/11/11
- Re: [PATCH v2 08/12] can_host: Use class properties,
Pavel Pisa <=
- [PATCH v2 11/12] netfilter: Use class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 12/12] input: Use class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 05/12] arm/virt: Register most properties as class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 01/12] vexpress: Register "secure" as class property, Eduardo Habkost, 2020/11/11