提交 8fed709f 编写于 作者: L 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 kernel-doc for set_consumer_device_supply
  regulator: enable supply regulator only when use count is zero
  regulator: twl-regulator - fix twlreg_set_mode
  regulator: lock supply in regulator enable
  regulator: Return proper error for regulator_register()
  regulator: Ensure enough delay time for enabling regulator
  regulator: Remove a redundant device_remove_file call in create_regulator
  regulator: Staticise mc13783_powermisc_rmw()
  regulator: regulator disable supply fix
......@@ -911,7 +911,7 @@ static int set_supply(struct regulator_dev *rdev,
}
/**
* set_consumer_device_supply: Bind a regulator to a symbolic supply
* set_consumer_device_supply - Bind a regulator to a symbolic supply
* @rdev: regulator source
* @consumer_dev: device the supply applies to
* @consumer_dev_name: dev_name() string for device supply applies to
......@@ -1052,7 +1052,6 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
printk(KERN_WARNING
"%s: could not add device link %s err %d\n",
__func__, dev->kobj.name, err);
device_remove_file(dev, &regulator->dev_attr);
goto link_name_err;
}
}
......@@ -1268,15 +1267,19 @@ static int _regulator_enable(struct regulator_dev *rdev)
{
int ret, delay;
if (rdev->use_count == 0) {
/* do we need to enable the supply regulator first */
if (rdev->supply) {
mutex_lock(&rdev->supply->mutex);
ret = _regulator_enable(rdev->supply);
mutex_unlock(&rdev->supply->mutex);
if (ret < 0) {
printk(KERN_ERR "%s: failed to enable %s: %d\n",
__func__, rdev_get_name(rdev), ret);
return ret;
}
}
}
/* check voltage and requested load before enabling */
if (rdev->constraints &&
......@@ -1313,10 +1316,12 @@ static int _regulator_enable(struct regulator_dev *rdev)
if (ret < 0)
return ret;
if (delay >= 1000)
if (delay >= 1000) {
mdelay(delay / 1000);
else if (delay)
udelay(delay % 1000);
} else if (delay) {
udelay(delay);
}
} else if (ret < 0) {
printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n",
......@@ -1359,6 +1364,7 @@ static int _regulator_disable(struct regulator_dev *rdev,
struct regulator_dev **supply_rdev_ptr)
{
int ret = 0;
*supply_rdev_ptr = NULL;
if (WARN(rdev->use_count <= 0,
"unbalanced disables for %s\n",
......@@ -2346,6 +2352,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
if (init_data->supply_regulator && init_data->supply_regulator_dev) {
dev_err(dev,
"Supply regulator specified by both name and dev\n");
ret = -EINVAL;
goto scrub;
}
......@@ -2364,6 +2371,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
if (!found) {
dev_err(dev, "Failed to find supply %s\n",
init_data->supply_regulator);
ret = -ENODEV;
goto scrub;
}
......
......@@ -465,7 +465,7 @@ static struct regulator_ops mc13783_fixed_regulator_ops = {
.get_voltage = mc13783_fixed_regulator_get_voltage,
};
int mc13783_powermisc_rmw(struct mc13783_regulator_priv *priv, u32 mask,
static int mc13783_powermisc_rmw(struct mc13783_regulator_priv *priv, u32 mask,
u32 val)
{
struct mc13783 *mc13783 = priv->mc13783;
......
......@@ -219,12 +219,12 @@ static int twlreg_set_mode(struct regulator_dev *rdev, unsigned mode)
return -EACCES;
status = twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
message >> 8, 0x15 /* PB_WORD_MSB */ );
if (status >= 0)
message >> 8, TWL4030_PM_MASTER_PB_WORD_MSB);
if (status < 0)
return status;
return twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
message, 0x16 /* PB_WORD_LSB */ );
message & 0xff, TWL4030_PM_MASTER_PB_WORD_LSB);
}
/*----------------------------------------------------------------------*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册