[PATCH v3 2/7] hw/isa/piix4: Use object_initialize_child() for embedded struct

Bernhard Beschow posted 7 patches 3 years, 8 months ago
There is a newer version of this series
[PATCH v3 2/7] hw/isa/piix4: Use object_initialize_child() for embedded struct
Posted by Bernhard Beschow 3 years, 8 months ago
Found-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/isa/piix4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 9a6d981037..1d04fb6a55 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -224,7 +224,7 @@ static void piix4_init(Object *obj)
 {
     PIIX4State *s = PIIX4_PCI_DEVICE(obj);
 
-    object_initialize(&s->rtc, sizeof(s->rtc), TYPE_MC146818_RTC);
+    object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC);
 }
 
 static void piix4_class_init(ObjectClass *klass, void *data)
-- 
2.36.1
Re: [PATCH v3 2/7] hw/isa/piix4: Use object_initialize_child() for embedded struct
Posted by Philippe Mathieu-Daudé via 3 years, 8 months ago
On 28/5/22 21:20, Bernhard Beschow wrote:
> Found-by: Peter Maydell <peter.maydell@linaro.org>

I suppose you refer to this thread:
https://lore.kernel.org/qemu-devel/CAFEAcA_y69=iXMH75dHeNkxMa038Z7Xk63GW9fdcAFHJSWS=sA@mail.gmail.com/

I'm going to change the tag to "Reported-by".

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/isa/piix4.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
> index 9a6d981037..1d04fb6a55 100644
> --- a/hw/isa/piix4.c
> +++ b/hw/isa/piix4.c
> @@ -224,7 +224,7 @@ static void piix4_init(Object *obj)
>   {
>       PIIX4State *s = PIIX4_PCI_DEVICE(obj);
>   
> -    object_initialize(&s->rtc, sizeof(s->rtc), TYPE_MC146818_RTC);
> +    object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC);
>   }
>   
>   static void piix4_class_init(ObjectClass *klass, void *data)

Re: [PATCH v3 2/7] hw/isa/piix4: Use object_initialize_child() for embedded struct
Posted by Bernhard Beschow 3 years, 8 months ago
Am 30. Mai 2022 11:38:30 UTC schrieb "Philippe Mathieu-Daudé" <f4bug@amsat.org>:
>On 28/5/22 21:20, Bernhard Beschow wrote:
>> Found-by: Peter Maydell <peter.maydell@linaro.org>
>
>I suppose you refer to this thread:
>https://lore.kernel.org/qemu-devel/CAFEAcA_y69=iXMH75dHeNkxMa038Z7Xk63GW9fdcAFHJSWS=sA@mail.gmail.com/

Yes, correct.

>I'm going to change the tag to "Reported-by".

I'll take care of this in v4.

>Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>>   hw/isa/piix4.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
>> index 9a6d981037..1d04fb6a55 100644
>> --- a/hw/isa/piix4.c
>> +++ b/hw/isa/piix4.c
>> @@ -224,7 +224,7 @@ static void piix4_init(Object *obj)
>>   {
>>       PIIX4State *s = PIIX4_PCI_DEVICE(obj);
>>   -    object_initialize(&s->rtc, sizeof(s->rtc), TYPE_MC146818_RTC);
>> +    object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC);
>>   }
>>     static void piix4_class_init(ObjectClass *klass, void *data)