qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [PATCH 2/2] hw/ppc/pegasos2: Extract via_vt8231_create() helper
Date: Tue, 17 Jan 2023 22:17:11 +0100 (CET)	[thread overview]
Message-ID: <187a86f4-64fc-3ba1-1a20-a19c33aa82f9@eik.bme.hu> (raw)
In-Reply-To: <20230117201640.88365-3-philmd@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 3376 bytes --]

On Tue, 17 Jan 2023, Philippe Mathieu-Daudé wrote:
> Simplify a bit pegasos2_init() by extracting the VIA southbridge
> creation code into a new via_vt8231_create() helper.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/ppc/pegasos2.c | 33 +++++++++++++++++++++------------
> 1 file changed, 21 insertions(+), 12 deletions(-)
>
> diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
> index ac69aee099..445cb5ef31 100644
> --- a/hw/ppc/pegasos2.c
> +++ b/hw/ppc/pegasos2.c
> @@ -96,6 +96,25 @@ static void pegasos2_cpu_reset(void *opaque)
>     }
> }
>
> +static PCIDevice *via_vt8231_create(MachineState *machine, PCIBus *pci_bus)
> +{
> +    Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine);
> +    PCIDevice *dev, *via;
> +
> +    via = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0),
> +                                          true, TYPE_VT8231_ISA);
> +    object_property_add_alias(OBJECT(machine), "rtc-time",
> +                              object_resolve_path_component(OBJECT(via), "rtc"),
> +                              "date");
> +    qdev_connect_gpio_out(DEVICE(via), 0,
> +                          qdev_get_gpio_in_named(pm->mv, "gpp", 31));
> +
> +    dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide"));
> +    pci_ide_create_devs(dev);
> +
> +    return via;
> +}
> +
> static I2CBus *via_i2c_bus(PCIDevice *via)
> {
>     PCIDevice *dev;
> @@ -110,7 +129,7 @@ static void pegasos2_init(MachineState *machine)
>     CPUPPCState *env;
>     MemoryRegion *rom = g_new(MemoryRegion, 1);
>     PCIBus *pci_bus;
> -    PCIDevice *dev, *via;
> +    PCIDevice *via;
>     const char *fwname = machine->firmware ?: PROM_FILENAME;
>     char *filename;
>     int sz;
> @@ -166,17 +185,7 @@ static void pegasos2_init(MachineState *machine)
>     pci_bus = mv64361_get_pci_bus(pm->mv, 1);
>
>     /* VIA VT8231 South Bridge (multifunction PCI device) */
> -    via = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), true,
> -                                          TYPE_VT8231_ISA);
> -    object_property_add_alias(OBJECT(machine), "rtc-time",
> -                              object_resolve_path_component(OBJECT(via),
> -                                                            "rtc"),

Is this series to help any later patches or is it proposed on its own? In 
the latter case I don't see how this would improve it much. The only 
useful change in the series is removing the unnecessary line break before 
"rtc"); here, otherwise moving patts of this init routine to separate 
functions does not make it simpler just makes you jump around instead of 
being able to read it linearly. So if this makes it possible for later 
patches to move some of it elsewhere then OK otherwise I'd say I'm OK with 
how it is now, it's just the normal unreadable QOM stuff you see 
everywhere after removing legacy init functions.

Regards,
BALATON Zoltan

> -                              "date");
> -    qdev_connect_gpio_out(DEVICE(via), 0,
> -                          qdev_get_gpio_in_named(pm->mv, "gpp", 31));
> -
> -    dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide"));
> -    pci_ide_create_devs(dev);
> +    via = via_vt8231_create(machine, pci_bus);
>
>     spd_data = spd_data_generate(DDR, machine->ram_size);
>     smbus_eeprom_init_one(via_i2c_bus(via), 0x57, spd_data);
>

  reply	other threads:[~2023-01-17 21:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 20:16 [PATCH 0/2] hw/ppc/pegasos2: Extract southbridge creation code to via_vt8231_create Philippe Mathieu-Daudé
2023-01-17 20:16 ` [PATCH 1/2] hw/ppc/pegasos2: Extract via_i2c_bus() helper Philippe Mathieu-Daudé
2023-01-17 20:16 ` [PATCH 2/2] hw/ppc/pegasos2: Extract via_vt8231_create() helper Philippe Mathieu-Daudé
2023-01-17 21:17   ` BALATON Zoltan [this message]
2023-01-18  9:51     ` Philippe Mathieu-Daudé
2023-01-18 16:59       ` BALATON Zoltan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=187a86f4-64fc-3ba1-1a20-a19c33aa82f9@eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).