Merge remote-tracking branches 'regulator/topic/anatop', 'regulator/topic/disable...
[cascardo/linux.git] / drivers / regulator / core.c
index 55a87a2..e225711 100644 (file)
@@ -828,7 +828,7 @@ static void print_constraints(struct regulator_dev *rdev)
        if (!count)
                sprintf(buf, "no parameters");
 
-       rdev_info(rdev, "%s\n", buf);
+       rdev_dbg(rdev, "%s\n", buf);
 
        if ((constraints->min_uV != constraints->max_uV) &&
            !(constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE))
@@ -1713,6 +1713,8 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev)
                                gpiod_put(pin->gpiod);
                                list_del(&pin->list);
                                kfree(pin);
+                               rdev->ena_pin = NULL;
+                               return;
                        } else {
                                pin->request_count--;
                        }
@@ -1976,9 +1978,18 @@ static int _regulator_disable(struct regulator_dev *rdev)
 
                /* we are last user */
                if (_regulator_can_change_status(rdev)) {
+                       ret = _notifier_call_chain(rdev,
+                                                  REGULATOR_EVENT_PRE_DISABLE,
+                                                  NULL);
+                       if (ret & NOTIFY_STOP_MASK)
+                               return -EINVAL;
+
                        ret = _regulator_do_disable(rdev);
                        if (ret < 0) {
                                rdev_err(rdev, "failed to disable\n");
+                               _notifier_call_chain(rdev,
+                                               REGULATOR_EVENT_ABORT_DISABLE,
+                                               NULL);
                                return ret;
                        }
                        _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,
@@ -2035,9 +2046,16 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
 {
        int ret = 0;
 
+       ret = _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
+                       REGULATOR_EVENT_PRE_DISABLE, NULL);
+       if (ret & NOTIFY_STOP_MASK)
+               return -EINVAL;
+
        ret = _regulator_do_disable(rdev);
        if (ret < 0) {
                rdev_err(rdev, "failed to force disable\n");
+               _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
+                               REGULATOR_EVENT_ABORT_DISABLE, NULL);
                return ret;
        }