diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-06-10 09:41:42 +0200 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2009-06-11 13:47:36 +0100 |
commit | 074f2fff798cb8f9588080b740dc356217a24720 (patch) | |
tree | 4a7267d64bbe8d679627699b6545c9fcd23bb270 | |
parent | 57b452a8487df30d084ce2b56a993ba7473469e3 (diff) |
qdev: move name+size into DeviceInfo (v2)
Rationale: move device information from code to data structures.
v2: Adapt the drivers missed in the first version.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | hw/ads7846.c | 4 | ||||
-rw-r--r-- | hw/i2c.c | 6 | ||||
-rw-r--r-- | hw/i2c.h | 2 | ||||
-rw-r--r-- | hw/lm832x.c | 4 | ||||
-rw-r--r-- | hw/max111x.c | 8 | ||||
-rw-r--r-- | hw/max7310.c | 4 | ||||
-rw-r--r-- | hw/pci.c | 4 | ||||
-rw-r--r-- | hw/pxa2xx.c | 5 | ||||
-rw-r--r-- | hw/qdev.c | 18 | ||||
-rw-r--r-- | hw/qdev.h | 8 | ||||
-rw-r--r-- | hw/smbus.c | 6 | ||||
-rw-r--r-- | hw/smbus.h | 2 | ||||
-rw-r--r-- | hw/smbus_eeprom.c | 5 | ||||
-rw-r--r-- | hw/spitz.c | 8 | ||||
-rw-r--r-- | hw/ssd0303.c | 4 | ||||
-rw-r--r-- | hw/ssd0323.c | 4 | ||||
-rw-r--r-- | hw/ssi-sd.c | 4 | ||||
-rw-r--r-- | hw/ssi.c | 6 | ||||
-rw-r--r-- | hw/ssi.h | 2 | ||||
-rw-r--r-- | hw/stellaris.c | 5 | ||||
-rw-r--r-- | hw/syborg_timer.c | 13 | ||||
-rw-r--r-- | hw/sysbus.c | 11 | ||||
-rw-r--r-- | hw/sysbus.h | 3 | ||||
-rw-r--r-- | hw/tmp105.c | 4 | ||||
-rw-r--r-- | hw/tosa.c | 8 | ||||
-rw-r--r-- | hw/twl92230.c | 4 | ||||
-rw-r--r-- | hw/wm8750.c | 4 |
27 files changed, 95 insertions, 61 deletions
diff --git a/hw/ads7846.c b/hw/ads7846.c index 1c65ffe15..7d1cbc711 100644 --- a/hw/ads7846.c +++ b/hw/ads7846.c @@ -155,13 +155,15 @@ static void ads7846_init(SSISlave *dev) } static SSISlaveInfo ads7846_info = { + .qdev.name ="ads7846", + .qdev.size = sizeof(ADS7846State), .init = ads7846_init, .transfer = ads7846_transfer }; static void ads7846_register_devices(void) { - ssi_register_slave("ads7846", sizeof(ADS7846State), &ads7846_info); + ssi_register_slave(&ads7846_info); } device_init(ads7846_register_devices) @@ -152,12 +152,12 @@ static void i2c_slave_qdev_init(DeviceState *dev, DeviceInfo *base) info->init(s); } -void i2c_register_slave(const char *name, int size, I2CSlaveInfo *info) +void i2c_register_slave(I2CSlaveInfo *info) { - assert(size >= sizeof(i2c_slave)); + assert(info->qdev.size >= sizeof(i2c_slave)); info->qdev.init = i2c_slave_qdev_init; info->qdev.bus_type = BUS_TYPE_I2C; - qdev_register(name, size, &info->qdev); + qdev_register(&info->qdev); } DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, int addr) @@ -57,7 +57,7 @@ void i2c_slave_load(QEMUFile *f, i2c_slave *dev); #define I2C_SLAVE_FROM_QDEV(dev) DO_UPCAST(i2c_slave, qdev, dev) #define FROM_I2C_SLAVE(type, dev) DO_UPCAST(type, i2c, dev) -void i2c_register_slave(const char *name, int size, I2CSlaveInfo *type); +void i2c_register_slave(I2CSlaveInfo *type); DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, int addr); diff --git a/hw/lm832x.c b/hw/lm832x.c index 74eeca2e9..18ea1f59a 100644 --- a/hw/lm832x.c +++ b/hw/lm832x.c @@ -526,6 +526,8 @@ void lm832x_key_event(struct i2c_slave *i2c, int key, int state) } static I2CSlaveInfo lm8323_info = { + .qdev.name = "lm8323", + .qdev.size = sizeof(LM823KbdState), .init = lm8323_init, .event = lm_i2c_event, .recv = lm_i2c_rx, @@ -534,7 +536,7 @@ static I2CSlaveInfo lm8323_info = { static void lm832x_register_devices(void) { - i2c_register_slave("lm8323", sizeof(LM823KbdState), &lm8323_info); + i2c_register_slave(&lm8323_info); } device_init(lm832x_register_devices) diff --git a/hw/max111x.c b/hw/max111x.c index 217233cff..f7023a8e9 100644 --- a/hw/max111x.c +++ b/hw/max111x.c @@ -164,19 +164,23 @@ void max111x_set_input(DeviceState *dev, int line, uint8_t value) } static SSISlaveInfo max1110_info = { + .qdev.name = "max1110", + .qdev.size = sizeof(MAX111xState), .init = max1110_init, .transfer = max111x_transfer }; static SSISlaveInfo max1111_info = { + .qdev.name = "max1111", + .qdev.size = sizeof(MAX111xState), .init = max1111_init, .transfer = max111x_transfer }; static void max111x_register_devices(void) { - ssi_register_slave("max1110", sizeof(MAX111xState), &max1110_info); - ssi_register_slave("max1111", sizeof(MAX111xState), &max1111_info); + ssi_register_slave(&max1110_info); + ssi_register_slave(&max1111_info); } device_init(max111x_register_devices) diff --git a/hw/max7310.c b/hw/max7310.c index 69ede32a6..a571e57e9 100644 --- a/hw/max7310.c +++ b/hw/max7310.c @@ -218,6 +218,8 @@ void max7310_gpio_out_set(i2c_slave *i2c, int line, qemu_irq handler) } static I2CSlaveInfo max7310_info = { + .qdev.name = "max7310", + .qdev.size = sizeof(MAX7310State), .init = max7310_init, .event = max7310_event, .recv = max7310_rx, @@ -226,7 +228,7 @@ static I2CSlaveInfo max7310_info = { static void max7310_register_devices(void) { - i2c_register_slave("max7310", sizeof(MAX7310State), &max7310_info); + i2c_register_slave(&max7310_info); } device_init(max7310_register_devices) @@ -924,11 +924,13 @@ void pci_qdev_register(const char *name, int size, pci_qdev_initfn init) PCIDeviceInfo *info; info = qemu_mallocz(sizeof(*info)); + info->qdev.name = qemu_strdup(name); + info->qdev.size = size; info->init = init; info->qdev.init = pci_qdev_init; info->qdev.bus_type = BUS_TYPE_PCI; - qdev_register(name, size, &info->qdev); + qdev_register(&info->qdev); } PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index febe52749..e001d1fc7 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -1485,6 +1485,8 @@ static void pxa2xx_i2c_slave_init(i2c_slave *i2c) } static I2CSlaveInfo pxa2xx_i2c_slave_info = { + .qdev.name = "pxa2xx-i2c-slave", + .qdev.size = sizeof(PXA2xxI2CSlaveState), .init = pxa2xx_i2c_slave_init, .event = pxa2xx_i2c_event, .recv = pxa2xx_i2c_rx, @@ -2258,8 +2260,7 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) static void pxa2xx_register_devices(void) { - i2c_register_slave("pxa2xx-i2c-slave", sizeof(PXA2xxI2CSlaveState), - &pxa2xx_i2c_slave_info); + i2c_register_slave(&pxa2xx_i2c_slave_info); sysbus_register_dev("pxa2xx-ssp", sizeof(PXA2xxSSPState), pxa2xx_ssp_init); } @@ -42,9 +42,7 @@ struct DeviceProperty { }; struct DeviceType { - const char *name; DeviceInfo *info; - int size; DeviceType *next; }; @@ -54,17 +52,15 @@ static BusState *main_system_bus; static DeviceType *device_type_list; /* Register a new device type. */ -void qdev_register(const char *name, int size, DeviceInfo *info) +void qdev_register(DeviceInfo *info) { DeviceType *t; - assert(size >= sizeof(DeviceState)); + assert(info->size >= sizeof(DeviceState)); t = qemu_mallocz(sizeof(DeviceType)); t->next = device_type_list; device_type_list = t; - t->name = qemu_strdup(name); - t->size = size; t->info = info; } @@ -77,7 +73,7 @@ DeviceState *qdev_create(BusState *bus, const char *name) DeviceState *dev; for (t = device_type_list; t; t = t->next) { - if (strcmp(t->name, name) == 0) { + if (strcmp(t->info->name, name) == 0) { break; } } @@ -85,7 +81,7 @@ DeviceState *qdev_create(BusState *bus, const char *name) hw_error("Unknown device '%s'\n", name); } - dev = qemu_mallocz(t->size); + dev = qemu_mallocz(t->info->size); dev->type = t; if (!bus) { @@ -173,7 +169,7 @@ CharDriverState *qdev_init_chardev(DeviceState *dev) static int next_serial; static int next_virtconsole; /* FIXME: This is a nasty hack that needs to go away. */ - if (strncmp(dev->type->name, "virtio", 6) == 0) { + if (strncmp(dev->type->info->name, "virtio", 6) == 0) { return virtcon_hds[next_virtconsole++]; } else { return serial_hds[next_serial++]; @@ -355,7 +351,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent) { DeviceProperty *prop; BusState *child; - qdev_printf("dev: %s\n", dev->type->name); + qdev_printf("dev: %s\n", dev->type->info->name); indent += 2; if (dev->num_gpio_in) { qdev_printf("gpio-in %d\n", dev->num_gpio_in); @@ -374,7 +370,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent) break; case PROP_TYPE_DEV: qdev_printf("prop-dev %s %s\n", prop->name, - ((DeviceState *)prop->value.ptr)->type->name); + ((DeviceState *)prop->value.ptr)->type->info->name); break; default: qdev_printf("prop-unknown%d %s\n", prop->type, prop->name); @@ -78,12 +78,16 @@ typedef void (*SCSIAttachFn)(DeviceState *host, BlockDriverState *bdrv, int unit); struct DeviceInfo { + const char *name; + size_t size; + DevicePropList *props; + + /* Private to qdev / bus. */ qdev_initfn init; BusType bus_type; - DevicePropList *props; }; -void qdev_register(const char *name, int size, DeviceInfo *info); +void qdev_register(DeviceInfo *info); /* Register device properties. */ /* GPIO inputs also double as IRQ sinks. */ diff --git a/hw/smbus.c b/hw/smbus.c index 6bea4faab..5618902e7 100644 --- a/hw/smbus.c +++ b/hw/smbus.c @@ -206,14 +206,14 @@ static void smbus_device_init(i2c_slave *i2c) t->init(dev); } -void smbus_register_device(const char *name, int size, SMBusDeviceInfo *info) +void smbus_register_device(SMBusDeviceInfo *info) { - assert(size >= sizeof(SMBusDevice)); + assert(info->i2c.qdev.size >= sizeof(SMBusDevice)); info->i2c.init = smbus_device_init; info->i2c.event = smbus_i2c_event; info->i2c.recv = smbus_i2c_recv; info->i2c.send = smbus_i2c_send; - i2c_register_slave(name, size, &info->i2c); + i2c_register_slave(&info->i2c); } /* Master device commands. */ diff --git a/hw/smbus.h b/hw/smbus.h index 5b6e20f91..d8c805964 100644 --- a/hw/smbus.h +++ b/hw/smbus.h @@ -53,7 +53,7 @@ typedef struct { uint8_t (*read_data)(SMBusDevice *dev, uint8_t cmd, int n); } SMBusDeviceInfo; -void smbus_register_device(const char *name, int size, SMBusDeviceInfo *info); +void smbus_register_device(SMBusDeviceInfo *info); /* Master device commands. */ void smbus_quick_command(i2c_bus *bus, int addr, int read); diff --git a/hw/smbus_eeprom.c b/hw/smbus_eeprom.c index 3f8b38699..05a70d9b1 100644 --- a/hw/smbus_eeprom.c +++ b/hw/smbus_eeprom.c @@ -105,6 +105,8 @@ static void smbus_eeprom_init(SMBusDevice *dev) } static SMBusDeviceInfo smbus_eeprom_info = { + .i2c.qdev.name = "smbus-eeprom", + .i2c.qdev.size = sizeof(SMBusEEPROMDevice), .init = smbus_eeprom_init, .quick_cmd = eeprom_quick_cmd, .send_byte = eeprom_send_byte, @@ -115,8 +117,7 @@ static SMBusDeviceInfo smbus_eeprom_info = { static void smbus_eeprom_register_devices(void) { - smbus_register_device("smbus-eeprom", sizeof(SMBusEEPROMDevice), - &smbus_eeprom_info); + smbus_register_device(&smbus_eeprom_info); } device_init(smbus_eeprom_register_devices) diff --git a/hw/spitz.c b/hw/spitz.c index aa1487b20..b0d42adc9 100644 --- a/hw/spitz.c +++ b/hw/spitz.c @@ -1076,19 +1076,23 @@ static void spitz_machine_init(void) machine_init(spitz_machine_init); static SSISlaveInfo corgi_ssp_info = { + .qdev.name = "corgi-ssp", + .qdev.size = sizeof(CorgiSSPState), .init = corgi_ssp_init, .transfer = corgi_ssp_transfer }; static SSISlaveInfo spitz_lcdtg_info = { + .qdev.name = "spitz-lcdtg", + .qdev.size = sizeof(SpitzLCDTG), .init = spitz_lcdtg_init, .transfer = spitz_lcdtg_transfer }; static void spitz_register_devices(void) { - ssi_register_slave("corgi-ssp", sizeof(CorgiSSPState), &corgi_ssp_info); - ssi_register_slave("spitz-lcdtg", sizeof(SpitzLCDTG), &spitz_lcdtg_info); + ssi_register_slave(&corgi_ssp_info); + ssi_register_slave(&spitz_lcdtg_info); } device_init(spitz_register_devices) diff --git a/hw/ssd0303.c b/hw/ssd0303.c index 5a3a29e87..6872ef5e1 100644 --- a/hw/ssd0303.c +++ b/hw/ssd0303.c @@ -316,6 +316,8 @@ static void ssd0303_init(i2c_slave *i2c) } static I2CSlaveInfo ssd0303_info = { + .qdev.name = "ssd0303", + .qdev.size = sizeof(ssd0303_state), .init = ssd0303_init, .event = ssd0303_event, .recv = ssd0303_recv, @@ -324,7 +326,7 @@ static I2CSlaveInfo ssd0303_info = { static void ssd0303_register_devices(void) { - i2c_register_slave("ssd0303", sizeof(ssd0303_state), &ssd0303_info); + i2c_register_slave(&ssd0303_info); } device_init(ssd0303_register_devices) diff --git a/hw/ssd0323.c b/hw/ssd0323.c index c083d9a7c..319ab8724 100644 --- a/hw/ssd0323.c +++ b/hw/ssd0323.c @@ -339,13 +339,15 @@ static void ssd0323_init(SSISlave *dev) } static SSISlaveInfo ssd0323_info = { + .qdev.name = "ssd0323", + .qdev.size = sizeof(ssd0323_state), .init = ssd0323_init, .transfer = ssd0323_transfer }; static void ssd03232_register_devices(void) { - ssi_register_slave("ssd0323", sizeof(ssd0323_state), &ssd0323_info); + ssi_register_slave(&ssd0323_info); } device_init(ssd03232_register_devices) diff --git a/hw/ssi-sd.c b/hw/ssi-sd.c index 3e78bd2ac..4e67f143c 100644 --- a/hw/ssi-sd.c +++ b/hw/ssi-sd.c @@ -241,13 +241,15 @@ static void ssi_sd_init(SSISlave *dev) } static SSISlaveInfo ssi_sd_info = { + .qdev.name = "ssi-sd", + .qdev.size = sizeof(ssi_sd_state), .init = ssi_sd_init, .transfer = ssi_sd_transfer }; static void ssi_sd_register_devices(void) { - ssi_register_slave("ssi-sd", sizeof(ssi_sd_state), &ssi_sd_info); + ssi_register_slave(&ssi_sd_info); } device_init(ssi_sd_register_devices) @@ -29,12 +29,12 @@ static void ssi_slave_init(DeviceState *dev, DeviceInfo *base_info) info->init(s); } -void ssi_register_slave(const char *name, int size, SSISlaveInfo *info) +void ssi_register_slave(SSISlaveInfo *info) { - assert(size >= sizeof(SSISlave)); + assert(info->qdev.size >= sizeof(SSISlave)); info->qdev.init = ssi_slave_init; info->qdev.bus_type = BUS_TYPE_SSI; - qdev_register(name, size, &info->qdev); + qdev_register(&info->qdev); } DeviceState *ssi_create_slave(SSIBus *bus, const char *name) @@ -30,7 +30,7 @@ struct SSISlave { #define SSI_SLAVE_FROM_QDEV(dev) DO_UPCAST(SSISlave, qdev, dev) #define FROM_SSI_SLAVE(type, dev) DO_UPCAST(type, ssidev, dev) -void ssi_register_slave(const char *name, int size, SSISlaveInfo *info); +void ssi_register_slave(SSISlaveInfo *info); DeviceState *ssi_create_slave(SSIBus *bus, const char *name); diff --git a/hw/stellaris.c b/hw/stellaris.c index 38b9830e2..bf339e8aa 100644 --- a/hw/stellaris.c +++ b/hw/stellaris.c @@ -1444,6 +1444,8 @@ static void stellaris_machine_init(void) machine_init(stellaris_machine_init); static SSISlaveInfo stellaris_ssi_bus_info = { + .qdev.name = "evb6965-ssi", + .qdev.size = sizeof(stellaris_ssi_bus_state), .init = stellaris_ssi_bus_init, .transfer = stellaris_ssi_bus_transfer }; @@ -1456,8 +1458,7 @@ static void stellaris_register_devices(void) stellaris_gptm_init); sysbus_register_dev("stellaris-adc", sizeof(stellaris_adc_state), stellaris_adc_init); - ssi_register_slave("evb6965-ssi", sizeof(stellaris_ssi_bus_state), - &stellaris_ssi_bus_info); + ssi_register_slave(&stellaris_ssi_bus_info); } device_init(stellaris_register_devices) diff --git a/hw/syborg_timer.c b/hw/syborg_timer.c index b833330e5..b6d7f0cd4 100644 --- a/hw/syborg_timer.c +++ b/hw/syborg_timer.c @@ -228,18 +228,17 @@ static void syborg_timer_init(SysBusDevice *dev) static SysBusDeviceInfo syborg_timer_info = { .init = syborg_timer_init, - .qdev = { - .props = (DevicePropList[]) { - {.name = "frequency", .type = PROP_TYPE_INT}, - {.name = NULL} - } + .qdev.name = "syborg,timer", + .qdev.size = sizeof(SyborgTimerState), + .qdev.props = (DevicePropList[]) { + {.name = "frequency", .type = PROP_TYPE_INT}, + {.name = NULL} } }; static void syborg_timer_register_devices(void) { - sysbus_register_withprop("syborg,timer", sizeof(SyborgTimerState), - &syborg_timer_info); + sysbus_register_withprop(&syborg_timer_info); } device_init(syborg_timer_register_devices) diff --git a/hw/sysbus.c b/hw/sysbus.c index fbd2ddf39..ef3a7011e 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -105,14 +105,13 @@ static void sysbus_device_init(DeviceState *dev, DeviceInfo *base) info->init(sysbus_from_qdev(dev)); } -void sysbus_register_withprop(const char *name, size_t size, - SysBusDeviceInfo *info) +void sysbus_register_withprop(SysBusDeviceInfo *info) { info->qdev.init = sysbus_device_init; info->qdev.bus_type = BUS_TYPE_SYSTEM; - assert(size >= sizeof(SysBusDevice)); - qdev_register(name, size, &info->qdev); + assert(info->qdev.size >= sizeof(SysBusDevice)); + qdev_register(&info->qdev); } void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init) @@ -120,8 +119,10 @@ void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init) SysBusDeviceInfo *info; info = qemu_mallocz(sizeof(*info)); + info->qdev.name = qemu_strdup(name); + info->qdev.size = size; info->init = init; - sysbus_register_withprop(name, size, info); + sysbus_register_withprop(info); } DeviceState *sysbus_create_varargs(const char *name, diff --git a/hw/sysbus.h b/hw/sysbus.h index 297366166..7c20808f3 100644 --- a/hw/sysbus.h +++ b/hw/sysbus.h @@ -37,8 +37,7 @@ typedef struct { } SysBusDeviceInfo; void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init); -void sysbus_register_withprop(const char *name, size_t size, - SysBusDeviceInfo *info); +void sysbus_register_withprop(SysBusDeviceInfo *info); void *sysbus_new(void); void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size, int iofunc); void sysbus_init_mmio_cb(SysBusDevice *dev, target_phys_addr_t size, diff --git a/hw/tmp105.c b/hw/tmp105.c index 59b039804..5381b7d66 100644 --- a/hw/tmp105.c +++ b/hw/tmp105.c @@ -239,6 +239,8 @@ static void tmp105_init(i2c_slave *i2c) } static I2CSlaveInfo tmp105_info = { + .qdev.name = "tmp105", + .qdev.size = sizeof(TMP105State), .init = tmp105_init, .event = tmp105_event, .recv = tmp105_rx, @@ -247,7 +249,7 @@ static I2CSlaveInfo tmp105_info = { static void tmp105_register_devices(void) { - i2c_register_slave("tmp105", sizeof(TMP105State), &tmp105_info); + i2c_register_slave(&tmp105_info); } device_init(tmp105_register_devices) @@ -252,6 +252,8 @@ static void tosapda_machine_init(void) machine_init(tosapda_machine_init); static I2CSlaveInfo tosa_dac_info = { + .qdev.name = "tosa_dac", + .qdev.size = sizeof(TosaDACState), .init = tosa_dac_init, .event = tosa_dac_event, .recv = tosa_dac_recv, @@ -259,14 +261,16 @@ static I2CSlaveInfo tosa_dac_info = { }; static SSISlaveInfo tosa_ssp_info = { + .qdev.name = "tosa-ssp", + .qdev.size = sizeof(SSISlave), .init = tosa_ssp_init, .transfer = tosa_ssp_tansfer }; static void tosa_register_devices(void) { - i2c_register_slave("tosa_dac", sizeof(TosaDACState), &tosa_dac_info); - ssi_register_slave("tosa-ssp", sizeof(SSISlave), &tosa_ssp_info); + i2c_register_slave(&tosa_dac_info); + ssi_register_slave(&tosa_ssp_info); } device_init(tosa_register_devices) diff --git a/hw/twl92230.c b/hw/twl92230.c index 3a226923b..9960acc8c 100644 --- a/hw/twl92230.c +++ b/hw/twl92230.c @@ -892,6 +892,8 @@ static void twl92230_init(i2c_slave *i2c) } static I2CSlaveInfo twl92230_info = { + .qdev.name ="twl92230", + .qdev.size = sizeof(MenelausState), .init = twl92230_init, .event = menelaus_event, .recv = menelaus_rx, @@ -900,7 +902,7 @@ static I2CSlaveInfo twl92230_info = { static void twl92230_register_devices(void) { - i2c_register_slave("twl92230", sizeof(MenelausState), &twl92230_info); + i2c_register_slave(&twl92230_info); } device_init(twl92230_register_devices) diff --git a/hw/wm8750.c b/hw/wm8750.c index 9f5bd46de..0c0dbba58 100644 --- a/hw/wm8750.c +++ b/hw/wm8750.c @@ -726,6 +726,8 @@ void wm8750_set_bclk_in(void *opaque, int new_hz) } static I2CSlaveInfo wm8750_info = { + .qdev.name = "wm8750", + .qdev.size = sizeof(WM8750State), .init = wm8750_init, .event = wm8750_event, .recv = wm8750_rx, @@ -734,7 +736,7 @@ static I2CSlaveInfo wm8750_info = { static void wm8750_register_devices(void) { - i2c_register_slave("wm8750", sizeof(WM8750State), &wm8750_info); + i2c_register_slave(&wm8750_info); } device_init(wm8750_register_devices) |