[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160419110313.GA8284@ulmo.ba.sec>
Date: Tue, 19 Apr 2016 13:03:13 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: Jon Hunter <jonathanh@...dia.com>
Cc: Mark Brown <broonie@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/5] regulator: core: Resolve supply earlier
On Tue, Apr 19, 2016 at 11:16:59AM +0100, Jon Hunter wrote:
>
> On 11/04/16 15:16, Mark Brown wrote:
> > * PGP Signed by an unknown key
> >
> > On Mon, Apr 11, 2016 at 04:11:01PM +0200, Thierry Reding wrote:
> >> On Mon, Apr 11, 2016 at 03:03:00PM +0100, Mark Brown wrote:
> >
> >>> This shouldn't be a hard dependency: most regulators won't be in bypass
> >>> mode or otherwise depend on their parents enough to need this.
> >
> >> I had initially proposed to resolve the supply only when necessary
> >> during regulator_get_voltage() when checking for bypass, perhaps that
> >> would after all be more appropriate here?
> >
> > Yes, that had been what I'd expected.
>
> So the following seems to work, but only item I am uncertain about
> is if it is ok to move the mutex_lock to after the
> machine_set_constraints()?
>
> Jon
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 61d3918f329e..742d10371e2d 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -3126,8 +3126,13 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
> return ret;
> if (bypassed) {
> /* if bypassed the regulator must have a supply */
> - if (!rdev->supply)
> - return -EINVAL;
> + if (!rdev->supply) {
> + ret = regulator_resolve_supply(rdev);
> + if (ret < 0)
> + return ret;
> + if (!rdev->supply)
> + return -EINVAL;
> + }
>
> return _regulator_get_voltage(rdev->supply->rdev);
> }
> @@ -3939,8 +3944,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
> rdev->dev.of_node = of_node_get(config->of_node);
> }
>
> - mutex_lock(®ulator_list_mutex);
It seems like this is used to protect accesses to the list of enable
GPIOs (regulator_ena_gpio_list), which is modified in the call to the
regulator_ena_gpio_request() function below.
That would be easily solved giving that its own lock, though.
Thierry
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists