[PATCH 3/4] hw/intc/s390_flic: 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 3/4] hw/intc/s390_flic: 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/intc/s390_flic_kvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index 4d5cbb2a2fb6..baaa30dcb734 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -646,9 +646,10 @@ static void kvm_s390_flic_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
     S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc);
+    KVMS390FLICStateClass *kfsc = KVM_S390_FLIC_CLASS(oc);
 
-    KVM_S390_FLIC_CLASS(oc)->parent_realize = dc->realize;
-    dc->realize = kvm_s390_flic_realize;
+    device_class_set_parent_realize(dc, kvm_s390_flic_realize,
+                                    &kfsc->parent_realize);
     dc->vmsd = &kvm_s390_flic_vmstate;
     dc->reset = kvm_s390_flic_reset;
     fsc->register_io_adapter = kvm_s390_register_io_adapter;
-- 
2.34.1
Re: [PATCH 3/4] hw/intc/s390_flic: 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/intc/s390_flic_kvm.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
> index 4d5cbb2a2fb6..baaa30dcb734 100644
> --- a/hw/intc/s390_flic_kvm.c
> +++ b/hw/intc/s390_flic_kvm.c
> @@ -646,9 +646,10 @@ static void kvm_s390_flic_class_init(ObjectClass *oc, void *data)
>   {
>       DeviceClass *dc = DEVICE_CLASS(oc);
>       S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc);
> +    KVMS390FLICStateClass *kfsc = KVM_S390_FLIC_CLASS(oc);
>   
> -    KVM_S390_FLIC_CLASS(oc)->parent_realize = dc->realize;
> -    dc->realize = kvm_s390_flic_realize;
> +    device_class_set_parent_realize(dc, kvm_s390_flic_realize,
> +                                    &kfsc->parent_realize);
>       dc->vmsd = &kvm_s390_flic_vmstate;
>       dc->reset = kvm_s390_flic_reset;
>       fsc->register_io_adapter = kvm_s390_register_io_adapter;

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