diff mbox series

[4/6] hw/ppc/e500: Prefer local variable over qdev_get_machine()

Message ID 20221216145709.271940-5-shentey@gmail.com (mailing list archive)
State New, archived
Headers show
Series Trivial PPC cleanups | expand

Commit Message

Bernhard Beschow Dec. 16, 2022, 2:57 p.m. UTC
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/ppc/e500.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

BALATON Zoltan Dec. 16, 2022, 3:06 p.m. UTC | #1
On Fri, 16 Dec 2022, Bernhard Beschow wrote:
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/ppc/e500.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 2fe496677c..ad83924004 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -959,7 +959,7 @@ void ppce500_init(MachineState *machine)
>     memory_region_add_subregion(address_space_mem, 0, machine->ram);
>
>     dev = qdev_new("e500-ccsr");
> -    object_property_add_child(qdev_get_machine(), "e500-ccsr",
> +    object_property_add_child(OBJECT(machine), "e500-ccsr",
>                               OBJECT(dev));

Cen the line break removed too? Looks like it fit in one line even before 
this change so not sure why was written in two lines. Maybe had some 
longer stuff there before qdev_get_machine().

Regards,
BALATON Zoltan

>     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
>     ccsr = CCSR(dev);
> @@ -1002,7 +1002,7 @@ void ppce500_init(MachineState *machine)
>
>     /* PCI */
>     dev = qdev_new("e500-pcihost");
> -    object_property_add_child(qdev_get_machine(), "pci-host", OBJECT(dev));
> +    object_property_add_child(OBJECT(machine), "pci-host", OBJECT(dev));
>     qdev_prop_set_uint32(dev, "first_slot", pmc->pci_first_slot);
>     qdev_prop_set_uint32(dev, "first_pin_irq", pci_irq_nrs[0]);
>     s = SYS_BUS_DEVICE(dev);
>
Philippe Mathieu-Daudé Dec. 16, 2022, 4:30 p.m. UTC | #2
On 16/12/22 15:57, Bernhard Beschow wrote:
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/ppc/e500.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 2fe496677c..ad83924004 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -959,7 +959,7 @@ void ppce500_init(MachineState *machine)
>       memory_region_add_subregion(address_space_mem, 0, machine->ram);

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 2fe496677c..ad83924004 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -959,7 +959,7 @@  void ppce500_init(MachineState *machine)
     memory_region_add_subregion(address_space_mem, 0, machine->ram);
 
     dev = qdev_new("e500-ccsr");
-    object_property_add_child(qdev_get_machine(), "e500-ccsr",
+    object_property_add_child(OBJECT(machine), "e500-ccsr",
                               OBJECT(dev));
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
     ccsr = CCSR(dev);
@@ -1002,7 +1002,7 @@  void ppce500_init(MachineState *machine)
 
     /* PCI */
     dev = qdev_new("e500-pcihost");
-    object_property_add_child(qdev_get_machine(), "pci-host", OBJECT(dev));
+    object_property_add_child(OBJECT(machine), "pci-host", OBJECT(dev));
     qdev_prop_set_uint32(dev, "first_slot", pmc->pci_first_slot);
     qdev_prop_set_uint32(dev, "first_pin_irq", pci_irq_nrs[0]);
     s = SYS_BUS_DEVICE(dev);