lkml.org 
[lkml]   [2017]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] regulator: core: Fix race on multiple calls to regulator_disable_deferred()
Date
The old code has two issues:
1) When multiple consumers call regulator_disable_deferred() close in time,
always the delay requested in the first call is used.
2) When a consumer calls regulator_disable_deferred(), but enables and
calls regulator_disable_deferred() again before the timer fires, the timer
isn't reset.

Both issues can cause the regulator to get disabled early.

Signed-off-by: Harald Geyer <harald@ccbib.org>
---
drivers/regulator/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cc68604..ce4923b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2449,8 +2449,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)
rdev->deferred_disables++;
mutex_unlock(&rdev->mutex);

- queue_delayed_work(system_power_efficient_wq, &rdev->disable_work,
- msecs_to_jiffies(ms));
+ mod_fwd_delayed_work(system_power_efficient_wq, &rdev->disable_work,
+ msecs_to_jiffies(ms));
return 0;
}
EXPORT_SYMBOL_GPL(regulator_disable_deferred);
--
2.1.4
\
 
 \ /
  Last update: 2017-02-22 19:21    [W:0.079 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site