regulator: regulator for Palmas Kconfig
[linux-2.6.git] / drivers / regulator / wm8400-regulator.c
index 0f12c70..8477153 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/bug.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/regulator/driver.h>
 #include <linux/mfd/wm8400-private.h>
 
@@ -77,14 +78,14 @@ static int wm8400_ldo_set_voltage(struct regulator_dev *dev,
 
        if (min_uV < 1700000) {
                /* Steps of 50mV from 900mV;  */
-               val = (min_uV - 850001) / 50000;
+               val = DIV_ROUND_UP(min_uV - 900000, 50000);
 
                if ((val * 50000) + 900000 > max_uV)
                        return -EINVAL;
                BUG_ON((val * 50000) + 900000 < min_uV);
        } else {
                /* Steps of 100mV from 1700mV */
-               val = ((min_uV - 1600001) / 100000);
+               val = DIV_ROUND_UP(min_uV - 1700000, 100000);
 
                if ((val * 100000) + 1700000 > max_uV)
                        return -EINVAL;
@@ -167,7 +168,7 @@ static int wm8400_dcdc_set_voltage(struct regulator_dev *dev,
        if (min_uV < 850000)
                return -EINVAL;
 
-       val = (min_uV - 825001) / 25000;
+       val = DIV_ROUND_UP(min_uV - 850000, 25000);
 
        if (850000 + (25000 * val) > max_uV)
                return -EINVAL;
@@ -325,7 +326,7 @@ static int __devinit wm8400_regulator_probe(struct platform_device *pdev)
        struct regulator_dev *rdev;
 
        rdev = regulator_register(&regulators[pdev->id], &pdev->dev,
-                                 pdev->dev.platform_data, wm8400);
+                                 pdev->dev.platform_data, wm8400, NULL);
 
        if (IS_ERR(rdev))
                return PTR_ERR(rdev);