From 02e2da45c4601909d5105838323d5c529ec7010b Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Sat, 23 May 2009 00:05:19 +0100 Subject: Add common BusState Implement and use a common device bus state. The main side-effect is that creating a bus and attaching it to a parent device are no longer separate operations. For legacy code we allow a NULL parent, but that should go away eventually. Also tweak creation code to veriry theat a device in on the right bus. Signed-off-by: Paul Brook --- hw/pxa2xx.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'hw/pxa2xx.c') diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index d54ad194bc..febe527491 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -863,8 +863,7 @@ static void pxa2xx_ssp_init(SysBusDevice *dev) register_savevm("pxa2xx_ssp", -1, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); - s->bus = ssi_create_bus(); - qdev_attach_child_bus(&dev->qdev, "ssi", s->bus); + s->bus = ssi_create_bus(&dev->qdev, "ssi"); } /* Real-Time Clock */ @@ -1500,12 +1499,12 @@ PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base, PXA2xxI2CState *s = qemu_mallocz(sizeof(PXA2xxI2CState)); /* FIXME: Should the slave device really be on a separate bus? */ - dev = i2c_create_slave(i2c_init_bus(), "pxa2xx-i2c-slave", 0); + dev = i2c_create_slave(i2c_init_bus(NULL, "dummy"), "pxa2xx-i2c-slave", 0); s->slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, I2C_SLAVE_FROM_QDEV(dev)); s->slave->host = s; s->irq = irq; - s->bus = i2c_init_bus(); + s->bus = i2c_init_bus(NULL, "i2c"); s->offset = base - (base & (~region_size) & TARGET_PAGE_MASK); iomemtype = cpu_register_io_memory(0, pxa2xx_i2c_readfn, @@ -2117,7 +2116,7 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) DeviceState *dev; dev = sysbus_create_simple("pxa2xx-ssp", pxa27x_ssp[i].io_base, s->pic[pxa27x_ssp[i].irqn]); - s->ssp[i] = qdev_get_child_bus(dev, "ssi"); + s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } if (usb_enabled) { @@ -2229,7 +2228,7 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) DeviceState *dev; dev = sysbus_create_simple("pxa2xx-ssp", pxa255_ssp[i].io_base, s->pic[pxa255_ssp[i].irqn]); - s->ssp[i] = qdev_get_child_bus(dev, "ssi"); + s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } if (usb_enabled) { -- cgit v1.2.1