i2c: rcar: simplify check for last message
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sun, 14 Sep 2014 20:14:14 +0000 (00:14 +0400)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 29 Sep 2014 20:41:17 +0000 (22:41 +0200)
rcar_i2c_master_xfer() needlessly compares the message pointers (using indirect
addressing) in order to detect the last I2C message, while it's enough to only
compare the message indexes.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-rcar.c

index e506fcd3ca04350416dce7a640f2483a97d5d34d..98125fb0f3fe93338e5b647d289c926ba88b6faf 100644 (file)
@@ -453,7 +453,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
                priv->msg       = &msgs[i];
                priv->pos       = 0;
                priv->flags     = 0;
-               if (priv->msg == &msgs[num - 1])
+               if (i == num - 1)
                        rcar_i2c_flags_set(priv, ID_LAST_MSG);
 
                ret = rcar_i2c_prepare_msg(priv);