Merge remote-tracking branches 'regulator/fix/gpio', 'regulator/fix/put' and 'regulat...
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 15 Nov 2012 02:16:02 +0000 (11:16 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 15 Nov 2012 02:16:02 +0000 (11:16 +0900)
1  2  3 
drivers/regulator/core.c

diff --combined drivers/regulator/core.c
index aa4d28b5984e9ea6ebd5bd95383e2885a749cfe6,3ebc06b280abc02b92e2adf2d705a4cc980c6537,27eb9d66f06a653da86018450cdb91de905cc03f..e872c8be080ed427a2e546efffee50c12acdd9fe
@@@@ -1381,22 -1381,14 -1381,22 +1381,14 @@@@ struct regulator *regulator_get_exclusi
   }
   EXPORT_SYMBOL_GPL(regulator_get_exclusive);
   
- -/**
- - * regulator_put - "free" the regulator source
- - * @regulator: regulator source
- - *
- - * Note: drivers must ensure that all regulator_enable calls made on this
- - * regulator source are balanced by regulator_disable calls prior to calling
- - * this function.
- - */
- -void regulator_put(struct regulator *regulator)
+ +/* Locks held by regulator_put() */
+ +static void _regulator_put(struct regulator *regulator)
   {
        struct regulator_dev *rdev;
   
        if (regulator == NULL || IS_ERR(regulator))
                return;
   
- -     mutex_lock(&regulator_list_mutex);
        rdev = regulator->rdev;
   
        debugfs_remove_recursive(regulator->debugfs);
        rdev->exclusive = 0;
   
        module_put(rdev->owner);
+ +}
+ +
+ +/**
+ + * regulator_put - "free" the regulator source
+ + * @regulator: regulator source
+ + *
+ + * Note: drivers must ensure that all regulator_enable calls made on this
+ + * regulator source are balanced by regulator_disable calls prior to calling
+ + * this function.
+ + */
+ +void regulator_put(struct regulator *regulator)
+ +{
+ +     mutex_lock(&regulator_list_mutex);
+ +     _regulator_put(regulator);
        mutex_unlock(&regulator_list_mutex);
   }
   EXPORT_SYMBOL_GPL(regulator_put);
@@@@ -1974,7 -1980,7 -1974,7 +1980,7 @@@@ int regulator_is_supported_voltage(stru
        if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
                ret = regulator_get_voltage(regulator);
                if (ret >= 0)
--                      return (min_uV >= ret && ret <= max_uV);
++                      return (min_uV <= ret && ret <= max_uV);
                else
                        return ret;
        }
@@@@ -3365,7 -3371,7 -3365,7 +3371,7 @@@@ regulator_register(const struct regulat
                if (ret != 0) {
                        rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
                                 config->ena_gpio, ret);
 --                     goto clean;
 ++                     goto wash;
                }
   
                rdev->ena_gpio = config->ena_gpio;
@@@@ -3445,11 -3451,10 -3445,10 +3451,11 @@@@ unset_supplies
   
   scrub:
        if (rdev->supply)
- -             regulator_put(rdev->supply);
+ +             _regulator_put(rdev->supply);
        if (rdev->ena_gpio)
                gpio_free(rdev->ena_gpio);
        kfree(rdev->constraints);
 ++wash:
        device_unregister(&rdev->dev);
        /* device core frees rdev */
        rdev = ERR_PTR(ret);