regulator: Only enable disabled regulators on resume
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Mon, 2 Mar 2015 20:40:39 +0000 (21:40 +0100)
committerSasha Levin <sasha.levin@oracle.com>
Sat, 28 Mar 2015 13:51:30 +0000 (09:51 -0400)
commit4aeea72574f75e4727d1b7c78bdd970b415e8a0f
tree8a35c640aa5ff217b594d9f4571599118401aabf
parent084968adf59f1cd61a9451a0be1ba384eafe6d04
regulator: Only enable disabled regulators on resume

[ Upstream commit 0548bf4f5ad6fc3bd93c4940fa48078b34609682 ]

The _regulator_do_enable() call ought to be a no-op when called on an
already-enabled regulator.  However, as an optimization
_regulator_enable() doesn't call _regulator_do_enable() on an already
enabled regulator.  That means we never test the case of calling
_regulator_do_enable() during normal usage and there may be hidden
bugs or warnings.  We have seen warnings issued by the tps65090 driver
and bugs when using the GPIO enable pin.

Let's match the same optimization that _regulator_enable() in
regulator_suspend_finish().  That may speed up suspend/resume and also
avoids exposing hidden bugs.

[Use much clearer commit message from Doug Anderson]

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/regulator/core.c