[PATCH 2/4] hw/isa/pc87312: Consolidate the use of device_class_set_parent_realize()

Zhao Liu posted 4 patches 9 months, 4 weeks ago
Maintainers: Eric Auger <eric.auger@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Thomas Huth <thuth@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, David Hildenbrand <david@redhat.com>, "Hervé Poussineau" <hpoussin@reactos.org>, BALATON Zoltan <balaton@eik.bme.hu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>
[PATCH 2/4] hw/isa/pc87312: Consolidate the use of device_class_set_parent_realize()
Posted by Zhao Liu 9 months, 4 weeks ago
From: Zhao Liu <zhao1.liu@intel.com>

Use device_class_set_parent_realize() to set parent realize() directly.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 hw/isa/pc87312.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c
index ee23f3e164df..64dd17b537f2 100644
--- a/hw/isa/pc87312.c
+++ b/hw/isa/pc87312.c
@@ -338,10 +338,10 @@ static void pc87312_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
 
-    sc->parent_realize = dc->realize;
-    dc->realize = pc87312_realize;
     dc->reset = pc87312_reset;
     dc->vmsd = &vmstate_pc87312;
+    device_class_set_parent_realize(dc, pc87312_realize,
+                                    &sc->parent_realize);
     device_class_set_props(dc, pc87312_properties);
 
     sc->parallel = (ISASuperIOFuncs){
-- 
2.34.1
Re: [PATCH 2/4] hw/isa/pc87312: Consolidate the use of device_class_set_parent_realize()
Posted by Thomas Huth 9 months, 4 weeks ago
On 01/02/2024 09.40, Zhao Liu wrote:
> From: Zhao Liu <zhao1.liu@intel.com>
> 
> Use device_class_set_parent_realize() to set parent realize() directly.
> 
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   hw/isa/pc87312.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c
> index ee23f3e164df..64dd17b537f2 100644
> --- a/hw/isa/pc87312.c
> +++ b/hw/isa/pc87312.c
> @@ -338,10 +338,10 @@ static void pc87312_class_init(ObjectClass *klass, void *data)
>       DeviceClass *dc = DEVICE_CLASS(klass);
>       ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
>   
> -    sc->parent_realize = dc->realize;
> -    dc->realize = pc87312_realize;
>       dc->reset = pc87312_reset;
>       dc->vmsd = &vmstate_pc87312;
> +    device_class_set_parent_realize(dc, pc87312_realize,
> +                                    &sc->parent_realize);
>       device_class_set_props(dc, pc87312_properties);
>   
>       sc->parallel = (ISASuperIOFuncs){

Reviewed-by: Thomas Huth <thuth@redhat.com>