[PATCH 06/24] hw/ppc: Only register spapr_nvdimm_properties if CONFIG_LIBPMEM

Richard Henderson posted 24 patches 1 year, 1 month ago
There is a newer version of this series
[PATCH 06/24] hw/ppc: Only register spapr_nvdimm_properties if CONFIG_LIBPMEM
Posted by Richard Henderson 1 year, 1 month ago
Do not register an empty set of properties.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/ppc/spapr_nvdimm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
index 2ef6f29f3d..6f875d73b2 100644
--- a/hw/ppc/spapr_nvdimm.c
+++ b/hw/ppc/spapr_nvdimm.c
@@ -884,22 +884,22 @@ static void spapr_nvdimm_unrealize(NVDIMMDevice *dimm)
     vmstate_unregister(NULL, &vmstate_spapr_nvdimm_states, dimm);
 }
 
-static const Property spapr_nvdimm_properties[] = {
 #ifdef CONFIG_LIBPMEM
+static const Property spapr_nvdimm_properties[] = {
     DEFINE_PROP_BOOL("pmem-override", SpaprNVDIMMDevice, pmem_override, false),
-#endif
-    DEFINE_PROP_END_OF_LIST(),
 };
+#endif
 
 static void spapr_nvdimm_class_init(ObjectClass *oc, void *data)
 {
-    DeviceClass *dc = DEVICE_CLASS(oc);
     NVDIMMClass *nvc = NVDIMM_CLASS(oc);
 
     nvc->realize = spapr_nvdimm_realize;
     nvc->unrealize = spapr_nvdimm_unrealize;
 
-    device_class_set_props(dc, spapr_nvdimm_properties);
+#ifdef CONFIG_LIBPMEM
+    device_class_set_props(DEVICE_CLASS(oc), spapr_nvdimm_properties);
+#endif
 }
 
 static void spapr_nvdimm_init(Object *obj)
-- 
2.43.0
Re: [PATCH 06/24] hw/ppc: Only register spapr_nvdimm_properties if CONFIG_LIBPMEM
Posted by BALATON Zoltan 1 year, 1 month ago
On Sun, 15 Dec 2024, Richard Henderson wrote:
> Do not register an empty set of properties.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> hw/ppc/spapr_nvdimm.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
> index 2ef6f29f3d..6f875d73b2 100644
> --- a/hw/ppc/spapr_nvdimm.c
> +++ b/hw/ppc/spapr_nvdimm.c
> @@ -884,22 +884,22 @@ static void spapr_nvdimm_unrealize(NVDIMMDevice *dimm)
>     vmstate_unregister(NULL, &vmstate_spapr_nvdimm_states, dimm);
> }
>
> -static const Property spapr_nvdimm_properties[] = {
> #ifdef CONFIG_LIBPMEM
> +static const Property spapr_nvdimm_properties[] = {
>     DEFINE_PROP_BOOL("pmem-override", SpaprNVDIMMDevice, pmem_override, false),
> -#endif
> -    DEFINE_PROP_END_OF_LIST(),

Is it too early to remove END_OF_LIST in this patch?

Regards,
BALATON Zoltan

> };
> +#endif
>
> static void spapr_nvdimm_class_init(ObjectClass *oc, void *data)
> {
> -    DeviceClass *dc = DEVICE_CLASS(oc);
>     NVDIMMClass *nvc = NVDIMM_CLASS(oc);
>
>     nvc->realize = spapr_nvdimm_realize;
>     nvc->unrealize = spapr_nvdimm_unrealize;
>
> -    device_class_set_props(dc, spapr_nvdimm_properties);
> +#ifdef CONFIG_LIBPMEM
> +    device_class_set_props(DEVICE_CLASS(oc), spapr_nvdimm_properties);
> +#endif
> }
>
> static void spapr_nvdimm_init(Object *obj)
>
Re: [PATCH 06/24] hw/ppc: Only register spapr_nvdimm_properties if CONFIG_LIBPMEM
Posted by Richard Henderson 1 year, 1 month ago
On 12/16/24 05:36, BALATON Zoltan wrote:
> On Sun, 15 Dec 2024, Richard Henderson wrote:
>> Do not register an empty set of properties.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>> hw/ppc/spapr_nvdimm.c | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
>> index 2ef6f29f3d..6f875d73b2 100644
>> --- a/hw/ppc/spapr_nvdimm.c
>> +++ b/hw/ppc/spapr_nvdimm.c
>> @@ -884,22 +884,22 @@ static void spapr_nvdimm_unrealize(NVDIMMDevice *dimm)
>>     vmstate_unregister(NULL, &vmstate_spapr_nvdimm_states, dimm);
>> }
>>
>> -static const Property spapr_nvdimm_properties[] = {
>> #ifdef CONFIG_LIBPMEM
>> +static const Property spapr_nvdimm_properties[] = {
>>     DEFINE_PROP_BOOL("pmem-override", SpaprNVDIMMDevice, pmem_override, false),
>> -#endif
>> -    DEFINE_PROP_END_OF_LIST(),
> 
> Is it too early to remove END_OF_LIST in this patch?

Yes.  I thought I'd fixed this when shuffling the patches around.
Ho hum.


r~