Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6: regulator: Fix default constraints for fixed voltage regulators regulator/bq24022: fix bug in is_enabled function regulator/virtual: fix strings compare predicates regulator core: fix double-free in regulator_register() error path drivers/regulator: fix when type is different from REGULATOR_VOLTAGE or REGULATOR_CURRENT unreachable code in drms_uA_update() regulator: fix header file missing kernel-doc
This commit is contained in:
Коммит
8b86bd7a4a
|
@ -61,8 +61,7 @@ static int bq24022_disable(struct regulator_dev *rdev)
|
|||
|
||||
static int bq24022_is_enabled(struct regulator_dev *rdev)
|
||||
{
|
||||
struct platform_device *pdev = rdev_get_drvdata(rdev);
|
||||
struct bq24022_mach_info *pdata = pdev->dev.platform_data;
|
||||
struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
|
||||
|
||||
return !gpio_get_value(pdata->gpio_nce);
|
||||
}
|
||||
|
|
|
@ -540,8 +540,8 @@ static void drms_uA_update(struct regulator_dev *rdev)
|
|||
|
||||
err = regulator_check_drms(rdev);
|
||||
if (err < 0 || !rdev->desc->ops->get_optimum_mode ||
|
||||
!rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode);
|
||||
return;
|
||||
!rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode)
|
||||
return;
|
||||
|
||||
/* get output voltage */
|
||||
output_uV = rdev->desc->ops->get_voltage(rdev);
|
||||
|
@ -703,10 +703,13 @@ static int set_machine_constraints(struct regulator_dev *rdev,
|
|||
int cmin = constraints->min_uV;
|
||||
int cmax = constraints->max_uV;
|
||||
|
||||
/* it's safe to autoconfigure fixed-voltage supplies */
|
||||
/* it's safe to autoconfigure fixed-voltage supplies
|
||||
and the constraints are used by list_voltage. */
|
||||
if (count == 1 && !cmin) {
|
||||
cmin = INT_MIN;
|
||||
cmin = 1;
|
||||
cmax = INT_MAX;
|
||||
constraints->min_uV = cmin;
|
||||
constraints->max_uV = cmax;
|
||||
}
|
||||
|
||||
/* voltage constraints are optional */
|
||||
|
@ -2001,8 +2004,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
|
|||
if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
if (!regulator_desc->type == REGULATOR_VOLTAGE &&
|
||||
!regulator_desc->type == REGULATOR_CURRENT)
|
||||
if (regulator_desc->type != REGULATOR_VOLTAGE &&
|
||||
regulator_desc->type != REGULATOR_CURRENT)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
if (!init_data)
|
||||
|
@ -2080,6 +2083,10 @@ out:
|
|||
|
||||
scrub:
|
||||
device_unregister(&rdev->dev);
|
||||
/* device core frees rdev */
|
||||
rdev = ERR_PTR(ret);
|
||||
goto out;
|
||||
|
||||
clean:
|
||||
kfree(rdev);
|
||||
rdev = ERR_PTR(ret);
|
||||
|
|
|
@ -230,13 +230,13 @@ static ssize_t set_mode(struct device *dev, struct device_attribute *attr,
|
|||
* sysfs_streq() doesn't need the \n's, but we add them so the strings
|
||||
* will be shared with show_mode(), above.
|
||||
*/
|
||||
if (sysfs_streq(buf, "fast\n") == 0)
|
||||
if (sysfs_streq(buf, "fast\n"))
|
||||
mode = REGULATOR_MODE_FAST;
|
||||
else if (sysfs_streq(buf, "normal\n") == 0)
|
||||
else if (sysfs_streq(buf, "normal\n"))
|
||||
mode = REGULATOR_MODE_NORMAL;
|
||||
else if (sysfs_streq(buf, "idle\n") == 0)
|
||||
else if (sysfs_streq(buf, "idle\n"))
|
||||
mode = REGULATOR_MODE_IDLE;
|
||||
else if (sysfs_streq(buf, "standby\n") == 0)
|
||||
else if (sysfs_streq(buf, "standby\n"))
|
||||
mode = REGULATOR_MODE_STANDBY;
|
||||
else {
|
||||
dev_err(dev, "Configuring invalid mode\n");
|
||||
|
|
|
@ -50,6 +50,7 @@ enum regulator_status {
|
|||
* @set_current_limit: Configure a limit for a current-limited regulator.
|
||||
* @get_current_limit: Get the configured limit for a current-limited regulator.
|
||||
*
|
||||
* @set_mode: Set the configured operating mode for the regulator.
|
||||
* @get_mode: Get the configured operating mode for the regulator.
|
||||
* @get_status: Return actual (not as-configured) status of regulator, as a
|
||||
* REGULATOR_STATUS value (or negative errno)
|
||||
|
|
Загрузка…
Ссылка в новой задаче