mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
xics: pass appropriate types to realize() handlers.
It makes more sense to pass an IPCState * to handlers of ICPStateClass instead of a DeviceState *, if only to benefit from compile time type checking. The same goes with ICSStateClass. While here, we also change the declaration of ICPStateClass in xics.h for consistency. Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
ad265631c0
commit
100f738850
4 changed files with 13 additions and 17 deletions
|
@ -356,7 +356,7 @@ static void icp_realize(DeviceState *dev, Error **errp)
|
|||
icp->xics = XICS_FABRIC(obj);
|
||||
|
||||
if (icpc->realize) {
|
||||
icpc->realize(dev, errp);
|
||||
icpc->realize(icp, errp);
|
||||
}
|
||||
|
||||
qemu_register_reset(icp_reset, dev);
|
||||
|
@ -606,10 +606,8 @@ static void ics_simple_initfn(Object *obj)
|
|||
ics->offset = XICS_IRQ_BASE;
|
||||
}
|
||||
|
||||
static void ics_simple_realize(DeviceState *dev, Error **errp)
|
||||
static void ics_simple_realize(ICSState *ics, Error **errp)
|
||||
{
|
||||
ICSState *ics = ICS_SIMPLE(dev);
|
||||
|
||||
if (!ics->nr_irqs) {
|
||||
error_setg(errp, "Number of interrupts needs to be greater 0");
|
||||
return;
|
||||
|
@ -617,7 +615,7 @@ static void ics_simple_realize(DeviceState *dev, Error **errp)
|
|||
ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
|
||||
ics->qirqs = qemu_allocate_irqs(ics_simple_set_irq, ics, ics->nr_irqs);
|
||||
|
||||
qemu_register_reset(ics_simple_reset, dev);
|
||||
qemu_register_reset(ics_simple_reset, ics);
|
||||
}
|
||||
|
||||
static Property ics_simple_properties[] = {
|
||||
|
@ -664,7 +662,7 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
|
|||
|
||||
|
||||
if (icsc->realize) {
|
||||
icsc->realize(dev, errp);
|
||||
icsc->realize(ics, errp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue