aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2018-11-30 13:49:31 -0600
committerCorey Minyard <cminyard@mvista.com>2019-02-27 21:06:08 -0600
commit031ac49886684ae6d6b88f37779cad2ffd1e4d9b (patch)
tree9d33dd036c80d688f252dc25811844467f3792f1 /include
parent9cf27d74a829f651c0da5d80c014a6cef9d4cbd8 (diff)
downloadqemu-031ac49886684ae6d6b88f37779cad2ffd1e4d9b.zip
qemu-031ac49886684ae6d6b88f37779cad2ffd1e4d9b.tar.gz
qemu-031ac49886684ae6d6b88f37779cad2ffd1e4d9b.tar.bz2
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')
-rw-r--r--include/hw/i2c/smbus_slave.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/include/hw/i2c/smbus_slave.h b/include/hw/i2c/smbus_slave.h
index fa92201..79050fb 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 {