regulator: core: Rename _regulator_enable_delay()
I want to use it in other contexts besides _regulator_do_enable(). Signed-off-by: Brian Norris <briannorris@chromium.org> Link: https://lore.kernel.org/r/20220420141511.v2.1.I31ef0014c9597d53722ab513890f839f357fdfb3@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
bab76514ac
commit
a38dce4cb1
1 changed files with 8 additions and 8 deletions
|
@ -2529,17 +2529,17 @@ static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _regulator_enable_delay - a delay helper function
|
* _regulator_delay_helper - a delay helper function
|
||||||
* @delay: time to delay in microseconds
|
* @delay: time to delay in microseconds
|
||||||
*
|
*
|
||||||
* Delay for the requested amount of time as per the guidelines in:
|
* Delay for the requested amount of time as per the guidelines in:
|
||||||
*
|
*
|
||||||
* Documentation/timers/timers-howto.rst
|
* Documentation/timers/timers-howto.rst
|
||||||
*
|
*
|
||||||
* The assumption here is that regulators will never be enabled in
|
* The assumption here is that these regulator operations will never used in
|
||||||
* atomic context and therefore sleeping functions can be used.
|
* atomic context and therefore sleeping functions can be used.
|
||||||
*/
|
*/
|
||||||
static void _regulator_enable_delay(unsigned int delay)
|
static void _regulator_delay_helper(unsigned int delay)
|
||||||
{
|
{
|
||||||
unsigned int ms = delay / 1000;
|
unsigned int ms = delay / 1000;
|
||||||
unsigned int us = delay % 1000;
|
unsigned int us = delay % 1000;
|
||||||
|
@ -2621,7 +2621,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
|
||||||
s64 remaining = ktime_us_delta(end, ktime_get());
|
s64 remaining = ktime_us_delta(end, ktime_get());
|
||||||
|
|
||||||
if (remaining > 0)
|
if (remaining > 0)
|
||||||
_regulator_enable_delay(remaining);
|
_regulator_delay_helper(remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rdev->ena_pin) {
|
if (rdev->ena_pin) {
|
||||||
|
@ -2648,14 +2648,14 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
|
||||||
/* If poll_enabled_time is set, poll upto the delay calculated
|
/* If poll_enabled_time is set, poll upto the delay calculated
|
||||||
* above, delaying poll_enabled_time uS to check if the regulator
|
* above, delaying poll_enabled_time uS to check if the regulator
|
||||||
* actually got enabled.
|
* actually got enabled.
|
||||||
* If the regulator isn't enabled after enable_delay has
|
* If the regulator isn't enabled after our delay helper has expired,
|
||||||
* expired, return -ETIMEDOUT.
|
* return -ETIMEDOUT.
|
||||||
*/
|
*/
|
||||||
if (rdev->desc->poll_enabled_time) {
|
if (rdev->desc->poll_enabled_time) {
|
||||||
unsigned int time_remaining = delay;
|
unsigned int time_remaining = delay;
|
||||||
|
|
||||||
while (time_remaining > 0) {
|
while (time_remaining > 0) {
|
||||||
_regulator_enable_delay(rdev->desc->poll_enabled_time);
|
_regulator_delay_helper(rdev->desc->poll_enabled_time);
|
||||||
|
|
||||||
if (rdev->desc->ops->get_status) {
|
if (rdev->desc->ops->get_status) {
|
||||||
ret = _regulator_check_status_enabled(rdev);
|
ret = _regulator_check_status_enabled(rdev);
|
||||||
|
@ -2674,7 +2674,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_regulator_enable_delay(delay);
|
_regulator_delay_helper(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_regulator_enable_complete(rdev_get_name(rdev));
|
trace_regulator_enable_complete(rdev_get_name(rdev));
|
||||||
|
|
Loading…
Add table
Reference in a new issue