/* NOTE: Regulator system constraints must be set for this regulator before calling this function otherwise this call will fail.  */
int regulator_set_mode(struct regulator *regulator, unsigned int mode)
/* NOTE: Regulator system constraints must be set for this regulator before calling this function otherwise this call will fail.  */
int regulator_set_mode(struct regulator *regulator, unsigned int mode)
{
	struct regulator_dev *rdev = regulator->rdev;
	int ret;
	mutex_lock(&rdev->mutex);
	if (!rdev->desc->ops->set_mode) {
		ret = -EINVAL;
		goto out;
	}
	ret = regulator_check_mode(rdev, mode);
	if (ret < 0)
		goto out;
	ret = rdev->desc->ops->set_mode(rdev, mode);
out:
	mutex_unlock(&rdev->mutex);
	return ret;
}