Merge remote-tracking branches 'regulator/topic/can-change', 'regulator/topic/constra...
authorMark Brown <broonie@kernel.org>
Fri, 13 May 2016 13:23:27 +0000 (14:23 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 13 May 2016 13:23:27 +0000 (14:23 +0100)
1  2  3  4  5 
drivers/regulator/core.c
include/linux/regulator/driver.h

@@@@@@ -913,32 -914,15 -890,34 -914,15 -914,15 +888,34 @@@@@@ static int machine_constraints_voltage(
                                 current_uV);
                        return current_uV;
                }
 - --           if (current_uV < rdev->constraints->min_uV ||
 - --               current_uV > rdev->constraints->max_uV) {
 + ++
 + ++           /*
 + ++            * If we're below the minimum voltage move up to the
 + ++            * minimum voltage, if we're above the maximum voltage
 + ++            * then move down to the maximum.
 + ++            */
 + ++           target_min = current_uV;
 + ++           target_max = current_uV;
 + ++
 + ++           if (current_uV < rdev->constraints->min_uV) {
 + ++                   target_min = rdev->constraints->min_uV;
 + ++                   target_max = rdev->constraints->min_uV;
 + ++           }
 + ++
 + ++           if (current_uV > rdev->constraints->max_uV) {
 + ++                   target_min = rdev->constraints->max_uV;
 + ++                   target_max = rdev->constraints->max_uV;
 + ++           }
 + ++
 + ++           if (target_min != current_uV || target_max != current_uV) {
++ ++                   rdev_info(rdev, "Bringing %duV into %d-%duV\n",
++ ++                             current_uV, target_min, target_max);
                        ret = _regulator_do_set_voltage(
 - --                           rdev, rdev->constraints->min_uV,
 - --                           rdev->constraints->max_uV);
 + ++                           rdev, target_min, target_max);
                        if (ret < 0) {
                                rdev_err(rdev,
 - --                                   "failed to apply %duV constraint(%d)\n",
 - --                                   rdev->constraints->min_uV, ret);
 + ++                                   "failed to apply %d-%duV constraint(%d)\n",
 + ++                                   target_min, target_max, ret);
                                return ret;
                        }
                }
@@@@@@ -4019,21 -3983,11 -3973,11 -4035,11 -3983,11 +4043,21 @@@@@@ regulator_register(const struct regulat
                                goto unset_supplies;
                        }
                }
 ++++           mutex_unlock(&regulator_list_mutex);
 +  +   }
 +  +
 ++++   ret = device_register(&rdev->dev);
 ++++   if (ret != 0) {
 ++++           put_device(&rdev->dev);
 ++++           goto unset_supplies;
  ++    }
  ++ 
 ++++   dev_set_drvdata(&rdev->dev, rdev);
        rdev_init_debugfs(rdev);
 ----out:
 ----   mutex_unlock(&regulator_list_mutex);
 ++++
 ++++   /* try to resolve regulators supply since a new one was registered */
 ++++   class_for_each_device(&regulator_class, NULL, NULL,
 ++++                         regulator_register_resolve_supply);
        kfree(config);
        return rdev;
     
Simple merge