Message ID | 1447201710-10229-37-git-send-email-benh@kernel.crashing.org |
---|---|
State | New |
Headers | show |
On Wed, Nov 11, 2015 at 11:27:49AM +1100, Benjamin Herrenschmidt wrote: > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Hmm.. does it make sense for the helper to do the object_new() and add_child() as well? > --- > hw/intc/xics.c | 6 ++++++ > hw/intc/xics_spapr.c | 3 +-- > include/hw/ppc/xics.h | 1 + > 3 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index 0c355f4..3cd696f 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -90,6 +90,12 @@ static void xics_common_reset(DeviceState *d) > } > } > > +void xics_add_ics(XICSState *xics, ICSState *ics) > +{ > + ics->xics = xics; > + QLIST_INSERT_HEAD(&xics->ics, ics, list); > +} > + > static void xics_prop_get_nr_irqs(Object *obj, Visitor *v, > void *opaque, const char *name, Error **errp) > { > diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c > index 3092f8d..fc331d8 100644 > --- a/hw/intc/xics_spapr.c > +++ b/hw/intc/xics_spapr.c > @@ -263,8 +263,7 @@ static void xics_spapr_initfn(Object *obj) > > ics = ICS(object_new(TYPE_ICS)); > object_property_add_child(obj, "ics", OBJECT(ics), NULL); > - ics->xics = xics; > - QLIST_INSERT_HEAD(&xics->ics, ics, list); > + xics_add_ics(xics, ics); > } > > static void xics_spapr_set_nr_irqs(XICSState *xics, uint32_t nr_irqs, Error **errp) > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > index 9e5b751..5acb329 100644 > --- a/include/hw/ppc/xics.h > +++ b/include/hw/ppc/xics.h > @@ -191,5 +191,6 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); > > void xics_set_nr_servers(XICSState *icp, uint32_t nr_servers, Error **errp); > ICSState *xics_find_source(XICSState *icp, int irq); > +void xics_add_ics(XICSState *xics, ICSState *ics); > > #endif /* __XICS_H__ */
diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 0c355f4..3cd696f 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -90,6 +90,12 @@ static void xics_common_reset(DeviceState *d) } } +void xics_add_ics(XICSState *xics, ICSState *ics) +{ + ics->xics = xics; + QLIST_INSERT_HEAD(&xics->ics, ics, list); +} + static void xics_prop_get_nr_irqs(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 3092f8d..fc331d8 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -263,8 +263,7 @@ static void xics_spapr_initfn(Object *obj) ics = ICS(object_new(TYPE_ICS)); object_property_add_child(obj, "ics", OBJECT(ics), NULL); - ics->xics = xics; - QLIST_INSERT_HEAD(&xics->ics, ics, list); + xics_add_ics(xics, ics); } static void xics_spapr_set_nr_irqs(XICSState *xics, uint32_t nr_irqs, Error **errp) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 9e5b751..5acb329 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -191,5 +191,6 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); void xics_set_nr_servers(XICSState *icp, uint32_t nr_servers, Error **errp); ICSState *xics_find_source(XICSState *icp, int irq); +void xics_add_ics(XICSState *xics, ICSState *ics); #endif /* __XICS_H__ */
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- hw/intc/xics.c | 6 ++++++ hw/intc/xics_spapr.c | 3 +-- include/hw/ppc/xics.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-)