On 11/23/2011 01:03 AM, Peter Maydell wrote: > 2011/11/22 Benoît Canet <benoit.ca...@gmail.com>: > > static int bonito_initfn(PCIDevice *dev) > > { > > PCIBonitoState *s = DO_UPCAST(PCIBonitoState, dev, dev); > > + SysBusDevice *sysbus = sysbus_from_qdev(&dev->qdev); > > This looks odd. The device here is a PCIBonitoState, which > is-a PCIDevice, which is-a DeviceState. It's not a SysBusDevice > and merely casting doesn't make it one. > > I'm not sure what should be being done here, but I'm pretty > sure this won't work...
s->pcihost.busdev gives you a SysBusDevice (and s->pcihost.confmem/datamem gives you a few MemoryRegions that you need later in bonito_initfn. -- error compiling committee.c: too many arguments to function