diff options
author | Corey Minyard | 2018-11-30 20:49:31 +0100 |
---|---|---|
committer | Corey Minyard | 2019-02-28 04:06:08 +0100 |
commit | 031ac49886684ae6d6b88f37779cad2ffd1e4d9b (patch) | |
tree | 9d33dd036c80d688f252dc25811844467f3792f1 /include/hw/i2c | |
parent | i2c:smbus: Simplify write operation (diff) | |
download | qemu-031ac49886684ae6d6b88f37779cad2ffd1e4d9b.tar.gz qemu-031ac49886684ae6d6b88f37779cad2ffd1e4d9b.tar.xz qemu-031ac49886684ae6d6b88f37779cad2ffd1e4d9b.zip |
i2c:smbus: Simplify read handling
There were two different read functions, and with the removal of
the command passed in there is no functional difference. So remove
one of them. With that you don't need one of the states, so that
can be removed, too.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'include/hw/i2c')
-rw-r--r-- | include/hw/i2c/smbus_slave.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/include/hw/i2c/smbus_slave.h b/include/hw/i2c/smbus_slave.h index fa92201ec6..79050fb92d 100644 --- a/include/hw/i2c/smbus_slave.h +++ b/include/hw/i2c/smbus_slave.h @@ -47,8 +47,6 @@ typedef struct SMBusDeviceClass */ void (*quick_cmd)(SMBusDevice *dev, uint8_t read); - uint8_t (*receive_byte)(SMBusDevice *dev); - /* * We can't distinguish between a word write and a block write with * length 1, so pass the whole data block including the length byte @@ -59,11 +57,16 @@ typedef struct SMBusDeviceClass */ int (*write_data)(SMBusDevice *dev, uint8_t *buf, uint8_t len); - /* Likewise we can't distinguish between different reads, or even know - the length of the read until the read is complete, so read data a - byte at a time. The device is responsible for adding the length - byte on block reads. */ - uint8_t (*read_data)(SMBusDevice *dev, int n); + /* + * Likewise we can't distinguish between different reads, or even know + * the length of the read until the read is complete, so read data a + * byte at a time. The device is responsible for adding the length + * byte on block reads. This call cannot fail, it should return + * something, preferably 0xff if nothing is available. + * This may be NULL if no data is read from the device. Reads will + * return 0xff in that case. + */ + uint8_t (*receive_byte)(SMBusDevice *dev); } SMBusDeviceClass; struct SMBusDevice { |