Skip to content

Commit a69064e

Browse files
committed
Merge remote-tracking branch 'regulator/fix/core' into regulator-linus
2 parents 569dbb8 + c9ccaa0 commit a69064e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/regulator/core.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,14 @@ static void regulator_disable_work(struct work_struct *work)
23962396
count = rdev->deferred_disables;
23972397
rdev->deferred_disables = 0;
23982398

2399+
/*
2400+
* Workqueue functions queue the new work instance while the previous
2401+
* work instance is being processed. Cancel the queued work instance
2402+
* as the work instance under processing does the job of the queued
2403+
* work instance.
2404+
*/
2405+
cancel_delayed_work(&rdev->disable_work);
2406+
23992407
for (i = 0; i < count; i++) {
24002408
ret = _regulator_disable(rdev);
24012409
if (ret != 0)
@@ -2439,10 +2447,10 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)
24392447

24402448
mutex_lock(&rdev->mutex);
24412449
rdev->deferred_disables++;
2450+
mod_delayed_work(system_power_efficient_wq, &rdev->disable_work,
2451+
msecs_to_jiffies(ms));
24422452
mutex_unlock(&rdev->mutex);
24432453

2444-
queue_delayed_work(system_power_efficient_wq, &rdev->disable_work,
2445-
msecs_to_jiffies(ms));
24462454
return 0;
24472455
}
24482456
EXPORT_SYMBOL_GPL(regulator_disable_deferred);

0 commit comments

Comments
 (0)