Merge branch 'topic/suspend' of https://git.kernel.org/pub/scm/linux/kernel/git/broon...
[muen/linux.git] / drivers / regulator / of_regulator.c
index a09ef6cc2e9c5b24b8e91c138d4a3078fc2303a6..092ed6efb3ec91a1ee9f45445d6a2f6e1076aa13 100644 (file)
@@ -392,3 +392,17 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
 
        return init_data;
 }
+
+static int of_node_match(struct device *dev, const void *data)
+{
+       return dev->of_node == data;
+}
+
+struct regulator_dev *of_find_regulator_by_node(struct device_node *np)
+{
+       struct device *dev;
+
+       dev = class_find_device(&regulator_class, NULL, np, of_node_match);
+
+       return dev ? dev_to_rdev(dev) : NULL;
+}