Re: [PATCH 5/6] i2c: tegra: Add runtime power-management support

From: Jon Hunter
Date: Thu Aug 25 2016 - 16:55:08 EST



On 25/08/16 20:26, Wolfram Sang wrote:
> * PGP Signed by an unknown key
>
>
>> @@ -407,32 +410,39 @@ static inline int tegra_i2c_clock_enable(struct tegra_i2c_dev *i2c_dev)
>> return ret;
>> }
>> }
>> +
>> ret = clk_enable(i2c_dev->div_clk);
>> if (ret < 0) {
>> dev_err(i2c_dev->dev,
>> "Enabling div clk failed, err %d\n", ret);
>> clk_disable(i2c_dev->fast_clk);
>> + return ret;
>> }
>> - return ret;
>> +
>> + return 0;
>
> You could have left the original 'return' instead of the 2 new ones, but
> you decide.

Yes I know, but I wanted to ensure for runtime-pm we only return 0 on
success. Yes clk_enable should only return 0 on success and a negative
error code otherwise, but I prefer this. So will leave as-is.

>> - if (tegra_i2c_flush_fifos(i2c_dev))
>> - err = -ETIMEDOUT;
>> + err = tegra_i2c_flush_fifos(i2c_dev);
>
> 'err' is assigned but where is it checked?

It will be returned by the function. This is no different to how it
works today if you look at the code. I did think about checking it right
after this call and returning but then I am changing the behaviour and
that should be another patch. I am not sure why it is like this in the
first place, but I did not wish to introduce any different behaviour here.

Cheers
Jon

--
nvpublic