regulator: Fix for v5.17

One fix here, for initialisation of regulators that don't have an
 in_enabled() operation which would mainly impact cases where they aren't
 otherwise used during early setup for some reason.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmIKg5cACgkQJNaLcl1U
 h9DYPQf/b2E70Q4mu/pFF1ldQHJrfyd4XuwP/+Ay1iHY8az+fKniipy+YD/+Hth3
 ownNwNuQowHnMK606+jvgr+2nFahRMbuOjX7JZS7dGZ3F62v8D9rRglD7XVIxoRa
 7n/xzAFxMYuWph25yrtr3xHqfdEKmEmfhT0pWNmajCu6s+f9J96qjDmSubDUZp1Q
 nVEvwSYmZ7NFZJu+1fINpRIqni7veXyQwfFTZpHZvQWW5CFY8o4RtKoQ3tkAcXp8
 GGRqSw9dfIpaqql8WHjEEI03kiWVepC541ZNBedzJrsDG0PbVuG+HNvQHFhDQjnO
 Ii9FEE0GdDXvd05uZoZGLk4yMXa0Kg==
 =Qkqf
 -----END PGP SIGNATURE-----

Merge tag 'regulator-fix-v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fix from Mark Brown:
 "One fix here, for initialisation of regulators that don't have an
  in_enabled() operation which would mainly impact cases where they
  aren't otherwise used during early setup for some reason"

* tag 'regulator-fix-v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: core: fix false positive in regulator_late_cleanup()
This commit is contained in:
Linus Torvalds 2022-02-14 09:51:26 -08:00
commit d567f5db41

View File

@ -6014,9 +6014,8 @@ core_initcall(regulator_init);
static int regulator_late_cleanup(struct device *dev, void *data)
{
struct regulator_dev *rdev = dev_to_rdev(dev);
const struct regulator_ops *ops = rdev->desc->ops;
struct regulation_constraints *c = rdev->constraints;
int enabled, ret;
int ret;
if (c && c->always_on)
return 0;
@ -6029,14 +6028,8 @@ static int regulator_late_cleanup(struct device *dev, void *data)
if (rdev->use_count)
goto unlock;
/* If we can't read the status assume it's always on. */
if (ops->is_enabled)
enabled = ops->is_enabled(rdev);
else
enabled = 1;
/* But if reading the status failed, assume that it's off. */
if (enabled <= 0)
/* If reading the status failed, assume that it's off. */
if (_regulator_is_enabled(rdev) <= 0)
goto unlock;
if (have_full_constraints()) {