Re: [PATCH 00/13 v2] Regulator ena_gpiod fixups
From: Marek Szyprowski
Date: Wed Dec 05 2018 - 09:30:29 EST
Hi Linus,
On 2018-12-04 13:44, Linus Walleij wrote:
> On Tue, Dec 4, 2018 at 11:33 AM Marek Szyprowski
> <m.szyprowski@xxxxxxxxxxx> wrote:
>
>>>> Artik5 evaluation board (arch/arm/boot/dts/exynos3250-artik5-eval.dtb):
>>>> s2mps11-pmic s2mps14-regulator: Failed to get control GPIO for 11/LDO12
>>> Question: this is supposed to fail, right? It is something
>>> like a probe deferral or nonexisting GPIO controller?
>> It looks that the issue has been introduced earlier, but I didn't notice it.
> Sorry :(
>
>> gpiod_get_from_of_node() doesn't handle GPIOD_FLAGS_BIT_NONEXCLUSIVE
>> flag, the rest is just a result of it.
> OK I see.
>
>> Here we have a case, where 2 regulators provided by s2mps11 driver have
>> a common gpio enable line (by PMIC design), so s2mps11 calls
>> devm_gpiod_get_from_of_node() 2 times for exactly the same gpio descriptor.
>>
>> Fixing gpiod_get_from_of_node() for GPIOD_FLAGS_BIT_NONEXCLUSIVE is trivial:
> I will add a patch like this to the series!
>
>> With the above fix I still however get 2 warnings from devres functions,
>> but this is probably caused by adding the same entry 2 times to the list
>> without proper refcounting... I will check that later.
> Ah I see this regulator driver really excercise all corner cases of
> these nonexclusive GPIO lines. (Which is good!)
>
> Indeed devres is not going to like adding the same thing twice.
>
> I just sent a fix for that, subject:
> "gpio: devres: Handle nonexclusive GPIOs"
> you could perhaps try it on top of this
> series? I intend to merge that separately as a fix for current,
> as it is a bug.
Those 2 warnings were worrying me and I finally found! devres_*
functions require to pass a pointer to the pointer as match_data, so
desc must be passed as &desc to devres_find() and devres_destroy()
functions, otherwise they always return -ENOENT. I will comment
respective lines in your patches then.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland