aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-28 19:06:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-28 19:06:33 -0400
commit8b86bd7a4a82157d386aebafbe1bdf26bdf3d713 (patch)
tree197acc909e754da972d709ad463783c23575df66
parentc3310e7766ebe7491910715c3161a4f29fa0112e (diff)
parent3e59091828ed5406c879b899b4257fcef7271e2c (diff)
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
-rw-r--r--drivers/regulator/bq24022.c3
-rw-r--r--drivers/regulator/core.c19
-rw-r--r--drivers/regulator/virtual.c8
-rw-r--r--include/linux/regulator/driver.h1
4 files changed, 19 insertions, 12 deletions
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c
index 7ecb820ceebc..d08cd9b66c6d 100644
--- a/drivers/regulator/bq24022.c
+++ b/drivers/regulator/bq24022.c
@@ -61,8 +61,7 @@ static int bq24022_disable(struct regulator_dev *rdev)
61 61
62static int bq24022_is_enabled(struct regulator_dev *rdev) 62static int bq24022_is_enabled(struct regulator_dev *rdev)
63{ 63{
64 struct platform_device *pdev = rdev_get_drvdata(rdev); 64 struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
65 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
66 65
67 return !gpio_get_value(pdata->gpio_nce); 66 return !gpio_get_value(pdata->gpio_nce);
68} 67}
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 01f7702a805d..98c3a74e9949 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -540,8 +540,8 @@ static void drms_uA_update(struct regulator_dev *rdev)
540 540
541 err = regulator_check_drms(rdev); 541 err = regulator_check_drms(rdev);
542 if (err < 0 || !rdev->desc->ops->get_optimum_mode || 542 if (err < 0 || !rdev->desc->ops->get_optimum_mode ||
543 !rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode); 543 !rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode)
544 return; 544 return;
545 545
546 /* get output voltage */ 546 /* get output voltage */
547 output_uV = rdev->desc->ops->get_voltage(rdev); 547 output_uV = rdev->desc->ops->get_voltage(rdev);
@@ -703,10 +703,13 @@ static int set_machine_constraints(struct regulator_dev *rdev,
703 int cmin = constraints->min_uV; 703 int cmin = constraints->min_uV;
704 int cmax = constraints->max_uV; 704 int cmax = constraints->max_uV;
705 705
706 /* it's safe to autoconfigure fixed-voltage supplies */ 706 /* it's safe to autoconfigure fixed-voltage supplies
707 and the constraints are used by list_voltage. */
707 if (count == 1 && !cmin) { 708 if (count == 1 && !cmin) {
708 cmin = INT_MIN; 709 cmin = 1;
709 cmax = INT_MAX; 710 cmax = INT_MAX;
711 constraints->min_uV = cmin;
712 constraints->max_uV = cmax;
710 } 713 }
711 714
712 /* voltage constraints are optional */ 715 /* voltage constraints are optional */
@@ -2001,8 +2004,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
2001 if (regulator_desc->name == NULL || regulator_desc->ops == NULL) 2004 if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
2002 return ERR_PTR(-EINVAL); 2005 return ERR_PTR(-EINVAL);
2003 2006
2004 if (!regulator_desc->type == REGULATOR_VOLTAGE && 2007 if (regulator_desc->type != REGULATOR_VOLTAGE &&
2005 !regulator_desc->type == REGULATOR_CURRENT) 2008 regulator_desc->type != REGULATOR_CURRENT)
2006 return ERR_PTR(-EINVAL); 2009 return ERR_PTR(-EINVAL);
2007 2010
2008 if (!init_data) 2011 if (!init_data)
@@ -2080,6 +2083,10 @@ out:
2080 2083
2081scrub: 2084scrub:
2082 device_unregister(&rdev->dev); 2085 device_unregister(&rdev->dev);
2086 /* device core frees rdev */
2087 rdev = ERR_PTR(ret);
2088 goto out;
2089
2083clean: 2090clean:
2084 kfree(rdev); 2091 kfree(rdev);
2085 rdev = ERR_PTR(ret); 2092 rdev = ERR_PTR(ret);
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c
index 3d08348584e1..71403fa3ffa1 100644
--- a/drivers/regulator/virtual.c
+++ b/drivers/regulator/virtual.c
@@ -230,13 +230,13 @@ static ssize_t set_mode(struct device *dev, struct device_attribute *attr,
230 * sysfs_streq() doesn't need the \n's, but we add them so the strings 230 * sysfs_streq() doesn't need the \n's, but we add them so the strings
231 * will be shared with show_mode(), above. 231 * will be shared with show_mode(), above.
232 */ 232 */
233 if (sysfs_streq(buf, "fast\n") == 0) 233 if (sysfs_streq(buf, "fast\n"))
234 mode = REGULATOR_MODE_FAST; 234 mode = REGULATOR_MODE_FAST;
235 else if (sysfs_streq(buf, "normal\n") == 0) 235 else if (sysfs_streq(buf, "normal\n"))
236 mode = REGULATOR_MODE_NORMAL; 236 mode = REGULATOR_MODE_NORMAL;
237 else if (sysfs_streq(buf, "idle\n") == 0) 237 else if (sysfs_streq(buf, "idle\n"))
238 mode = REGULATOR_MODE_IDLE; 238 mode = REGULATOR_MODE_IDLE;
239 else if (sysfs_streq(buf, "standby\n") == 0) 239 else if (sysfs_streq(buf, "standby\n"))
240 mode = REGULATOR_MODE_STANDBY; 240 mode = REGULATOR_MODE_STANDBY;
241 else { 241 else {
242 dev_err(dev, "Configuring invalid mode\n"); 242 dev_err(dev, "Configuring invalid mode\n");
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 4848d8dacd90..225f733e7533 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -50,6 +50,7 @@ enum regulator_status {
50 * @set_current_limit: Configure a limit for a current-limited regulator. 50 * @set_current_limit: Configure a limit for a current-limited regulator.
51 * @get_current_limit: Get the configured limit for a current-limited regulator. 51 * @get_current_limit: Get the configured limit for a current-limited regulator.
52 * 52 *
53 * @set_mode: Set the configured operating mode for the regulator.
53 * @get_mode: Get the configured operating mode for the regulator. 54 * @get_mode: Get the configured operating mode for the regulator.
54 * @get_status: Return actual (not as-configured) status of regulator, as a 55 * @get_status: Return actual (not as-configured) status of regulator, as a
55 * REGULATOR_STATUS value (or negative errno) 56 * REGULATOR_STATUS value (or negative errno)