lkml.org 
[lkml]   [2020]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 06/36] i2c: tegra: Runtime PM always available on Tegra
From
Date
07.09.2020 18:05, Andy Shevchenko пишет:
> On Mon, Sep 7, 2020 at 5:32 PM Dmitry Osipenko <digetx@gmail.com> wrote:
>> 07.09.2020 11:10, Andy Shevchenko пишет:
>>> On Sun, Sep 6, 2020 at 9:51 PM Dmitry Osipenko <digetx@gmail.com> wrote:
>>>>
>>>> The runtime PM is guaranteed to be always available on Tegra after commit
>>>> 40b2bb1b132a ("ARM: tegra: enforce PM requirement"). Hence let's remove
>>>> all the RPM-availability checking and handling from the code.
>>>
>>>> + ret = pm_runtime_get_sync(i2c_dev->dev);
>>>> + if (ret < 0) {
>>>> + dev_err(dev, "runtime resume failed\n");
>>>> + goto disable_rpm;
>>>
>>> As in the original code here is a refcount leak.
>>> Should call pm_runtime_put_noidle(). (Possible to use goto put_rpm;
>>> but in that case the code a bit confusing to the reader)
>>
>> Good point! I already forgot about this RPM API problem! I'll add a
>> patch to address this.
>>
>> Would be great if anyone could put effort into changing the default
>> get_sync() behaviour and add get_sync_nofail(). Otherwise this will be a
>> never ending problem.
>
> I didn't get this. For time being the API (yes, with its all cons) has
> the clear usage:
> a) don't check for errors -- you are fine
> b) if you start checking errors, keep in mind refcounting.
>
> So, I don't see how nofail() can fix b) case.
>

It's a very unintuitive behaviour which none of other APIs have. I would
never expect the refcount to be bumped in a case of error, this is a
clear drawback of the API, IMO. Perhaps this is not seen as a problem by
people who have excellent memory and can easily remember about existence
of such non-standard quirks, or by people who're touching the RPM code
frequently.

\
 
 \ /
  Last update: 2020-09-07 17:28    [W:0.160 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site