]> Pileus Git - ~andy/linux/blobdiff - drivers/regulator/max1586.c
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / drivers / regulator / max1586.c
index 2b54d9d75f11e2893ead65a3624199fa13fb9b24..559cfa271a4452389577be87543ce6116bfc0ebf 100644 (file)
@@ -121,14 +121,14 @@ static int max1586_v6_set(struct regulator_dev *rdev, int min_uV, int max_uV)
        if (max_uV < MAX1586_V6_MIN_UV || max_uV > MAX1586_V6_MAX_UV)
                return -EINVAL;
 
-       if (min_uV >= 3000000)
-               selector = 3;
-       if (min_uV < 3000000)
-               selector = 2;
-       if (min_uV < 2500000)
-               selector = 1;
        if (min_uV < 1800000)
                selector = 0;
+       else if (min_uV < 2500000)
+               selector = 1;
+       else if (min_uV < 3000000)
+               selector = 2;
+       else if (min_uV >= 3000000)
+               selector = 3;
 
        if (max1586_v6_calc_voltage(selector) > max_uV)
                return -EINVAL;
@@ -223,7 +223,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
                }
        }
 
-       i2c_set_clientdata(client, rdev);
+       i2c_set_clientdata(client, max1586);
        dev_info(&client->dev, "Maxim 1586 regulator driver loaded\n");
        return 0;
 
@@ -238,13 +238,13 @@ out:
 
 static int __devexit max1586_pmic_remove(struct i2c_client *client)
 {
-       struct regulator_dev **rdev = i2c_get_clientdata(client);
+       struct max1586_data *max1586 = i2c_get_clientdata(client);
        int i;
 
        for (i = 0; i <= MAX1586_V6; i++)
-               if (rdev[i])
-                       regulator_unregister(rdev[i]);
-       kfree(rdev);
+               if (max1586->rdev[i])
+                       regulator_unregister(max1586->rdev[i]);
+       kfree(max1586);
 
        return 0;
 }