Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1483990 > unrolled thread

[PATCH] PM / Domains: Allow holes in genpd_data.domains array

Started byTomeu Vizoso <tomeu.vizoso@collabora.com>
First post2016-09-15 13:00 +0200
Last post2016-09-16 18:20 +0200
Articles 7 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] PM / Domains: Allow holes in genpd_data.domains array Tomeu Vizoso <tomeu.vizoso@collabora.com> - 2016-09-15 13:00 +0200
    Re: [PATCH] PM / Domains: Allow holes in genpd_data.domains array Jon Hunter <jonathanh@nvidia.com> - 2016-09-15 13:10 +0200
      [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array Tomeu Vizoso <tomeu.vizoso@collabora.com> - 2016-09-15 14:10 +0200
        Re: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array Jon Hunter <jonathanh@nvidia.com> - 2016-09-15 15:30 +0200
        Re: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array Ulf Hansson <ulf.hansson@linaro.org> - 2016-09-15 16:20 +0200
        Re: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array Heiko Stübner <heiko@sntech.de> - 2016-09-16 00:10 +0200
        Re: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array Kevin Hilman <khilman@baylibre.com> - 2016-09-16 18:20 +0200

#1483990 — [PATCH] PM / Domains: Allow holes in genpd_data.domains array

FromTomeu Vizoso <tomeu.vizoso@collabora.com>
Date2016-09-15 13:00 +0200
Subject[PATCH] PM / Domains: Allow holes in genpd_data.domains array
Message-ID<shCyC-5VC-17@gated-at.bofh.it>
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: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider")
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Jon Hunter <jonathanh@nvidia.com>
Cc: Heiko Stuebner <heiko@sntech.de>
---
 drivers/base/power/domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index b0cf46dcae73..ce3f483ec67b 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -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;
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1483994

FromJon Hunter <jonathanh@nvidia.com>
Date2016-09-15 13:10 +0200
Message-ID<shCIh-6e0-17@gated-at.bofh.it>
In reply to#1483990
On 15/09/16 11:39, Tomeu Vizoso wrote:
> 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: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider")
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Jon Hunter <jonathanh@nvidia.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/base/power/domain.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index b0cf46dcae73..ce3f483ec67b 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -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;
>  

Sounds reasonable and sorry I had not thought of this. Can you also make
sure we check that !data->domains[i] in the error path as well or
potentially we could have a NULL pointer dereference in the case of an
actual error.

Cheers
Jon

-- 
nvpublic

[toc] | [prev] | [next] | [standalone]


#1484077 — [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array

FromTomeu Vizoso <tomeu.vizoso@collabora.com>
Date2016-09-15 14:10 +0200
Subject[PATCH v2] PM / Domains: Allow holes in genpd_data.domains array
Message-ID<shDEn-6P5-77@gated-at.bofh.it>
In reply to#1483994
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: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider")
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Jon Hunter <jonathanh@nvidia.com>
Cc: Heiko Stuebner <heiko@sntech.de>

---

v2: Also skip holes in the error path.
---
 drivers/base/power/domain.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index b0cf46dcae73..83ae3d7d3fdd 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -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;
 
@@ -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;
 	}
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1484165 — Re: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array

FromJon Hunter <jonathanh@nvidia.com>
Date2016-09-15 15:30 +0200
SubjectRe: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array
Message-ID<shETM-7yO-15@gated-at.bofh.it>
In reply to#1484077
On 15/09/16 13:05, Tomeu Vizoso wrote:
> 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: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider")
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Jon Hunter <jonathanh@nvidia.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> 
> ---
> 
> v2: Also skip holes in the error path.
> ---
>  drivers/base/power/domain.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index b0cf46dcae73..83ae3d7d3fdd 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -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;
>  
> @@ -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;
>  	}
> 

Thanks!

Acked-by: Jon Hunter <jonathanh@nvidia.com>

Cheers
Jon

-- 
nvpublic

[toc] | [prev] | [next] | [standalone]


#1484216 — Re: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array

FromUlf Hansson <ulf.hansson@linaro.org>
Date2016-09-15 16:20 +0200
SubjectRe: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array
Message-ID<shFGa-85o-13@gated-at.bofh.it>
In reply to#1484077
On 15 September 2016 at 14:05, Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> 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: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider")
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Jon Hunter <jonathanh@nvidia.com>
> Cc: Heiko Stuebner <heiko@sntech.de>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

>
> ---
>
> v2: Also skip holes in the error path.
> ---
>  drivers/base/power/domain.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index b0cf46dcae73..83ae3d7d3fdd 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -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;
>
> @@ -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;
>         }
> --
> 2.7.4
>

[toc] | [prev] | [next] | [standalone]


#1484569 — Re: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array

FromHeiko Stübner <heiko@sntech.de>
Date2016-09-16 00:10 +0200
SubjectRe: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array
Message-ID<shN0Z-4mm-21@gated-at.bofh.it>
In reply to#1484077
Am Donnerstag, 15. September 2016, 14:05:23 schrieb Tomeu Vizoso:
> 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: 0159ec670763 ("PM / Domains: Verify the PM domain is present when
> adding a provider") Signed-off-by: Tomeu Vizoso
> <tomeu.vizoso@collabora.com>
> Cc: Jon Hunter <jonathanh@nvidia.com>
> Cc: Heiko Stuebner <heiko@sntech.de>

We talked about this today and the change looks good for handling the
holes in Rockchip power-domain lists, so

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

also, on a rk3288-veyron Chromebook the display comes up again
with this patch (by not defering because of the missing domains), so

Tested-by: Heiko Stuebner <heiko@sntech.de>


Thanks
Heiko

[toc] | [prev] | [next] | [standalone]


#1485158 — Re: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array

FromKevin Hilman <khilman@baylibre.com>
Date2016-09-16 18:20 +0200
SubjectRe: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array
Message-ID<si41Q-75s-5@gated-at.bofh.it>
In reply to#1484077
Tomeu Vizoso <tomeu.vizoso@collabora.com> writes:

> 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: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider")
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Jon Hunter <jonathanh@nvidia.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
>
> ---
>
> v2: Also skip holes in the error path.

Acked-by: Kevin Hilman <khilman@baylibre.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web