i2c: i2c-tegra: Return error code on partial master_xfer transfer
authorColin Cross <ccross@android.com>
Thu, 30 Dec 2010 05:15:12 +0000 (21:15 -0800)
committerColin Cross <ccross@android.com>
Tue, 4 Jan 2011 22:55:39 +0000 (14:55 -0800)
It is unclear what the correct return value is when
master_xfer gets an error part way through a set of
messages, but other drivers seem to return the error
code of the individual failed message instead of
the number of successful messages.  Convert the Tegra
i2c driver to do the same.

Change-Id: Iacda4b6d7591bfe644b93564b93356a0cda3134f
Signed-off-by: Colin Cross <ccross@android.com>
drivers/i2c/busses/i2c-tegra.c

index b7481f496ec3709ac7c8e8e349b3742d0aad1dde..91aa11ce0de288f7ff1c2ecaafb48e87664fd53f 100755 (executable)
@@ -512,13 +512,16 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
                int stop = (i == (num - 1)) ? 1  : 0;
                ret = tegra_i2c_xfer_msg(i2c_bus, &msgs[i], stop);
                if (ret)
-                       break;
+                       goto out;
        }
+       ret = i;
+
+out:
        clk_disable(i2c_dev->clk);
 
        rt_mutex_unlock(&i2c_dev->dev_lock);
 
-       return i;
+       return ret;
 }
 
 static u32 tegra_i2c_func(struct i2c_adapter *adap)