aboutsummaryrefslogtreecommitdiff
path: root/hw/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/i2c')
-rw-r--r--hw/i2c/core.c5
-rw-r--r--hw/i2c/smbus_eeprom.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index d413a192ed..1aac457a2a 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -11,6 +11,7 @@
#include "hw/i2c/i2c.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
+#include "qapi/error.h"
#include "qemu/module.h"
#include "trace.h"
@@ -270,9 +271,9 @@ DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr)
{
DeviceState *dev;
- dev = qdev_create(&bus->qbus, name);
+ dev = qdev_new(name);
qdev_prop_set_uint8(dev, "address", addr);
- qdev_init_nofail(dev);
+ qdev_realize_and_unref(dev, &bus->qbus, &error_fatal);
return dev;
}
diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c
index e199fc8678..b7def9eeb8 100644
--- a/hw/i2c/smbus_eeprom.c
+++ b/hw/i2c/smbus_eeprom.c
@@ -169,11 +169,11 @@ void smbus_eeprom_init_one(I2CBus *smbus, uint8_t address, uint8_t *eeprom_buf)
{
DeviceState *dev;
- dev = qdev_create((BusState *) smbus, TYPE_SMBUS_EEPROM);
+ dev = qdev_new(TYPE_SMBUS_EEPROM);
qdev_prop_set_uint8(dev, "address", address);
/* FIXME: use an array of byte or block backend property? */
SMBUS_EEPROM(dev)->init_data = eeprom_buf;
- qdev_init_nofail(dev);
+ qdev_realize_and_unref(dev, (BusState *)smbus, &error_fatal);
}
void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom,