summaryrefslogtreecommitdiff
path: root/drivers/i2c/i2c-slave-eeprom.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2015-03-23 11:26:36 +0300
committerWolfram Sang <wsa@the-dreams.de>2015-03-27 18:53:38 +0300
commit5b77d162a3d7359a8a8d83776720da065bf4e77b (patch)
tree84c5ae531f925ddc961ee467736bb62553031b66 /drivers/i2c/i2c-slave-eeprom.c
parent4a7a08226dd590a139e5f7835fe93f90b3beee90 (diff)
downloadlinux-5b77d162a3d7359a8a8d83776720da065bf4e77b.tar.xz
i2c: slave: rework the slave API
After more discussion, brave users, and additional datasheet evaluation, some API updates for the new I2C slave framework became imminent. The slave events now get some easier to understand naming. Also, the event handling has been simplified to only need a single call to the slave callback when an action by the backend is required. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/i2c-slave-eeprom.c')
-rw-r--r--drivers/i2c/i2c-slave-eeprom.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c
index cf9b09db092f..3fb45d894d80 100644
--- a/drivers/i2c/i2c-slave-eeprom.c
+++ b/drivers/i2c/i2c-slave-eeprom.c
@@ -36,7 +36,7 @@ static int i2c_slave_eeprom_slave_cb(struct i2c_client *client,
struct eeprom_data *eeprom = i2c_get_clientdata(client);
switch (event) {
- case I2C_SLAVE_REQ_WRITE_END:
+ case I2C_SLAVE_WRITE_RECEIVED:
if (eeprom->first_write) {
eeprom->buffer_idx = *val;
eeprom->first_write = false;
@@ -47,17 +47,17 @@ static int i2c_slave_eeprom_slave_cb(struct i2c_client *client,
}
break;
- case I2C_SLAVE_REQ_READ_START:
+ case I2C_SLAVE_READ_PROCESSED:
+ eeprom->buffer_idx++;
+ /* fallthrough */
+ case I2C_SLAVE_READ_REQUESTED:
spin_lock(&eeprom->buffer_lock);
*val = eeprom->buffer[eeprom->buffer_idx];
spin_unlock(&eeprom->buffer_lock);
break;
- case I2C_SLAVE_REQ_READ_END:
- eeprom->buffer_idx++;
- break;
-
case I2C_SLAVE_STOP:
+ case I2C_SLAVE_WRITE_REQUESTED:
eeprom->first_write = true;
break;