qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "BALATON Zoltan" <balaton@eik.bme.hu>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	qemu-ppc@nongnu.org, "Hervé Poussineau" <hpoussin@reactos.org>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Greg Kurz" <groug@kaod.org>
Subject: Re: [PATCH 3/5] hw/ppc/ppc4xx: Set QDev properties using QDev API
Date: Sun, 5 Feb 2023 07:59:56 -0300	[thread overview]
Message-ID: <e31c8fb1-ff9f-2f56-e3d1-56efdf219c14@gmail.com> (raw)
In-Reply-To: <20230203211623.50930-4-philmd@linaro.org>



On 2/3/23 18:16, Philippe Mathieu-Daudé wrote:
> No need to use the low-level QOM API when an object
> inherits from QDev. Directly use the QDev API to set
> its properties.
> 
> All calls use either errp=&error_abort or &error_fatal,
> so converting to the QDev API is almost a no-op (QDev
> API always uses &error_abort).
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   hw/ppc/e500.c          | 3 +--
>   hw/ppc/ppc405_boards.c | 6 ++----
>   hw/ppc/ppc405_uc.c     | 6 +++---
>   hw/ppc/ppc440_bamboo.c | 3 +--
>   hw/ppc/ppc4xx_devs.c   | 2 +-
>   hw/ppc/sam460ex.c      | 5 ++---
>   6 files changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index 9fa1f8e6cf..083961cef5 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -943,8 +943,7 @@ void ppce500_init(MachineState *machine)
>            * Secondary CPU starts in halted state for now. Needs to change
>            * when implementing non-kernel boot.
>            */
> -        object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0,
> -                                 &error_fatal);
> +        qdev_prop_set_bit(DEVICE(cs), "start-powered-off", i != 0);
>           qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal);
>   
>           if (!firstenv) {
> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
> index 4092ebc1ab..67eb9ac139 100644
> --- a/hw/ppc/ppc405_boards.c
> +++ b/hw/ppc/ppc405_boards.c
> @@ -276,10 +276,8 @@ static void ppc405_init(MachineState *machine)
>   
>       object_initialize_child(OBJECT(machine), "soc", &ppc405->soc,
>                               TYPE_PPC405_SOC);
> -    object_property_set_link(OBJECT(&ppc405->soc), "dram",
> -                             OBJECT(machine->ram), &error_abort);
> -    object_property_set_uint(OBJECT(&ppc405->soc), "sys-clk", 33333333,
> -                             &error_abort);
> +    qdev_prop_set_link(DEVICE(&ppc405->soc), "dram", OBJECT(machine->ram));
> +    qdev_prop_set_uint32(DEVICE(&ppc405->soc), "sys-clk", 33333333);
>       qdev_realize(DEVICE(&ppc405->soc), NULL, &error_fatal);
>   
>       /* allocate and load BIOS */
> diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
> index c973cfb04e..b7d5cfc548 100644
> --- a/hw/ppc/ppc405_uc.c
> +++ b/hw/ppc/ppc405_uc.c
> @@ -1080,7 +1080,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)
>        * We use the 440 DDR SDRAM controller which has more regs and features
>        * but it's compatible enough for now
>        */
> -    object_property_set_int(OBJECT(&s->sdram), "nbanks", 2, &error_abort);
> +    qdev_prop_set_uint32(DEVICE(&s->sdram), "nbanks", 2);
>       if (!ppc4xx_dcr_realize(PPC4xx_DCR_DEVICE(&s->sdram), &s->cpu, errp)) {
>           return;
>       }
> @@ -1147,8 +1147,8 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)
>       }
>   
>       /* MAL */
> -    object_property_set_int(OBJECT(&s->mal), "txc-num", 4, &error_abort);
> -    object_property_set_int(OBJECT(&s->mal), "rxc-num", 2, &error_abort);
> +    qdev_prop_set_uint8(DEVICE(&s->mal), "txc-num", 4);
> +    qdev_prop_set_uint8(DEVICE(&s->mal), "rxc-num", 2);
>       if (!ppc4xx_dcr_realize(PPC4xx_DCR_DEVICE(&s->mal), &s->cpu, errp)) {
>           return;
>       }
> diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
> index 81d71adf34..3612471990 100644
> --- a/hw/ppc/ppc440_bamboo.c
> +++ b/hw/ppc/ppc440_bamboo.c
> @@ -200,8 +200,7 @@ static void bamboo_init(MachineState *machine)
>   
>       /* SDRAM controller */
>       dev = qdev_new(TYPE_PPC4xx_SDRAM_DDR);
> -    object_property_set_link(OBJECT(dev), "dram", OBJECT(machine->ram),
> -                             &error_abort);
> +    qdev_prop_set_link(dev, "dram", OBJECT(machine->ram));
>       ppc4xx_dcr_realize(PPC4xx_DCR_DEVICE(dev), cpu, &error_fatal);
>       object_unref(OBJECT(dev));
>       /* XXX 440EP's ECC interrupts are on UIC1, but we've only created UIC0. */
> diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
> index c1d111465d..1848cf5d3c 100644
> --- a/hw/ppc/ppc4xx_devs.c
> +++ b/hw/ppc/ppc4xx_devs.c
> @@ -535,7 +535,7 @@ void ppc4xx_dcr_register(Ppc4xxDcrDeviceState *dev, int dcrn, void *opaque,
>   bool ppc4xx_dcr_realize(Ppc4xxDcrDeviceState *dev, PowerPCCPU *cpu,
>                           Error **errp)
>   {
> -    object_property_set_link(OBJECT(dev), "cpu", OBJECT(cpu), &error_abort);
> +    qdev_prop_set_link(DEVICE(dev), "cpu", OBJECT(cpu));
>       return sysbus_realize(SYS_BUS_DEVICE(dev), errp);
>   }
>   
> diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
> index cf065aae0e..cb828b6d4d 100644
> --- a/hw/ppc/sam460ex.c
> +++ b/hw/ppc/sam460ex.c
> @@ -345,13 +345,12 @@ static void sam460ex_init(MachineState *machine)
>           exit(1);
>       }
>       dev = qdev_new(TYPE_PPC4xx_SDRAM_DDR2);
> -    object_property_set_link(OBJECT(dev), "dram", OBJECT(machine->ram),
> -                             &error_abort);
> +    qdev_prop_set_link(dev, "dram", OBJECT(machine->ram));
>       /*
>        * Put all RAM on first bank because board has one slot
>        * and firmware only checks that
>        */
> -    object_property_set_int(OBJECT(dev), "nbanks", 1, &error_abort);
> +    qdev_prop_set_uint32(dev, "nbanks", 1);
>       ppc4xx_dcr_realize(PPC4xx_DCR_DEVICE(dev), cpu, &error_fatal);
>       object_unref(OBJECT(dev));
>       /* FIXME: does 460EX have ECC interrupts? */


  parent reply	other threads:[~2023-02-05 11:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 21:16 [PATCH 0/5] hw/ppc: Set QDev properties using QDev API (part 2/3) Philippe Mathieu-Daudé
2023-02-03 21:16 ` [PATCH 1/5] hw/misc/macio: Set QDev properties using QDev API Philippe Mathieu-Daudé
2023-02-03 21:16 ` [PATCH 2/5] hw/pci-host/raven: " Philippe Mathieu-Daudé
2023-02-05 11:03   ` Daniel Henrique Barboza
2023-02-03 21:16 ` [PATCH 3/5] hw/ppc/ppc4xx: " Philippe Mathieu-Daudé
2023-02-03 21:26   ` BALATON Zoltan
2023-02-05 10:59   ` Daniel Henrique Barboza [this message]
2023-02-03 21:16 ` [PATCH 4/5] hw/ppc/spapr: " Philippe Mathieu-Daudé
2023-02-05 11:00   ` Daniel Henrique Barboza
2023-02-06  8:06   ` Cédric Le Goater
2023-02-03 21:16 ` [PATCH 5/5] hw/ppc/pnv: " Philippe Mathieu-Daudé
2023-02-05 11:00   ` Daniel Henrique Barboza
2023-02-06  8:06   ` Cédric Le Goater
2023-02-05 11:05 ` [PATCH 0/5] hw/ppc: Set QDev properties using QDev API (part 2/3) Daniel Henrique Barboza
2023-02-06  8:00 ` Cédric Le Goater
2023-02-06  9:09   ` Mark Cave-Ayland
2023-02-06 13:52   ` Daniel Henrique Barboza

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=e31c8fb1-ff9f-2f56-e3d1-56efdf219c14@gmail.com \
    --to=danielhb413@gmail.com \
    --cc=armbru@redhat.com \
    --cc=balaton@eik.bme.hu \
    --cc=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=hpoussin@reactos.org \
    --cc=mark.cave-ayland@ilande.co.uk \
    --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).