regulator: tps62360: Convert to devm_regmap_init_i2c()
[linux-2.6.git] / drivers / regulator / isl6271a-regulator.c
index e49d2bd..e4b3592 100644 (file)
@@ -58,7 +58,9 @@ out:
        return data;
 }
 
-static int isl6271a_set_voltage(struct regulator_dev *dev, int minuV, int maxuV)
+static int isl6271a_set_voltage(struct regulator_dev *dev,
+                               int minuV, int maxuV,
+                               unsigned *selector)
 {
        struct isl_pmic *pmic = rdev_get_drvdata(dev);
        int vsel, err, data;
@@ -78,6 +80,8 @@ static int isl6271a_set_voltage(struct regulator_dev *dev, int minuV, int maxuV)
        /* Convert the microvolts to data for the chip */
        data = (vsel - ISL6271A_VOLTAGE_MIN) / ISL6271A_VOLTAGE_STEP;
 
+       *selector = data;
+
        mutex_lock(&pmic->mtx);
 
        err = i2c_smbus_write_byte(pmic->client, data);
@@ -165,11 +169,11 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,
        mutex_init(&pmic->mtx);
 
        for (i = 0; i < 3; i++) {
-               pmic->rdev[i] = regulator_register(&isl_rd[0], &i2c->dev,
+               pmic->rdev[i] = regulator_register(&isl_rd[i], &i2c->dev,
                                                init_data, pmic);
                if (IS_ERR(pmic->rdev[i])) {
                        dev_err(&i2c->dev, "failed to register %s\n", id->name);
-                       err = PTR_ERR(pmic->rdev);
+                       err = PTR_ERR(pmic->rdev[i]);
                        goto error;
                }
        }
@@ -191,8 +195,6 @@ static int __devexit isl6271a_remove(struct i2c_client *i2c)
        struct isl_pmic *pmic = i2c_get_clientdata(i2c);
        int i;
 
-       i2c_set_clientdata(i2c, NULL);
-
        for (i = 0; i < 3; i++)
                regulator_unregister(pmic->rdev[i]);