diff mbox series

[v3,7/7] piix3, ich9: Reuse qbus_build_aml()

Message ID 20230116152908.147275-8-shentey@gmail.com (mailing list archive)
State New, archived
Headers show
Series AML Housekeeping | expand

Commit Message

Bernhard Beschow Jan. 16, 2023, 3:29 p.m. UTC
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i2c/smbus_ich9.c | 5 +----
 hw/isa/lpc_ich9.c   | 5 +----
 hw/isa/piix3.c      | 5 +----
 3 files changed, 3 insertions(+), 12 deletions(-)

Comments

Igor Mammedov Jan. 18, 2023, 11:39 a.m. UTC | #1
On Mon, 16 Jan 2023 16:29:08 +0100
Bernhard Beschow <shentey@gmail.com> wrote:

> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

I'd squash it in previous patch, and rename that to something

'remove no longer needed isa_build_aml()
  
 isa_build_aml() doesn't do anything except
 calling call_dev_aml_func() on bus children
 along with other places that do the same.
 Move that into ... and cleanup those places
 as well.
'


> ---
>  hw/i2c/smbus_ich9.c | 5 +----
>  hw/isa/lpc_ich9.c   | 5 +----
>  hw/isa/piix3.c      | 5 +----
>  3 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
> index ee50ba1f2c..52ba77f3fc 100644
> --- a/hw/i2c/smbus_ich9.c
> +++ b/hw/i2c/smbus_ich9.c
> @@ -97,13 +97,10 @@ static void ich9_smbus_realize(PCIDevice *d, Error **errp)
>  
>  static void build_ich9_smb_aml(AcpiDevAmlIf *adev, Aml *scope)
>  {
> -    BusChild *kid;
>      ICH9SMBState *s = ICH9_SMB_DEVICE(adev);
>      BusState *bus = BUS(s->smb.smbus);
>  
> -    QTAILQ_FOREACH(kid, &bus->children, sibling) {
> -            call_dev_aml_func(DEVICE(kid->child), scope);
> -    }
> +    qbus_build_aml(bus, scope);
>  }
>  
>  static void ich9_smb_class_init(ObjectClass *klass, void *data)
> diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
> index 0ab0a341be..d5d4b0f177 100644
> --- a/hw/isa/lpc_ich9.c
> +++ b/hw/isa/lpc_ich9.c
> @@ -813,7 +813,6 @@ static void ich9_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
>  static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
>  {
>      Aml *field;
> -    BusChild *kid;
>      ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
>      BusState *bus = BUS(s->isa_bus);
>      Aml *sb_scope = aml_scope("\\_SB");
> @@ -835,9 +834,7 @@ static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
>      aml_append(sb_scope, field);
>      aml_append(scope, sb_scope);
>  
> -    QTAILQ_FOREACH(kid, &bus->children, sibling) {
> -            call_dev_aml_func(DEVICE(kid->child), scope);
> -    }
> +    qbus_build_aml(bus, scope);
>  }
>  
>  static void ich9_lpc_class_init(ObjectClass *klass, void *data)
> diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
> index 283b971ec4..a9cb39bf21 100644
> --- a/hw/isa/piix3.c
> +++ b/hw/isa/piix3.c
> @@ -306,7 +306,6 @@ static void pci_piix3_realize(PCIDevice *dev, Error **errp)
>  static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
>  {
>      Aml *field;
> -    BusChild *kid;
>      Aml *sb_scope = aml_scope("\\_SB");
>      BusState *bus = qdev_get_child_bus(DEVICE(adev), "isa.0");
>  
> @@ -322,9 +321,7 @@ static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
>      aml_append(sb_scope, field);
>      aml_append(scope, sb_scope);
>  
> -    QTAILQ_FOREACH(kid, &bus->children, sibling) {
> -        call_dev_aml_func(DEVICE(kid->child), scope);
> -    }
> +    qbus_build_aml(bus, scope);
>  }
>  
>  static void pci_piix3_class_init(ObjectClass *klass, void *data)
diff mbox series

Patch

diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index ee50ba1f2c..52ba77f3fc 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -97,13 +97,10 @@  static void ich9_smbus_realize(PCIDevice *d, Error **errp)
 
 static void build_ich9_smb_aml(AcpiDevAmlIf *adev, Aml *scope)
 {
-    BusChild *kid;
     ICH9SMBState *s = ICH9_SMB_DEVICE(adev);
     BusState *bus = BUS(s->smb.smbus);
 
-    QTAILQ_FOREACH(kid, &bus->children, sibling) {
-            call_dev_aml_func(DEVICE(kid->child), scope);
-    }
+    qbus_build_aml(bus, scope);
 }
 
 static void ich9_smb_class_init(ObjectClass *klass, void *data)
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 0ab0a341be..d5d4b0f177 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -813,7 +813,6 @@  static void ich9_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
 static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
 {
     Aml *field;
-    BusChild *kid;
     ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
     BusState *bus = BUS(s->isa_bus);
     Aml *sb_scope = aml_scope("\\_SB");
@@ -835,9 +834,7 @@  static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
     aml_append(sb_scope, field);
     aml_append(scope, sb_scope);
 
-    QTAILQ_FOREACH(kid, &bus->children, sibling) {
-            call_dev_aml_func(DEVICE(kid->child), scope);
-    }
+    qbus_build_aml(bus, scope);
 }
 
 static void ich9_lpc_class_init(ObjectClass *klass, void *data)
diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
index 283b971ec4..a9cb39bf21 100644
--- a/hw/isa/piix3.c
+++ b/hw/isa/piix3.c
@@ -306,7 +306,6 @@  static void pci_piix3_realize(PCIDevice *dev, Error **errp)
 static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
 {
     Aml *field;
-    BusChild *kid;
     Aml *sb_scope = aml_scope("\\_SB");
     BusState *bus = qdev_get_child_bus(DEVICE(adev), "isa.0");
 
@@ -322,9 +321,7 @@  static void build_pci_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
     aml_append(sb_scope, field);
     aml_append(scope, sb_scope);
 
-    QTAILQ_FOREACH(kid, &bus->children, sibling) {
-        call_dev_aml_func(DEVICE(kid->child), scope);
-    }
+    qbus_build_aml(bus, scope);
 }
 
 static void pci_piix3_class_init(ObjectClass *klass, void *data)