aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChunyan Zhang <zhang.chunyan@linaro.org>2018-01-26 08:08:46 -0500
committerMark Brown <broonie@kernel.org>2018-01-26 09:43:51 -0500
commitaa27bbc6c6c60227c096d515f55ffe6cdfef7d2b (patch)
tree95ae3585d1cef8bb267076af8073d5b0f30e0276 /drivers
parent72069f9957a11896e79e95c8b55ec815e97c2187 (diff)
regulator: empty the old suspend functions
Regualtor suspend/resume functions should only be called by PM suspend core via registering dev_pm_ops, and regulator devices should implement the callback functions. Thus, any regulator consumer shouldn't call the regulator suspend/resume functions directly. In order to avoid compile errors, two empty functions with the same name still be left for the time being. Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/core.c74
1 files changed, 0 insertions, 74 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5ea80e94eb69..080c2334edc5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4179,80 +4179,6 @@ void regulator_unregister(struct regulator_dev *rdev)
4179} 4179}
4180EXPORT_SYMBOL_GPL(regulator_unregister); 4180EXPORT_SYMBOL_GPL(regulator_unregister);
4181 4181
4182static int _regulator_suspend_prepare(struct device *dev, void *data)
4183{
4184 struct regulator_dev *rdev = dev_to_rdev(dev);
4185 const suspend_state_t *state = data;
4186 int ret;
4187
4188 mutex_lock(&rdev->mutex);
4189 ret = suspend_prepare(rdev, *state);
4190 mutex_unlock(&rdev->mutex);
4191
4192 return ret;
4193}
4194
4195/**
4196 * regulator_suspend_prepare - prepare regulators for system wide suspend
4197 * @state: system suspend state
4198 *
4199 * Configure each regulator with it's suspend operating parameters for state.
4200 * This will usually be called by machine suspend code prior to supending.
4201 */
4202int regulator_suspend_prepare(suspend_state_t state)
4203{
4204 /* ON is handled by regulator active state */
4205 if (state == PM_SUSPEND_ON)
4206 return -EINVAL;
4207
4208 return class_for_each_device(&regulator_class, NULL, &state,
4209 _regulator_suspend_prepare);
4210}
4211EXPORT_SYMBOL_GPL(regulator_suspend_prepare);
4212
4213static int _regulator_suspend_finish(struct device *dev, void *data)
4214{
4215 struct regulator_dev *rdev = dev_to_rdev(dev);
4216 int ret;
4217
4218 mutex_lock(&rdev->mutex);
4219 if (rdev->use_count > 0 || rdev->constraints->always_on) {
4220 if (!_regulator_is_enabled(rdev)) {
4221 ret = _regulator_do_enable(rdev);
4222 if (ret)
4223 dev_err(dev,
4224 "Failed to resume regulator %d\n",
4225 ret);
4226 }
4227 } else {
4228 if (!have_full_constraints())
4229 goto unlock;
4230 if (!_regulator_is_enabled(rdev))
4231 goto unlock;
4232
4233 ret = _regulator_do_disable(rdev);
4234 if (ret)
4235 dev_err(dev, "Failed to suspend regulator %d\n", ret);
4236 }
4237unlock:
4238 mutex_unlock(&rdev->mutex);
4239
4240 /* Keep processing regulators in spite of any errors */
4241 return 0;
4242}
4243
4244/**
4245 * regulator_suspend_finish - resume regulators from system wide suspend
4246 *
4247 * Turn on regulators that might be turned off by regulator_suspend_prepare
4248 * and that should be turned on according to the regulators properties.
4249 */
4250int regulator_suspend_finish(void)
4251{
4252 return class_for_each_device(&regulator_class, NULL, NULL,
4253 _regulator_suspend_finish);
4254}
4255EXPORT_SYMBOL_GPL(regulator_suspend_finish);
4256 4182
4257/** 4183/**
4258 * regulator_has_full_constraints - the system has fully specified constraints 4184 * regulator_has_full_constraints - the system has fully specified constraints