mfd: Avoid to use constraint name in 88pm860x regulator driver

Avoid to use constraint name in regulator driver. So use regulator id is used
instead in platform driver.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Haojian Zhuang
2011-05-06 17:21:23 +08:00
committed by Samuel Ortiz
parent ebf9988eca
commit 586e1a1763
2 changed files with 21 additions and 39 deletions

View File

@@ -398,32 +398,33 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
{
struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
struct pm8607_regulator_info *info = NULL;
struct regulator_init_data *pdata;
struct regulator_init_data *pdata = pdev->dev.platform_data;
struct resource *res;
int i;
pdata = pdev->dev.platform_data;
if (pdata == NULL)
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
if (res == NULL) {
dev_err(&pdev->dev, "No I/O resource!\n");
return -EINVAL;
}
for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) {
info = &pm8607_regulator_info[i];
if (!strcmp(info->desc.name, pdata->constraints.name))
if (info->desc.id == res->start)
break;
}
if (i > ARRAY_SIZE(pm8607_regulator_info)) {
dev_err(&pdev->dev, "Failed to find regulator %s\n",
pdata->constraints.name);
if ((i < 0) || (i > PM8607_ID_RG_MAX)) {
dev_err(&pdev->dev, "Failed to find regulator %d\n",
res->start);
return -EINVAL;
}
info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
info->chip = chip;
/* check DVC ramp slope double */
if (!strcmp(info->desc.name, "BUCK3"))
if (info->chip->buck3_double)
info->slope_double = 1;
if ((i == PM8607_ID_BUCK3) && info->chip->buck3_double)
info->slope_double = 1;
/* replace driver_data with info */
info->regulator = regulator_register(&info->desc, &pdev->dev,
pdata, info);
if (IS_ERR(info->regulator)) {