Commit 8b86bd7a authored by Linus Torvalds's avatar Linus Torvalds

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
parents c3310e77 3e590918
...@@ -61,8 +61,7 @@ static int bq24022_disable(struct regulator_dev *rdev) ...@@ -61,8 +61,7 @@ static int bq24022_disable(struct regulator_dev *rdev)
static int bq24022_is_enabled(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 = rdev_get_drvdata(rdev);
struct bq24022_mach_info *pdata = pdev->dev.platform_data;
return !gpio_get_value(pdata->gpio_nce); return !gpio_get_value(pdata->gpio_nce);
} }
......
...@@ -540,8 +540,8 @@ static void drms_uA_update(struct regulator_dev *rdev) ...@@ -540,8 +540,8 @@ static void drms_uA_update(struct regulator_dev *rdev)
err = regulator_check_drms(rdev); err = regulator_check_drms(rdev);
if (err < 0 || !rdev->desc->ops->get_optimum_mode || if (err < 0 || !rdev->desc->ops->get_optimum_mode ||
!rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode); !rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode)
return; return;
/* get output voltage */ /* get output voltage */
output_uV = rdev->desc->ops->get_voltage(rdev); output_uV = rdev->desc->ops->get_voltage(rdev);
...@@ -703,10 +703,13 @@ static int set_machine_constraints(struct regulator_dev *rdev, ...@@ -703,10 +703,13 @@ static int set_machine_constraints(struct regulator_dev *rdev,
int cmin = constraints->min_uV; int cmin = constraints->min_uV;
int cmax = constraints->max_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) { if (count == 1 && !cmin) {
cmin = INT_MIN; cmin = 1;
cmax = INT_MAX; cmax = INT_MAX;
constraints->min_uV = cmin;
constraints->max_uV = cmax;
} }
/* voltage constraints are optional */ /* voltage constraints are optional */
...@@ -2001,8 +2004,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, ...@@ -2001,8 +2004,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
if (regulator_desc->name == NULL || regulator_desc->ops == NULL) if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (!regulator_desc->type == REGULATOR_VOLTAGE && if (regulator_desc->type != REGULATOR_VOLTAGE &&
!regulator_desc->type == REGULATOR_CURRENT) regulator_desc->type != REGULATOR_CURRENT)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (!init_data) if (!init_data)
...@@ -2080,6 +2083,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, ...@@ -2080,6 +2083,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
scrub: scrub:
device_unregister(&rdev->dev); device_unregister(&rdev->dev);
/* device core frees rdev */
rdev = ERR_PTR(ret);
goto out;
clean: clean:
kfree(rdev); kfree(rdev);
rdev = ERR_PTR(ret); rdev = ERR_PTR(ret);
......
...@@ -230,13 +230,13 @@ static ssize_t set_mode(struct device *dev, struct device_attribute *attr, ...@@ -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 * sysfs_streq() doesn't need the \n's, but we add them so the strings
* will be shared with show_mode(), above. * will be shared with show_mode(), above.
*/ */
if (sysfs_streq(buf, "fast\n") == 0) if (sysfs_streq(buf, "fast\n"))
mode = REGULATOR_MODE_FAST; mode = REGULATOR_MODE_FAST;
else if (sysfs_streq(buf, "normal\n") == 0) else if (sysfs_streq(buf, "normal\n"))
mode = REGULATOR_MODE_NORMAL; mode = REGULATOR_MODE_NORMAL;
else if (sysfs_streq(buf, "idle\n") == 0) else if (sysfs_streq(buf, "idle\n"))
mode = REGULATOR_MODE_IDLE; mode = REGULATOR_MODE_IDLE;
else if (sysfs_streq(buf, "standby\n") == 0) else if (sysfs_streq(buf, "standby\n"))
mode = REGULATOR_MODE_STANDBY; mode = REGULATOR_MODE_STANDBY;
else { else {
dev_err(dev, "Configuring invalid mode\n"); dev_err(dev, "Configuring invalid mode\n");
......
...@@ -50,6 +50,7 @@ enum regulator_status { ...@@ -50,6 +50,7 @@ enum regulator_status {
* @set_current_limit: Configure a limit for a current-limited regulator. * @set_current_limit: Configure a limit for a current-limited regulator.
* @get_current_limit: Get the configured 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_mode: Get the configured operating mode for the regulator.
* @get_status: Return actual (not as-configured) status of regulator, as a * @get_status: Return actual (not as-configured) status of regulator, as a
* REGULATOR_STATUS value (or negative errno) * REGULATOR_STATUS value (or negative errno)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment