aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/regulator/core.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 73b7683355cd..c70017d5f74b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -138,18 +138,10 @@ static bool have_full_constraints(void)
138 */ 138 */
139static void regulator_lock_supply(struct regulator_dev *rdev) 139static void regulator_lock_supply(struct regulator_dev *rdev)
140{ 140{
141 struct regulator *supply; 141 int i;
142 int i = 0;
143
144 while (1) {
145 mutex_lock_nested(&rdev->mutex, i++);
146 supply = rdev->supply;
147
148 if (!rdev->supply)
149 return;
150 142
151 rdev = supply->rdev; 143 for (i = 0; rdev->supply; rdev = rdev->supply->rdev, i++)
152 } 144 mutex_lock_nested(&rdev->mutex, i);
153} 145}
154 146
155/** 147/**