]> git.dujemihanovic.xyz Git - u-boot.git/commit
power: regulator: Only run autoset once for each regulator
authorJonas Karlman <jonas@kwiboo.se>
Mon, 21 Aug 2023 22:30:24 +0000 (22:30 +0000)
committerKever Yang <kever.yang@rock-chips.com>
Sat, 7 Oct 2023 08:49:41 +0000 (16:49 +0800)
commitd99fb64a98af3bebf6b0c134291c4fb89e177aa2
treeca0af2bac0df1e72fb3d2ead9152aa7d5ee47223
parenta9e9445ea2bb010444621e563a79bc33fe064f9c
power: regulator: Only run autoset once for each regulator

With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter"), keeping regulator enablement in balance become more important.
Calling regulator_autoset multiple times on a fixed regulator increase
the enable count for each call, resulting in an unbalanced enable count.

Introduce a AUTOSET_DONE flag and use it to mark that autoset has run
for the regulator. Return -EALREADY on any subsequent call to autoset.

This fixes so that the enable count is only ever increased by one per
regulator for autoset.

Fixes: 4fcba5d556b4 ("regulator: implement basic reference counter")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
drivers/power/regulator/regulator-uclass.c
include/power/regulator.h