Skip to contentSkip to conversation

Consolidate the use of device_class_set_parent_realize()

PATCH Applied Zhao Liu 3 participants 10 messages Feb 1, 2024 – Feb 4, 2024

lore
Share & tools
lore

Zhao Liu

author
#0 lore raw

cover Consolidate the use of device_class_set_parent_realize()

From: Zhao Liu <[email protected]>

Hi list,

Now we already have the device_class_set_parent_realize() to set parent realize(), thus clean up the places where that helper was forgotten.

Regards,
Zhao
---
Zhao Liu (4):
hw/isa/vt82c686: Consolidate the use of
device_class_set_parent_realize()
hw/isa/pc87312: Consolidate the use of
device_class_set_parent_realize()
hw/intc/s390_flic: Consolidate the use of
device_class_set_parent_realize()
hw/arm/smmuv3: Consolidate the use of
device_class_set_parent_realize()

 hw/arm/smmuv3.c         | 4 ++--
 hw/intc/s390_flic_kvm.c | 5 +++--
 hw/isa/pc87312.c        | 4 ++--
 hw/isa/vt82c686.c       | 4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/4 hw/isa/vt82c686: Consolidate the use of device_class_set_parent_realize()

From: Zhao Liu <[email protected]>

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

---
 hw/isa/vt82c686.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/isa/vt82c686.c +2 -2
index d3e0f6d01fb6..a99eae4f6333 100644
@@ -328,8 +328,8 @@ static void via_superio_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
 
-    sc->parent_realize = dc->realize;
-    dc->realize = via_superio_realize;
+    device_class_set_parent_realize(dc, via_superio_realize,
+                                    &sc->parent_realize);
 }
 
 static const TypeInfo via_superio_info = {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] hw/isa/vt82c686: Consolidate the use of device_class_set_parent_realize()

Quoted 14 lines · Zhao Liu

From: Zhao Liu <[email protected]>

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

---
  hw/isa/vt82c686.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/isa/vt82c686.c +0 -0
index d3e0f6d01fb6..a99eae4f6333 100644

hw/isa/vt82c686.c static void via_superio_class_init(ObjectClass *klass, void *data) · line 335

Quoted 10 lines
hw/isa/vt82c686.c +2 -2
@@ -328,8 +328,8 @@ static void via_superio_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
 
-    sc->parent_realize = dc->realize;
-    dc->realize = via_superio_realize;
+    device_class_set_parent_realize(dc, via_superio_realize,
+                                    &sc->parent_realize);
  }
 
  static const TypeInfo via_superio_info = {
author
#3 lore raw

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

In reply to Zhao Liu

From: Zhao Liu <[email protected]>

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

---
 hw/isa/pc87312.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/isa/pc87312.c +2 -2
index ee23f3e164df..64dd17b537f2 100644
@@ -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){
Signature · 1 line
2.34.1
Reviewed-by on v1 2/4
#4 lore raw

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

Quoted 16 lines · Zhao Liu

From: Zhao Liu <[email protected]>

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

---
  hw/isa/pc87312.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/isa/pc87312.c +0 -0
index ee23f3e164df..64dd17b537f2 100644
@@ -338,10 +338,10 @@ static void pc87312_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);

hw/isa/pc87312.c static void pc87312_class_init(ObjectClass *klass, void *data) · line 347

Quoted 10 lines
hw/isa/pc87312.c +2 -2
 
-    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){
author
#5 lore raw

PATCH 3/4 hw/intc/s390_flic: Consolidate the use of device_class_set_parent_realize()

In reply to Zhao Liu

From: Zhao Liu <[email protected]>

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

---
 hw/intc/s390_flic_kvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/intc/s390_flic_kvm.c +3 -2
index 4d5cbb2a2fb6..baaa30dcb734 100644
@@ -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;
Signature · 1 line
2.34.1
Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] hw/intc/s390_flic: Consolidate the use of device_class_set_parent_realize()

Quoted 16 lines · Zhao Liu

From: Zhao Liu <[email protected]>

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

---
  hw/intc/s390_flic_kvm.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
hw/intc/s390_flic_kvm.c +0 -0
index 4d5cbb2a2fb6..baaa30dcb734 100644
@@ -646,9 +646,10 @@ static void kvm_s390_flic_class_init(ObjectClass *oc, void *data)
  {
      DeviceClass *dc = DEVICE_CLASS(oc);

hw/intc/s390_flic_kvm.c static void kvm_s390_flic_class_init(ObjectClass *oc, void *data) · line 655

Quoted 10 lines
hw/intc/s390_flic_kvm.c +3 -2
      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;
author
#7 lore raw

PATCH 4/4 hw/arm/smmuv3: Consolidate the use of device_class_set_parent_realize()

In reply to Zhao Liu

From: Zhao Liu <[email protected]>

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

---
 hw/arm/smmuv3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/smmuv3.c +2 -2
index 68eeef3e1d4c..b3d8642a4990 100644
@@ -1857,8 +1857,8 @@ static void smmuv3_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_smmuv3;
     resettable_class_set_parent_phases(rc, NULL, smmu_reset_hold, NULL,
                                        &c->parent_phases);
-    c->parent_realize = dc->realize;
-    dc->realize = smmu_realize;
+    device_class_set_parent_realize(dc, smmu_realize,
+                                    &c->parent_realize);
     device_class_set_props(dc, smmuv3_properties);
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 4/4
#8 lore raw

Re: [PATCH 4/4] hw/arm/smmuv3: Consolidate the use of device_class_set_parent_realize()

Quoted 14 lines · Zhao Liu

From: Zhao Liu <[email protected]>

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

---
  hw/arm/smmuv3.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/smmuv3.c +0 -0
index 68eeef3e1d4c..b3d8642a4990 100644

hw/arm/smmuv3.c static void smmuv3_class_init(ObjectClass *klass, void *data) · line 1864

Quoted 10 lines
hw/arm/smmuv3.c +2 -2
@@ -1857,8 +1857,8 @@ static void smmuv3_class_init(ObjectClass *klass, void *data)
      dc->vmsd = &vmstate_smmuv3;
      resettable_class_set_parent_phases(rc, NULL, smmu_reset_hold, NULL,
                                         &c->parent_phases);
-    c->parent_realize = dc->realize;
-    dc->realize = smmu_realize;
+    device_class_set_parent_realize(dc, smmu_realize,
+                                    &c->parent_realize);
      device_class_set_props(dc, smmuv3_properties);
  }
 
#9 lore raw
In reply to Zhao Liu

[Trimming list of addresses]

01.02.2024 11:40, Zhao Liu :

Quoted 7 lines

From: Zhao Liu <[email protected]>

Hi list,

Now we already have the device_class_set_parent_realize() to set parent realize(), thus clean up the places where that helper was forgotten.

Applied to trivial-patches tree, thanks!

/mjt