[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 2/6] i2c: Add no_init version of i2c_create_slave
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v1 2/6] i2c: Add no_init version of i2c_create_slave |
Date: |
Wed, 20 Feb 2013 15:29:55 +1000 |
Add a version of i2c_create_slave that does not qdev init the created device.
This give the machine model a chance to set properites of the created device
before qdev_init time. Based on equivalent function in ssi.c.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
hw/i2c.c | 11 ++++++++++-
hw/i2c.h | 2 ++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/hw/i2c.c b/hw/i2c.c
index a9004e6..db2a5d9 100644
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -216,12 +216,21 @@ static int i2c_slave_qdev_init(DeviceState *dev)
return sc->init(s);
}
-DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
+
+DeviceState *i2c_create_slave_no_init(i2c_bus *bus, const char *name,
+ uint8_t addr)
{
DeviceState *dev;
dev = qdev_create(&bus->qbus, name);
qdev_prop_set_uint8(dev, "address", addr);
+ return dev;
+}
+
+DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
+{
+ DeviceState *dev = i2c_create_slave_no_init(bus, name, addr);
+
qdev_init_nofail(dev);
return dev;
}
diff --git a/hw/i2c.h b/hw/i2c.h
index 0021125..9f761bc 100644
--- a/hw/i2c.h
+++ b/hw/i2c.h
@@ -68,6 +68,8 @@ int i2c_recv(i2c_bus *bus);
#define FROM_I2C_SLAVE(type, dev) DO_UPCAST(type, i2c, dev)
DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr);
+DeviceState *i2c_create_slave_no_init(i2c_bus *bus, const char *name,
+ uint8_t addr);
/* wm8750.c */
void wm8750_data_req_set(DeviceState *dev,
--
1.7.0.4
- [Qemu-devel] [PATCH v1 0/6] Xilinx Zynq I2C, Peter Crosthwaite, 2013/02/20
- [Qemu-devel] [PATCH v1 2/6] i2c: Add no_init version of i2c_create_slave,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH v1 3/6] cadence_i2c: first revision, Peter Crosthwaite, 2013/02/20
- [Qemu-devel] [PATCH v1 4/6] hw: M24Cxx I2C EEPROM device model, Peter Crosthwaite, 2013/02/20
- [Qemu-devel] [PATCH v1 5/6] hw: pca9548: Device model, Peter Crosthwaite, 2013/02/20
- [Qemu-devel] [PATCH v1 6/6] xilinx_zynq: Add i2c components, Peter Crosthwaite, 2013/02/20