Re: [PATCH v2 03/10] qdev: Introduce DEFINE_PROP_*_NODEFAULT for bool/uint32

Mark Cave-Ayland <[email protected]> Wed, 10 Jun 2026 16:25:25 +0100
Newsgroups org.nongnu.qemu-rust,org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 09/06/2026 18:25, Peter Xu wrote:

> Introduce two macros that will be used in follow up patch to create qdev
> bool or uint32 properties without a default value.  Do not introduce the
> rest until they can be used.
> 
> Signed-off-by: Peter Xu <[email protected]>
> ---
>   include/hw/core/qdev-properties.h | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-properties.h
> index 248bbcbba7..43878d1f9e 100644
> --- a/include/hw/core/qdev-properties.h
> +++ b/include/hw/core/qdev-properties.h
> @@ -124,6 +124,9 @@ extern const PropertyInfo qdev_prop_link;
>                   .set_default = true,                         \
>                   .defval.u    = (bool)_defval)
>   
> +#define DEFINE_PROP_BOOL_NODEFAULT(_name, _state, _field)     \
> +    DEFINE_PROP(_name, _state, _field, qdev_prop_bool, bool)
> +
>   /**
>    * The DEFINE_PROP_UINT64_CHECKMASK macro checks a user-supplied value
>    * against corresponding bitmask, rejects the value if it violates.
> @@ -201,6 +204,8 @@ extern const PropertyInfo qdev_prop_link;
>       DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint16, uint16_t)
>   #define DEFINE_PROP_UINT32(_n, _s, _f, _d)                      \
>       DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint32, uint32_t)
> +#define DEFINE_PROP_UINT32_NODEFAULT(_n, _s, _f)                        \
> +    DEFINE_PROP_UNSIGNED_NODEFAULT(_n, _s, _f, qdev_prop_uint32, uint32_t)
>   #define DEFINE_PROP_INT32(_n, _s, _f, _d)                      \
>       DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t)
>   #define DEFINE_PROP_UINT64(_n, _s, _f, _d)                      \

I think it's worth mentioning in the commit message that this extends 
the existing set of _NODEFAULT() macros, since I had to go and check to 
see if this was something completely new being introduced by the patch 
(it's not something I was familiar with, and we don't appear to mention 
them in our docs!).

Anyhow it seems correct, so:

Reviewed-by: Mark Cave-Ayland <[email protected]>


ATB,

Mark.