regulator: debug-regulator: replace regulator_lock() and regulator_unlock()

The regulator_lock() and regulator_unlock() functions were unexported in
commit 4c9db39361 ("regulator: unexport regulator_lock/unlock()").
The debug-regulator library uses these calls to ensure mutual
exclusion while reading regulator device and regulator consumer
states.  It does not rely upon the per-process reentrancy
provided by regulator_lock() and regulator_unlock().  Therefore,
it is safe to replace the calls with ww_mutex_lock() and
ww_mutex_unlock() respectively.  Replace these calls.

Change-Id: I2dc337d5a126191cce8d2ce707ad910770ab2e1e
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
David Collins 2020-11-09 17:15:53 -08:00 committed by David Collins
parent 361f4b3a23
commit 6d41e3c4ee

View File

@ -116,7 +116,7 @@ static int reg_debug_bypass_enable_get(void *data, u64 *val)
bool enable = false;
int ret = 0;
regulator_lock(rdev);
ww_mutex_lock(&rdev->mutex, NULL);
if (rdev->desc->ops->get_bypass) {
ret = rdev->desc->ops->get_bypass(rdev, &enable);
if (ret)
@ -124,7 +124,7 @@ static int reg_debug_bypass_enable_get(void *data, u64 *val)
} else {
enable = (rdev->bypass_count == rdev->open_count);
}
regulator_unlock(rdev);
ww_mutex_unlock(&rdev->mutex);
*val = enable;
@ -307,7 +307,7 @@ static int reg_debug_consumers_show(struct seq_file *m, void *v)
struct regulator *reg;
const char *supply_name;
regulator_lock(rdev);
ww_mutex_lock(&rdev->mutex, NULL);
/* Print a header if there are consumers. */
if (rdev->open_count)
@ -327,7 +327,7 @@ static int reg_debug_consumers_show(struct seq_file *m, void *v)
reg->uA_load);
}
regulator_unlock(rdev);
ww_mutex_unlock(&rdev->mutex);
return 0;
}