summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-03-29 18:34:50 +0200
committerThierry Reding <treding@nvidia.com>2017-06-13 15:15:08 +0200
commit408455245a48a1ecabd90133bae0baec3ec4cfb8 (patch)
tree81f8b53b6afde7256132df44f351ef04044a4a18 /drivers/base
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
PM / Domains: Allow overriding the ->xlate() callback
Allow generic power domain providers to override the ->xlate() callback in case the default genpd_xlate_onecell() translation callback is not good enough. One potential use-case for this is to allow generic power domains to be specified by an ID rather than an index. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/domain.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index da49a8383dc3..d3f1d96f75e9 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1584,9 +1584,6 @@ EXPORT_SYMBOL_GPL(pm_genpd_remove);
#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
-typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
- void *data);
-
/*
* Device Tree based PM domain providers.
*
@@ -1742,6 +1739,9 @@ int of_genpd_add_provider_onecell(struct device_node *np,
mutex_lock(&gpd_list_lock);
+ if (!data->xlate)
+ data->xlate = genpd_xlate_onecell;
+
for (i = 0; i < data->num_domains; i++) {
if (!data->domains[i])
continue;
@@ -1752,7 +1752,7 @@ int of_genpd_add_provider_onecell(struct device_node *np,
data->domains[i]->has_provider = true;
}
- ret = genpd_add_provider(np, genpd_xlate_onecell, data);
+ ret = genpd_add_provider(np, data->xlate, data);
if (ret < 0)
goto error;