Re: [PATCH] regulator: Avoid grabbing regulator lock during suspend/resume

From: Doug Anderson
Date: Wed Aug 05 2020 - 00:55:37 EST


Hi,

On Tue, Aug 4, 2020 at 12:08 AM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
>
> I see it takes about 5us per regulator to grab the lock, check that this
> regulator isn't going to do anything for suspend, and then release the
> lock. When that is combined with PMICs that have dozens of regulators we
> get into a state where we spend a few miliseconds doing a bunch of
> locking operations synchronously to figure out that there's nothing to
> do. Let's reorganize the code here a bit so that we don't grab the lock
> until we're actually going to do something so that suspend is a little
> faster.
>
> Cc: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
> Cc: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
> ---
> drivers/regulator/core.c | 75 +++++++++++++++++++++++++++-------------
> 1 file changed, 51 insertions(+), 24 deletions(-)

Looks good to me. Agree that getting a pointer to the relevant
"struct regulator_state" and checking whether some details about it
and our ops should be safe to do without a lock. Patch looks clean
and correct.

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>