dev->buf_len will always contain the correct number we're looking for. No need to read from BUFSTAT register. Signed-off-by: Felipe Balbi <balbi@xxxxxx> --- drivers/i2c/busses/i2c-omap.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 5a7a223..f2ab95a 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -934,18 +934,15 @@ omap_i2c_threaded_isr(int this_irq, void *dev_id) if (stat & OMAP_I2C_STAT_RDR) { u8 num_bytes = 1; - if (dev->errata & I2C_OMAP_ERRATA_I207) - i2c_omap_errata_i207(dev, stat); - - if (dev->fifo_size) { - num_bytes = omap_i2c_read_reg(dev, - OMAP_I2C_BUFSTAT_REG); - num_bytes >>= 8; - num_bytes &= 0x3f; - } + if (dev->fifo_size) + num_bytes = dev->buf_len; omap_i2c_receive_data(dev, num_bytes, true); omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR); + + if (dev->errata & I2C_OMAP_ERRATA_I207) + i2c_omap_errata_i207(dev, stat); + continue; } @@ -964,11 +961,8 @@ omap_i2c_threaded_isr(int this_irq, void *dev_id) int ret; u8 num_bytes = 1; - if (dev->fifo_size) { - num_bytes = omap_i2c_read_reg(dev, - OMAP_I2C_BUFSTAT_REG); - num_bytes &= 0x3f; - } + if (dev->fifo_size) + num_bytes = dev->buf_len; ret = omap_i2c_transmit_data(dev, num_bytes, true); stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html