regulator: Fixes for v3.14-rc5
A couple of fixes here which ensure that regulators using the core support for GPIO enables work in all cases by ensuring that helpers are used consistently rather than open coding in places and hence not having GPIO support in some of them. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJTFU8hAAoJELSic+t+oim9SmgP+wVddsDf+4igNw6Lo5JTW368 aY5m6ulB8XIwCtYQhsLHzUIcVbY3/p1zY+cdi0VmmINja3qHCE30H4Asq/LjcT9U 1DI4Z20CgUOST5PZDKK5+sILSro/AxfsnGyIIj5F9YhX3wl46jUfrw2us5fbPDJU ny3NnUM8R/fFIzOd0ishxcY3L1GSe/4a2Ob9uqsq/tPWAeHKoDVAefN6wUeFhulI 0CVlrRaL/FGnnbdcQ+TZgKxm7TXRrUkLqrUR2RxZr7Olk2ZEQhT18OcncdFesIM2 F9GuXE+QL04QrTeLVOsPXWqmcS0UzJqy2luNBbMfOQ/K/JY/lyL6wrLlVi4snfcX v2GrrPQTJ13IU/itBtAMOtWmjJlg3r91vYgqXu05T/7Lt2DCkp3YfUZ6UDjwDe1c K4l/l/VwbUPur3NhMupZO+Ohfe+grp2+UPCUC6McmNWAEJSZPoGA7lNo618ZfrQQ x3ByYcIit9dpTNw6j0rWbgOqsZ4VscW32gSJd+QXAqxolbvnbDnRDHNjS4O9sx1k rHHZk8oDvhkfp4ptSkWQeuDUEAZsuidlonQMdfQl1+T2yZnxE19G3CwmPA94itAk i8owlr+Fp3YcDoE8jaRf2JFKiKHC5f3dF5ceDqFufMk0a+nqEGkOj/RmGch3y3wz itzqO0PcRi/YEsoTW7dt =Vx3C -----END PGP SIGNATURE----- Merge tag 'regulator-v3.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator Pull regulator fixes from Mark Brown: "A couple of fixes here which ensure that regulators using the core support for GPIO enables work in all cases by ensuring that helpers are used consistently rather than open coding in places and hence not having GPIO support in some of them" * tag 'regulator-v3.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: core: Replace direct ops->disable usage regulator: core: Replace direct ops->enable usage
This commit is contained in:
commit
16e3f5391c
1 changed files with 20 additions and 28 deletions
|
@ -953,6 +953,8 @@ static int machine_constraints_current(struct regulator_dev *rdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int _regulator_do_enable(struct regulator_dev *rdev);
|
||||
|
||||
/**
|
||||
* set_machine_constraints - sets regulator constraints
|
||||
* @rdev: regulator source
|
||||
|
@ -1013,10 +1015,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,
|
|||
/* If the constraints say the regulator should be on at this point
|
||||
* and we have control then make sure it is enabled.
|
||||
*/
|
||||
if ((rdev->constraints->always_on || rdev->constraints->boot_on) &&
|
||||
ops->enable) {
|
||||
ret = ops->enable(rdev);
|
||||
if (ret < 0) {
|
||||
if (rdev->constraints->always_on || rdev->constraints->boot_on) {
|
||||
ret = _regulator_do_enable(rdev);
|
||||
if (ret < 0 && ret != -EINVAL) {
|
||||
rdev_err(rdev, "failed to enable\n");
|
||||
goto out;
|
||||
}
|
||||
|
@ -1907,8 +1908,6 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
|
|||
|
||||
trace_regulator_disable_complete(rdev_get_name(rdev));
|
||||
|
||||
_notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,
|
||||
NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1932,6 +1931,8 @@ static int _regulator_disable(struct regulator_dev *rdev)
|
|||
rdev_err(rdev, "failed to disable\n");
|
||||
return ret;
|
||||
}
|
||||
_notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
rdev->use_count = 0;
|
||||
|
@ -1984,20 +1985,16 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
/* force disable */
|
||||
if (rdev->desc->ops->disable) {
|
||||
/* ah well, who wants to live forever... */
|
||||
ret = rdev->desc->ops->disable(rdev);
|
||||
if (ret < 0) {
|
||||
rdev_err(rdev, "failed to force disable\n");
|
||||
return ret;
|
||||
}
|
||||
/* notify other consumers that power has been forced off */
|
||||
_notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
|
||||
REGULATOR_EVENT_DISABLE, NULL);
|
||||
ret = _regulator_do_disable(rdev);
|
||||
if (ret < 0) {
|
||||
rdev_err(rdev, "failed to force disable\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
_notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
|
||||
REGULATOR_EVENT_DISABLE, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3630,23 +3627,18 @@ int regulator_suspend_finish(void)
|
|||
|
||||
mutex_lock(®ulator_list_mutex);
|
||||
list_for_each_entry(rdev, ®ulator_list, list) {
|
||||
struct regulator_ops *ops = rdev->desc->ops;
|
||||
|
||||
mutex_lock(&rdev->mutex);
|
||||
if ((rdev->use_count > 0 || rdev->constraints->always_on) &&
|
||||
ops->enable) {
|
||||
error = ops->enable(rdev);
|
||||
if (rdev->use_count > 0 || rdev->constraints->always_on) {
|
||||
error = _regulator_do_enable(rdev);
|
||||
if (error)
|
||||
ret = error;
|
||||
} else {
|
||||
if (!have_full_constraints())
|
||||
goto unlock;
|
||||
if (!ops->disable)
|
||||
goto unlock;
|
||||
if (!_regulator_is_enabled(rdev))
|
||||
goto unlock;
|
||||
|
||||
error = ops->disable(rdev);
|
||||
error = _regulator_do_disable(rdev);
|
||||
if (error)
|
||||
ret = error;
|
||||
}
|
||||
|
@ -3820,7 +3812,7 @@ static int __init regulator_init_complete(void)
|
|||
ops = rdev->desc->ops;
|
||||
c = rdev->constraints;
|
||||
|
||||
if (!ops->disable || (c && c->always_on))
|
||||
if (c && c->always_on)
|
||||
continue;
|
||||
|
||||
mutex_lock(&rdev->mutex);
|
||||
|
@ -3841,7 +3833,7 @@ static int __init regulator_init_complete(void)
|
|||
/* We log since this may kill the system if it
|
||||
* goes wrong. */
|
||||
rdev_info(rdev, "disabling\n");
|
||||
ret = ops->disable(rdev);
|
||||
ret = _regulator_do_disable(rdev);
|
||||
if (ret != 0)
|
||||
rdev_err(rdev, "couldn't disable: %d\n", ret);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue