Re: [PATCH 00/13 v2] Regulator ena_gpiod fixups

From: Linus Walleij
Date: Tue Dec 04 2018 - 07:44:48 EST


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.

Yours,
Linus Walleij