aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/regulator/of_regulator.c21
-rw-r--r--include/linux/regulator/of_regulator.h7
2 files changed, 28 insertions, 0 deletions
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index c58c8d178948..188e0cb10d03 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -172,3 +172,24 @@ int of_regulator_match(struct device *dev, struct device_node *node,
172 return count; 172 return count;
173} 173}
174EXPORT_SYMBOL_GPL(of_regulator_match); 174EXPORT_SYMBOL_GPL(of_regulator_match);
175
176/**
177 * of_regulator_put_match - put the of_node references from an
178 * of_regulator_match structure
179 * @matches: match table for the regulators
180 * @num_matches: number of entries in match table
181 *
182 * This function goes through a match table and calls of_node_put on each
183 * of_node.
184 */
185int of_regulator_put_match(struct of_regulator_match *matches,
186 unsigned int num_matches)
187{
188 int i;
189
190 for (i = 0; i < num_matches; i++)
191 of_node_put(matches[i].of_node);
192
193 return 0;
194}
195EXPORT_SYMBOL_GPL(of_regulator_put_match);
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
index f9217965aaa3..06528516aa15 100644
--- a/include/linux/regulator/of_regulator.h
+++ b/include/linux/regulator/of_regulator.h
@@ -20,6 +20,8 @@ extern struct regulator_init_data
20extern int of_regulator_match(struct device *dev, struct device_node *node, 20extern int of_regulator_match(struct device *dev, struct device_node *node,
21 struct of_regulator_match *matches, 21 struct of_regulator_match *matches,
22 unsigned int num_matches); 22 unsigned int num_matches);
23extern int of_regulator_put_match(struct of_regulator_match *matches,
24 unsigned int num_matches);
23#else 25#else
24static inline struct regulator_init_data 26static inline struct regulator_init_data
25 *of_get_regulator_init_data(struct device *dev, 27 *of_get_regulator_init_data(struct device *dev,
@@ -35,6 +37,11 @@ static inline int of_regulator_match(struct device *dev,
35{ 37{
36 return 0; 38 return 0;
37} 39}
40static inline int of_regulator_put_match(struct of_regulator_match *matches,
41 unsigned int num_matches);
42{
43 return 0;
44}
38#endif /* CONFIG_OF */ 45#endif /* CONFIG_OF */
39 46
40#endif /* __LINUX_OF_REG_H */ 47#endif /* __LINUX_OF_REG_H */