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>
This commit is contained in:
parent
57b452a848
commit
074f2fff79
@ -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)
|
||||
|
6
hw/i2c.c
6
hw/i2c.c
@ -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)
|
||||
|
2
hw/i2c.h
2
hw/i2c.h
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
4
hw/pci.c
4
hw/pci.c
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
18
hw/qdev.c
18
hw/qdev.c
@ -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. */
|
||||
|
@ -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. */
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
6
hw/ssi.c
6
hw/ssi.c
@ -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)
|
||||
|
2
hw/ssi.h
2
hw/ssi.h
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
11
hw/sysbus.c
11
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,
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user