qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/11] qdev: Add qdev_prop_set_array()


From: Peter Maydell
Subject: Re: [PATCH 01/11] qdev: Add qdev_prop_set_array()
Date: Fri, 27 Oct 2023 19:06:05 +0100

On Fri, 8 Sept 2023 at 15:37, Kevin Wolf <kwolf@redhat.com> wrote:
>
> Instead of exposing the ugly hack of how we represent arrays in qdev (a
> static "foo-len" property and after it is set, dynamically created
> "foo[i]" properties) to boards, add an interface that allows setting the
> whole array at once.
>
> Once all internal users of devices with array properties have been
> converted to use this function, we can change the implementation to move
> away from this hack.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  include/hw/qdev-properties.h |  3 +++
>  hw/core/qdev-properties.c    | 21 +++++++++++++++++++++
>  2 files changed, 24 insertions(+)
>
> diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
> index e1df08876c..7fa2fdb7c9 100644
> --- a/include/hw/qdev-properties.h
> +++ b/include/hw/qdev-properties.h
> @@ -206,6 +206,9 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char 
> *name,
>                             const uint8_t *value);
>  void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
>
> +/* Takes ownership of @values */
> +void qdev_prop_set_array(DeviceState *dev, const char *name, QList *values);
> +
>  void *object_field_prop_ptr(Object *obj, Property *prop);

Are we happy enough with this interface that I can take this single
patch in a series that I'm doing (v2 of
20231017122302.1692902-1-peter.maydell@linaro.org/">https://patchew.org/QEMU/20231017122302.1692902-1-peter.maydell@linaro.org/
"arm/stellaris: convert gamepad input device to qdev"), or should
I stick to the old style "set length and element properties by hand"
code until this whole series has passed patch review (thus giving
you another item to add to the conversion list) ? I went for "include
this patch" in v1, but this series has spent longer in code review
than I was anticipating at that point.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]