summaryrefslogtreecommitdiff
path: root/drivers/regulator/of_regulator.c
diff options
context:
space:
mode:
authorCristian Marussi <cristian.marussi@arm.com>2020-11-19 22:10:49 +0300
committerMark Brown <broonie@kernel.org>2020-11-23 21:38:13 +0300
commite7095c35abfc5a5d566941a87434c0fd5ffb570f (patch)
treed01a5d525830920d5b5b6070e7d969a671db6e52 /drivers/regulator/of_regulator.c
parentce10f6ca9654410a66c81a3a68e680feca6b59d2 (diff)
downloadlinux-e7095c35abfc5a5d566941a87434c0fd5ffb570f.tar.xz
regulator: core: add of_match_full_name boolean flag
During regulators registration, if .of_match and .regulators_node are defined as non-null strings in struct regulator_desc the core searches the DT subtree rooted at .regulators_node trying to match, at first, .of_match against the 'regulator-compatible' property and, then, falling back to use the name of the node itself to determine a good match. Property 'regulator-compatible', though, is now deprecated and falling back to match against the node name, works fine only as long as the involved nodes are named in an unique way across the searched subtree; if that's not the case, like when using <common-name>@<unit> style naming for properties indexed via 'reg' property (as advised by the standard), the above matching mechanism based on the simple common name will lead to multiple matches and the only viable alternative would be to properly define the now deprecated 'regulator-compatible' as the node full name, i.e. <common-name>@<unit>. In order to address this case without using such deprecated binding, define a new boolean flag .of_match_full_name in struct regulator_desc to force the core to match against the node full-name instead of the plain name. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20201119191051.46363-4-cristian.marussi@arm.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/of_regulator.c')
-rw-r--r--drivers/regulator/of_regulator.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 06c0b15fe4c0..564f928eb1db 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -413,8 +413,12 @@ device_node *regulator_of_get_init_node(struct device *dev,
for_each_available_child_of_node(search, child) {
name = of_get_property(child, "regulator-compatible", NULL);
- if (!name)
- name = child->name;
+ if (!name) {
+ if (!desc->of_match_full_name)
+ name = child->name;
+ else
+ name = child->full_name;
+ }
if (!strcmp(desc->of_match, name)) {
of_node_put(search);