From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: 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>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Markus Armbruster" <armbru@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Greg Kurz" <groug@kaod.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 4/5] hw/ppc/spapr: Set QDev properties using QDev API
Date: Fri, 3 Feb 2023 22:16:22 +0100 [thread overview]
Message-ID: <20230203211623.50930-5-philmd@linaro.org> (raw)
In-Reply-To: <20230203211623.50930-1-philmd@linaro.org>
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>
---
hw/intc/spapr_xive.c | 11 ++++-------
hw/intc/xics.c | 4 ++--
hw/intc/xive.c | 4 ++--
hw/ppc/spapr_irq.c | 8 +++-----
4 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index dc641cc604..213c4cac44 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -310,9 +310,8 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp)
/*
* Initialize the internal sources, for IPIs and virtual devices.
*/
- object_property_set_int(OBJECT(xsrc), "nr-irqs", xive->nr_irqs,
- &error_fatal);
- object_property_set_link(OBJECT(xsrc), "xive", OBJECT(xive), &error_abort);
+ qdev_prop_set_uint32(DEVICE(xsrc), "nr-irqs", xive->nr_irqs);
+ qdev_prop_set_link(DEVICE(xsrc), "xive", OBJECT(xive));
if (!qdev_realize(DEVICE(xsrc), NULL, errp)) {
return;
}
@@ -321,10 +320,8 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp)
/*
* Initialize the END ESB source
*/
- object_property_set_int(OBJECT(end_xsrc), "nr-ends", xive->nr_irqs,
- &error_fatal);
- object_property_set_link(OBJECT(end_xsrc), "xive", OBJECT(xive),
- &error_abort);
+ qdev_prop_set_uint32(DEVICE(end_xsrc), "nr-ends", xive->nr_irqs);
+ qdev_prop_set_link(DEVICE(end_xsrc), "xive", OBJECT(xive));
if (!qdev_realize(DEVICE(end_xsrc), NULL, errp)) {
return;
}
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index c7f8abd71e..2fd1a15153 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -382,8 +382,8 @@ Object *icp_create(Object *cpu, const char *type, XICSFabric *xi, Error **errp)
obj = object_new(type);
object_property_add_child(cpu, type, obj);
object_unref(obj);
- object_property_set_link(obj, ICP_PROP_XICS, OBJECT(xi), &error_abort);
- object_property_set_link(obj, ICP_PROP_CPU, cpu, &error_abort);
+ qdev_prop_set_link(DEVICE(obj), ICP_PROP_XICS, OBJECT(xi));
+ qdev_prop_set_link(DEVICE(obj), ICP_PROP_CPU, cpu);
if (!qdev_realize(DEVICE(obj), NULL, errp)) {
object_unparent(obj);
obj = NULL;
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index a986b96843..0e34035bc6 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -799,8 +799,8 @@ Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp)
obj = object_new(TYPE_XIVE_TCTX);
object_property_add_child(cpu, TYPE_XIVE_TCTX, obj);
object_unref(obj);
- object_property_set_link(obj, "cpu", cpu, &error_abort);
- object_property_set_link(obj, "presenter", OBJECT(xptr), &error_abort);
+ qdev_prop_set_link(DEVICE(obj), "cpu", cpu);
+ qdev_prop_set_link(DEVICE(obj), "presenter", OBJECT(xptr));
if (!qdev_realize(DEVICE(obj), NULL, errp)) {
object_unparent(obj);
return NULL;
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index a0d1e1298e..283769c074 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -313,9 +313,8 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
obj = object_new(TYPE_ICS_SPAPR);
object_property_add_child(OBJECT(spapr), "ics", obj);
- object_property_set_link(obj, ICS_PROP_XICS, OBJECT(spapr),
- &error_abort);
- object_property_set_int(obj, "nr-irqs", smc->nr_xirqs, &error_abort);
+ qdev_prop_set_link(DEVICE(obj), ICS_PROP_XICS, OBJECT(spapr));
+ qdev_prop_set_uint32(DEVICE(obj), "nr-irqs", smc->nr_xirqs);
if (!qdev_realize(DEVICE(obj), NULL, errp)) {
return;
}
@@ -335,8 +334,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
* priority
*/
qdev_prop_set_uint32(dev, "nr-ends", nr_servers << 3);
- object_property_set_link(OBJECT(dev), "xive-fabric", OBJECT(spapr),
- &error_abort);
+ qdev_prop_set_link(dev, "xive-fabric", OBJECT(spapr));
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
spapr->xive = SPAPR_XIVE(dev);
--
2.38.1
next prev parent reply other threads:[~2023-02-03 21:18 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
2023-02-03 21:16 ` Philippe Mathieu-Daudé [this message]
2023-02-05 11:00 ` [PATCH 4/5] hw/ppc/spapr: " 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=20230203211623.50930-5-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=hpoussin@reactos.org \
--cc=mark.cave-ayland@ilande.co.uk \
--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).