Merge remote-tracking branches 'regulator/topic/of', 'regulator/topic/pv88080', ...
authorMark Brown <broonie@kernel.org>
Fri, 30 Sep 2016 16:13:58 +0000 (09:13 -0700)
committerMark Brown <broonie@kernel.org>
Fri, 30 Sep 2016 16:13:58 +0000 (09:13 -0700)
1  2  3  4  5  6 
drivers/regulator/core.c

index c5445ead3203aa3f484f4fb76922b8712714ac1d,db320e8fa865f96c0742777403baab9ac4c218a8,db320e8fa865f96c0742777403baab9ac4c218a8,db320e8fa865f96c0742777403baab9ac4c218a8,c52fc0ce269349a106d8ac81fad65fbd6630e752,db320e8fa865f96c0742777403baab9ac4c218a8..67426c0477d34b2b5805826664bbc4074acfe591
@@@@@@@ -2800,28 -2800,28 -2800,28 -2800,28 -2819,43 -2800,28 +2819,43 @@@@@@@ static int _regulator_do_set_voltage(st
                ret = -EINVAL;
        }
      
---- -  /* Call set_voltage_time_sel if successfully obtained old_selector */
---- -  if (ret == 0 && !rdev->constraints->ramp_disable && old_selector >= 0
---- -          && old_selector != selector) {
++++ +  if (ret)
++++ +          goto out;
      
---- -          delay = rdev->desc->ops->set_voltage_time_sel(rdev,
---- -                                          old_selector, selector);
---- -          if (delay < 0) {
---- -                  rdev_warn(rdev, "set_voltage_time_sel() failed: %d\n",
---- -                            delay);
---- -                  delay = 0;
++++ +  if (ops->set_voltage_time_sel) {
++++ +          /*
++++ +           * Call set_voltage_time_sel if successfully obtained
++++ +           * old_selector
++++ +           */
++++ +          if (old_selector >= 0 && old_selector != selector)
++++ +                  delay = ops->set_voltage_time_sel(rdev, old_selector,
++++ +                                                    selector);
++++ +  } else {
++++ +          if (old_uV != best_val) {
++++ +                  if (ops->set_voltage_time)
++++ +                          delay = ops->set_voltage_time(rdev, old_uV,
++++ +                                                        best_val);
++++ +                  else
++++ +                          delay = _regulator_set_voltage_time(rdev,
++++ +                                                              old_uV,
++++ +                                                              best_val);
                }
++++ +  }
      
---- -          /* Insert any necessary delays */
---- -          if (delay >= 1000) {
---- -                  mdelay(delay / 1000);
---- -                  udelay(delay % 1000);
---- -          } else if (delay) {
---- -                  udelay(delay);
---- -          }
++++ +  if (delay < 0) {
++++ +          rdev_warn(rdev, "failed to get delay: %d\n", delay);
++++ +          delay = 0;
+       }
+     
 --- -  if (ret == 0 && best_val >= 0) {
++++ +  /* Insert any necessary delays */
++++ +  if (delay >= 1000) {
++++ +          mdelay(delay / 1000);
++++ +          udelay(delay % 1000);
++++ +  } else if (delay) {
++++ +          udelay(delay);
 +++ +  }
 +++ +
-       if (ret == 0 && best_val >= 0) {
++++ +  if (best_val >= 0) {
                unsigned long data = best_val;
      
                _notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,