Fix typos in comments
[safe/jmp/linux-2.6] / drivers / regulator / core.c
index ca8e164..7461f5b 100644 (file)
@@ -24,6 +24,8 @@
 #include <linux/regulator/driver.h>
 #include <linux/regulator/machine.h>
 
+#include "dummy.h"
+
 #define REGULATOR_VERSION "0.5"
 
 static DEFINE_MUTEX(regulator_list_mutex);
@@ -1123,6 +1125,22 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
                        goto found;
                }
        }
+
+#ifdef CONFIG_REGULATOR_DUMMY
+       if (!devname)
+               devname = "deviceless";
+
+       /* If the board didn't flag that it was fully constrained then
+        * substitute in a dummy regulator so consumers can continue.
+        */
+       if (!has_full_constraints) {
+               pr_warning("%s supply %s not found, using dummy regulator\n",
+                          devname, id);
+               rdev = dummy_regulator_rdev;
+               goto found;
+       }
+#endif
+
        mutex_unlock(&regulator_list_mutex);
        return regulator;
 
@@ -1466,9 +1484,9 @@ EXPORT_SYMBOL_GPL(regulator_force_disable);
 
 static int _regulator_is_enabled(struct regulator_dev *rdev)
 {
-       /* sanity check */
+       /* If we don't know then assume that the regulator is always on */
        if (!rdev->desc->ops->is_enabled)
-               return -EINVAL;
+               return 1;
 
        return rdev->desc->ops->is_enabled(rdev);
 }
@@ -1520,7 +1538,7 @@ EXPORT_SYMBOL_GPL(regulator_count_voltages);
  * Context: can sleep
  *
  * Returns a voltage that can be passed to @regulator_set_voltage(),
- * zero if this selector code can't be used on this sytem, or a
+ * zero if this selector code can't be used on this system, or a
  * negative errno.
  */
 int regulator_list_voltage(struct regulator *regulator, unsigned selector)
@@ -2483,8 +2501,15 @@ EXPORT_SYMBOL_GPL(regulator_get_init_drvdata);
 
 static int __init regulator_init(void)
 {
+       int ret;
+
        printk(KERN_INFO "regulator: core version %s\n", REGULATOR_VERSION);
-       return class_register(&regulator_class);
+
+       ret = class_register(&regulator_class);
+
+       regulator_dummy_init();
+
+       return ret;
 }
 
 /* init early to allow our consumers to complete system booting */