aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-05-12 01:47:50 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-05-27 05:49:09 -0400
commit77fa44d0e10711e899788c58fe53f8f7b18c7f67 (patch)
treefb2a0313778dd0ade523162506af3a0835e2ccc3 /drivers/regulator
parentc01e36dde4632e0a7474fddf0716f1e54f01f13e (diff)
regulator: Fix desc_id for tps65023/6507x/65910
The desc_id variable should not be a static variable. The rest of the code assumes the desc_id must less than TPSxxxxx_NUM_REGULATOR. If we set desc_id to be a static variable, checking the return value of rdev_get_id() may return error. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Anuj Aggarwal <anuj.aggarwal@ti.com> Cc: Graeme Gregory <gg@slimlogic.co.uk> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/tps65023-regulator.c3
-rw-r--r--drivers/regulator/tps6507x-regulator.c3
-rw-r--r--drivers/regulator/tps65910-regulator.c3
3 files changed, 3 insertions, 6 deletions
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index 60a7ca5409e9..fbddc15e1811 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -466,7 +466,6 @@ static struct regulator_ops tps65023_ldo_ops = {
466static int __devinit tps_65023_probe(struct i2c_client *client, 466static int __devinit tps_65023_probe(struct i2c_client *client,
467 const struct i2c_device_id *id) 467 const struct i2c_device_id *id)
468{ 468{
469 static int desc_id;
470 const struct tps_info *info = (void *)id->driver_data; 469 const struct tps_info *info = (void *)id->driver_data;
471 struct regulator_init_data *init_data; 470 struct regulator_init_data *init_data;
472 struct regulator_dev *rdev; 471 struct regulator_dev *rdev;
@@ -499,7 +498,7 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
499 tps->info[i] = info; 498 tps->info[i] = info;
500 499
501 tps->desc[i].name = info->name; 500 tps->desc[i].name = info->name;
502 tps->desc[i].id = desc_id++; 501 tps->desc[i].id = i;
503 tps->desc[i].n_voltages = num_voltages[i]; 502 tps->desc[i].n_voltages = num_voltages[i];
504 tps->desc[i].ops = (i > TPS65023_DCDC_3 ? 503 tps->desc[i].ops = (i > TPS65023_DCDC_3 ?
505 &tps65023_ldo_ops : &tps65023_dcdc_ops); 504 &tps65023_ldo_ops : &tps65023_dcdc_ops);
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index 064755290599..bfffabc21eda 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -553,7 +553,6 @@ static __devinit
553int tps6507x_pmic_probe(struct platform_device *pdev) 553int tps6507x_pmic_probe(struct platform_device *pdev)
554{ 554{
555 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); 555 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
556 static int desc_id;
557 struct tps_info *info = &tps6507x_pmic_regs[0]; 556 struct tps_info *info = &tps6507x_pmic_regs[0];
558 struct regulator_init_data *init_data; 557 struct regulator_init_data *init_data;
559 struct regulator_dev *rdev; 558 struct regulator_dev *rdev;
@@ -598,7 +597,7 @@ int tps6507x_pmic_probe(struct platform_device *pdev)
598 } 597 }
599 598
600 tps->desc[i].name = info->name; 599 tps->desc[i].name = info->name;
601 tps->desc[i].id = desc_id++; 600 tps->desc[i].id = i;
602 tps->desc[i].n_voltages = num_voltages[i]; 601 tps->desc[i].n_voltages = num_voltages[i];
603 tps->desc[i].ops = (i > TPS6507X_DCDC_3 ? 602 tps->desc[i].ops = (i > TPS6507X_DCDC_3 ?
604 &tps6507x_pmic_ldo_ops : &tps6507x_pmic_dcdc_ops); 603 &tps6507x_pmic_ldo_ops : &tps6507x_pmic_dcdc_ops);
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index d461fa7906b8..048ba47e058f 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -604,7 +604,6 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
604 struct regulator_dev *rdev; 604 struct regulator_dev *rdev;
605 struct tps65910_reg *pmic; 605 struct tps65910_reg *pmic;
606 struct tps65910_board *pmic_plat_data; 606 struct tps65910_board *pmic_plat_data;
607 static int desc_id;
608 int i, err; 607 int i, err;
609 608
610 pmic_plat_data = dev_get_platdata(tps65910->dev); 609 pmic_plat_data = dev_get_platdata(tps65910->dev);
@@ -630,7 +629,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
630 pmic->info[i] = info; 629 pmic->info[i] = info;
631 630
632 pmic->desc[i].name = info->name; 631 pmic->desc[i].name = info->name;
633 pmic->desc[i].id = desc_id++; 632 pmic->desc[i].id = i;
634 pmic->desc[i].n_voltages = info->table_len; 633 pmic->desc[i].n_voltages = info->table_len;
635 634
636 if ((i == TPS65910_REG_VDD1) || (i == TPS65910_REG_VDD2)) 635 if ((i == TPS65910_REG_VDD1) || (i == TPS65910_REG_VDD2))