[PATCH] [ARM] tegra: Add i2c support

Colin Cross ccross at google.com
Thu Sep 2 17:42:53 EDT 2010


On Fri, Jul 30, 2010 at 1:44 PM, Mike Rapoport <mike.rapoport at gmail.com> wrote:
> Hi Colin,
>
> On Fri, Jul 30, 2010 at 3:36 AM, Colin Cross <ccross at google.com> wrote:
>> +static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
>> +       int num)
>> +{
>> +       struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(adap);
>> +       int i;
>> +       int ret = 0;
>> +
>> +       if (i2c_dev->is_suspended)
>> +               return -EBUSY;
>> +
>> +       clk_enable(i2c_dev->clk);
>> +       for (i = 0; i < num; i++) {
>> +               int stop = (i == (num - 1)) ? 1  : 0;
>> +               ret = tegra_i2c_xfer_msg(i2c_dev, &msgs[i], stop);
>> +               if (ret)
>> +                       break;
>> +       }
>> +       clk_disable(i2c_dev->clk);
>> +       return i;
>
> In case of error the i2c_transfer should return the error code, so the
> return statement should be
>       return ret ?: i;

Done



More information about the linux-arm-kernel mailing list