Skip to content

Commit

Permalink
PM / Domains: Allow holes in genpd_data.domains array
Browse files Browse the repository at this point in the history
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: 0159ec6 (PM / Domains: Verify the PM domain is present when adding a provider)
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Tomeu Vizoso authored and Rafael J. Wysocki committed Sep 16, 2016
1 parent 1792655 commit 609bed6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,8 @@ int of_genpd_add_provider_onecell(struct device_node *np,
mutex_lock(&gpd_list_lock);

for (i = 0; i < data->num_domains; i++) {
if (!data->domains[i])
continue;
if (!pm_genpd_present(data->domains[i]))
goto error;

Expand All @@ -1598,6 +1600,8 @@ int of_genpd_add_provider_onecell(struct device_node *np,

error:
while (i--) {
if (!data->domains[i])
continue;
data->domains[i]->provider = NULL;
data->domains[i]->has_provider = false;
}
Expand Down

0 comments on commit 609bed6

Please sign in to comment.