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;
}
}
goto unset_supplies;
}
}
++++ mutex_unlock(®ulator_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(®ulator_list_mutex);
++++
++++ /* try to resolve regulators supply since a new one was registered */
++++ class_for_each_device(®ulator_class, NULL, NULL,
++++ regulator_register_resolve_supply);
kfree(config);
return rdev;