]> git.hungrycats.org Git - linux/commitdiff
i2c: rk3x: report number of messages transmitted
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 20 Apr 2015 22:14:47 +0000 (15:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 May 2015 20:02:01 +0000 (22:02 +0200)
commit c6cbfb91b878224e78408a2e15901c79de77115a upstream.

master_xfer() method should return number of i2c messages transferred,
but on Rockchip we were usually returning just 1, which caused trouble
with users that actually check number of transferred messages vs.
checking for negative error codes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-rk3x.c

index 92462843db663d09b1106468603b1b9eb65243d2..648cea46226974b9b5376619f6aa07a3f206bc4b 100644 (file)
@@ -800,7 +800,7 @@ static int rk3x_i2c_xfer(struct i2c_adapter *adap,
        clk_disable(i2c->clk);
        spin_unlock_irqrestore(&i2c->lock, flags);
 
-       return ret;
+       return ret < 0 ? ret : num;
 }
 
 static u32 rk3x_i2c_func(struct i2c_adapter *adap)