Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chunyan Zhang and committed by
Mark Brown
aa27bbc6 72069f99

+2 -77
-74
drivers/regulator/core.c
··· 4179 4179 } 4180 4180 EXPORT_SYMBOL_GPL(regulator_unregister); 4181 4181 4182 - static 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 - */ 4202 - int 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 - } 4211 - EXPORT_SYMBOL_GPL(regulator_suspend_prepare); 4212 - 4213 - static 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 - } 4237 - unlock: 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 - */ 4250 - int regulator_suspend_finish(void) 4251 - { 4252 - return class_for_each_device(&regulator_class, NULL, NULL, 4253 - _regulator_suspend_finish); 4254 - } 4255 - EXPORT_SYMBOL_GPL(regulator_suspend_finish); 4256 4182 4257 4183 /** 4258 4184 * regulator_has_full_constraints - the system has fully specified constraints
+2 -3
include/linux/regulator/machine.h
··· 236 236 237 237 #ifdef CONFIG_REGULATOR 238 238 void regulator_has_full_constraints(void); 239 - int regulator_suspend_prepare(suspend_state_t state); 240 - int regulator_suspend_finish(void); 241 239 #else 242 240 static inline void regulator_has_full_constraints(void) 243 241 { 244 242 } 243 + #endif 244 + 245 245 static inline int regulator_suspend_prepare(suspend_state_t state) 246 246 { 247 247 return 0; ··· 250 250 { 251 251 return 0; 252 252 } 253 - #endif 254 253 255 254 #endif