]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/regulator/core.c
Merge remote-tracking branch 'regulator/topic/list' into regulator-next
[mirror_ubuntu-zesty-kernel.git] / drivers / regulator / core.c
index 57a5deb6a9497d677a4ed25acf0e98a525dfbe59..e9b94d7be7c919531a41d33285915b2837310932 100644 (file)
@@ -181,7 +181,7 @@ static int regulator_check_voltage(struct regulator_dev *rdev,
                return -ENODEV;
        }
        if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
-               rdev_err(rdev, "operation not allowed\n");
+               rdev_err(rdev, "voltage operation not allowed\n");
                return -EPERM;
        }
 
@@ -241,7 +241,7 @@ static int regulator_check_current_limit(struct regulator_dev *rdev,
                return -ENODEV;
        }
        if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) {
-               rdev_err(rdev, "operation not allowed\n");
+               rdev_err(rdev, "current operation not allowed\n");
                return -EPERM;
        }
 
@@ -278,7 +278,7 @@ static int regulator_mode_constrain(struct regulator_dev *rdev, int *mode)
                return -ENODEV;
        }
        if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) {
-               rdev_err(rdev, "operation not allowed\n");
+               rdev_err(rdev, "mode operation not allowed\n");
                return -EPERM;
        }
 
@@ -302,7 +302,7 @@ static int regulator_check_drms(struct regulator_dev *rdev)
                return -ENODEV;
        }
        if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) {
-               rdev_dbg(rdev, "operation not allowed\n");
+               rdev_dbg(rdev, "drms operation not allowed\n");
                return -EPERM;
        }
        return 0;
@@ -1439,15 +1439,19 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
                return 0;
 
        r = regulator_dev_lookup(dev, rdev->supply_name, &ret);
-       if (ret == -ENODEV) {
-               /*
-                * No supply was specified for this regulator and
-                * there will never be one.
-                */
-               return 0;
-       }
-
        if (!r) {
+               if (ret == -ENODEV) {
+                       /*
+                        * No supply was specified for this regulator and
+                        * there will never be one.
+                        */
+                       return 0;
+               }
+
+               /* Did the lookup explicitly defer for us? */
+               if (ret == -EPROBE_DEFER)
+                       return ret;
+
                if (have_full_constraints()) {
                        r = dummy_regulator_rdev;
                        get_device(&r->dev);
@@ -1472,11 +1476,10 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
        }
 
        /* Cascade always-on state to supply */
-       if (_regulator_is_enabled(rdev)) {
+       if (_regulator_is_enabled(rdev) && rdev->supply) {
                ret = regulator_enable(rdev->supply);
                if (ret < 0) {
-                       if (rdev->supply)
-                               _regulator_put(rdev->supply);
+                       _regulator_put(rdev->supply);
                        return ret;
                }
        }