Commit 609bed67 authored by Tomeu Vizoso's avatar Tomeu Vizoso Committed by Rafael J. Wysocki

PM / Domains: Allow holes in genpd_data.domains array

In platforms such as Rockchip's, the array of domains isn't always
filled without holes, as which domains are present depend on the
particular SoC revision.

By allowing holes to be in the array, such SoCs can still use a single
set of constants to index the array of power domains.

Fixes: 0159ec67 (PM / Domains: Verify the PM domain is present when adding a provider)
Signed-off-by: default avatarTomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: default avatarJon Hunter <jonathanh@nvidia.com>
Acked-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Reviewed-by: default avatarHeiko Stuebner <heiko@sntech.de>
Tested-by: default avatarHeiko Stuebner <heiko@sntech.de>
Acked-by: default avatarKevin Hilman <khilman@baylibre.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 17926551
...@@ -1581,6 +1581,8 @@ int of_genpd_add_provider_onecell(struct device_node *np, ...@@ -1581,6 +1581,8 @@ int of_genpd_add_provider_onecell(struct device_node *np,
mutex_lock(&gpd_list_lock); mutex_lock(&gpd_list_lock);
for (i = 0; i < data->num_domains; i++) { for (i = 0; i < data->num_domains; i++) {
if (!data->domains[i])
continue;
if (!pm_genpd_present(data->domains[i])) if (!pm_genpd_present(data->domains[i]))
goto error; goto error;
...@@ -1598,6 +1600,8 @@ int of_genpd_add_provider_onecell(struct device_node *np, ...@@ -1598,6 +1600,8 @@ int of_genpd_add_provider_onecell(struct device_node *np,
error: error:
while (i--) { while (i--) {
if (!data->domains[i])
continue;
data->domains[i]->provider = NULL; data->domains[i]->provider = NULL;
data->domains[i]->has_provider = false; data->domains[i]->has_provider = false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment