[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181121100743.GF16508@imbe.wolfsonmicro.main>
Date: Wed, 21 Nov 2018 10:07:43 +0000
From: Charles Keepax <ckeepax@...nsource.cirrus.com>
To: Marek Szyprowski <m.szyprowski@...sung.com>
CC: <broonie@...nel.org>, <linus.walleij@...aro.org>,
<lgirdwood@...il.com>, <linux-kernel@...r.kernel.org>,
<patches@...nsource.cirrus.com>
Subject: Re: [PATCH] regulator: wm8994: Don't use devres for enable GPIOs
On Wed, Nov 21, 2018 at 10:26:30AM +0100, Marek Szyprowski wrote:
> On 2018-11-20 18:25, Marek Szyprowski wrote:
> > On 2018-11-20 18:01, Charles Keepax wrote:
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 1 at drivers/gpio/gpiolib.c:2421
> > regulator_ena_gpio_free+0x70/0xa0
>
> I've checked a bit more and it looks that the issue is caused by
> gpiod_put() in regulator_ena_gpio_free(). I've removed gpiod_put() call
> from wm8994_ldo_remove(), switched to regulator_register() in
> wm8994_ldo_probe() and added regulator_unregister() in
> wm8994_ldo_remove(). This way the warning is gone. If there is any
> other, simpler way to fix it, let me know. When regulator_register()
> fails, gpiod will be freed only in some cases, depending what caused
> failure. It looks that this needs some clarification...
>
Ah.. ok, so is perhaps what is happening here that both the
devm_gpio_get and the regualtor_ena_gpio_free are both trying to
free the GPIO? I assume the regulator core does this to handle
the case of shared GPIOs, so presumably the correct fix would
just be to switch from devm_gpiod_get to just plain gpiod_get and
not add the additional gpiod_put in wm8994_ldo_remove, as the
regulator core will handle freeing the GPIO for us.
I will respin the patch and lets see where that gets us to.
Thanks,
Charles
Powered by blists - more mailing lists