[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 04/36] spapr/irq: remove spapr_ics_create()
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 04/36] spapr/irq: remove spapr_ics_create() |
Date: |
Fri, 26 Apr 2019 16:05:55 +1000 |
From: Cédric Le Goater <address@hidden>
spapr_ics_create() is only called once. Merge it in spapr_irq_init_xics()
and simplify a bit the error handling by using 'error_fatal' .
Signed-off-by: Cédric Le Goater <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_irq.c | 44 ++++++++++++++------------------------------
1 file changed, 14 insertions(+), 30 deletions(-)
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index 0a84e4cf63..b1f79ea9de 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -67,36 +67,11 @@ void spapr_irq_msi_reset(SpaprMachineState *spapr)
* XICS IRQ backend.
*/
-static ICSState *spapr_ics_create(SpaprMachineState *spapr,
- int nr_irqs, Error **errp)
-{
- Error *local_err = NULL;
- Object *obj;
-
- obj = object_new(TYPE_ICS_SIMPLE);
- object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
- object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr),
- &error_abort);
- object_property_set_int(obj, nr_irqs, "nr-irqs", &local_err);
- if (local_err) {
- goto error;
- }
- object_property_set_bool(obj, true, "realized", &local_err);
- if (local_err) {
- goto error;
- }
-
- return ICS_BASE(obj);
-
-error:
- error_propagate(errp, local_err);
- return NULL;
-}
-
static void spapr_irq_init_xics(SpaprMachineState *spapr, int nr_irqs,
Error **errp)
{
MachineState *machine = MACHINE(spapr);
+ Object *obj;
Error *local_err = NULL;
bool xics_kvm = false;
@@ -108,7 +83,8 @@ static void spapr_irq_init_xics(SpaprMachineState *spapr,
int nr_irqs,
if (machine_kernel_irqchip_required(machine) && !xics_kvm) {
error_prepend(&local_err,
"kernel_irqchip requested but unavailable: ");
- goto error;
+ error_propagate(errp, local_err);
+ return;
}
error_free(local_err);
local_err = NULL;
@@ -118,10 +94,18 @@ static void spapr_irq_init_xics(SpaprMachineState *spapr,
int nr_irqs,
xics_spapr_init(spapr);
}
- spapr->ics = spapr_ics_create(spapr, nr_irqs, &local_err);
+ obj = object_new(TYPE_ICS_SIMPLE);
+ object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
+ object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr),
+ &error_fatal);
+ object_property_set_int(obj, nr_irqs, "nr-irqs", &error_fatal);
+ object_property_set_bool(obj, true, "realized", &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
-error:
- error_propagate(errp, local_err);
+ spapr->ics = ICS_BASE(obj);
}
#define ICS_IRQ_FREE(ics, srcno) \
--
2.20.1
- [Qemu-ppc] [PULL 00/36] ppc-for-4.1 queue 20190426, David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 02/36] hw/ppc/prep: Drop useless inclusion of "hw/input/i8042.h", David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 04/36] spapr/irq: remove spapr_ics_create(),
David Gibson <=
- [Qemu-ppc] [PULL 09/36] target/ppc: Style fixes for dfp_helper.c, David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 18/36] target/ppc: Style fixes for mmu-hash32.[ch], David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 21/36] target/ppc: Style fixes for monitor.c, David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 08/36] target/ppc: Style fixes for fpu_helper.c, David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 07/36] target/ppc: Style fixes for int_helper.c, David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 10/36] target/ppc: Style fixes for excp_helper.c, David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 14/36] target/ppc: Style fixes for machine.c, David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 12/36] target/ppc: Style fixes for helper_regs.h, David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 05/36] target/ppc: Style fixes for ppc-models.[ch], David Gibson, 2019/04/26
- [Qemu-ppc] [PULL 11/36] target/ppc: Style fixes for gdbstub.c, David Gibson, 2019/04/26