Re: [PATCH] [ARM] tegra: Add i2c support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 30, 2010 at 1:44 PM, Mike Rapoport <mike.rapoport@xxxxxxxxx> wrote:
> Hi Colin,
>
> On Fri, Jul 30, 2010 at 3:36 AM, Colin Cross <ccross@xxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux