i2c: sh_mobile: avoid unnecessary register read
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 9 Nov 2017 22:20:53 +0000 (23:20 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 27 Nov 2017 17:53:23 +0000 (18:53 +0100)
There is no data when the first WAIT interrupt arrives. No need to read
something then.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-sh_mobile.c

index 80561ff..40a66d4 100644 (file)
@@ -433,8 +433,9 @@ static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd)
                                break;
                        }
                        data = i2c_op(pd, OP_RX_STOP_DATA, 0);
-               } else
+               } else if (real_pos >= 0) {
                        data = i2c_op(pd, OP_RX, 0);
+               }
 
                if (real_pos >= 0)
                        pd->msg->buf[real_pos] = data;