diff options
author | Paul Brook <paul@codesourcery.com> | 2009-05-23 00:05:19 +0100 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2009-05-23 00:13:41 +0100 |
commit | 02e2da45c4601909d5105838323d5c529ec7010b (patch) | |
tree | e9b1099baa55c3f8084110feb28f57ede8d2de3a /hw/i2c.h | |
parent | 4856fcff8af1ba349baaf063af00f5e5d87a99f4 (diff) |
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 <paul@codesourcery.com>
Diffstat (limited to 'hw/i2c.h')
-rw-r--r-- | hw/i2c.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -25,6 +25,8 @@ typedef void (*i2c_event_cb)(i2c_slave *s, enum i2c_event event); typedef void (*i2c_slave_initfn)(i2c_slave *dev); typedef struct { + DeviceInfo qdev; + /* Callbacks provided by the device. */ i2c_slave_initfn init; i2c_event_cb event; @@ -39,11 +41,9 @@ struct i2c_slave /* Remaining fields for internal use by the I2C code. */ int address; - void *next; - i2c_bus *bus; }; -i2c_bus *i2c_init_bus(void); +i2c_bus *i2c_init_bus(DeviceState *parent, const char *name); void i2c_set_slave_address(i2c_slave *dev, int address); int i2c_bus_busy(i2c_bus *bus); int i2c_start_transfer(i2c_bus *bus, int address, int recv); |