]> git.baikalelectronics.ru Git - kernel.git/commit
regulator: Fix lockdep warning resolving supplies
authorMark Brown <broonie@kernel.org>
Fri, 22 Jan 2021 13:20:42 +0000 (13:20 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 22 Jan 2021 14:03:07 +0000 (14:03 +0000)
commitcb8083e0576f41a14c4fa3d929aaa0a6c6f7a244
tree9b8c1e9d09c28e66d79c0bf8d49b0ee89ce630ff
parentfcc14c226a01352adbd9f3f8e0cb45b57b5d0ccd
regulator: Fix lockdep warning resolving supplies

With commit 22772950654997 (regulator: core: avoid
regulator_resolve_supply() race condition) we started holding the rdev
lock while resolving supplies, an operation that requires holding the
regulator_list_mutex. This results in lockdep warnings since in other
places we take the list mutex then the mutex on an individual rdev.

Since the goal is to make sure that we don't call set_supply() twice
rather than a concern about the cost of resolution pull the rdev lock
and check for duplicate resolution down to immediately before we do the
set_supply() and drop it again once the allocation is done.

Fixes: 22772950654997 (regulator: core: avoid regulator_resolve_supply() race condition)
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210122132042.10306-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c