* [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
@ 2015-06-11 11:51 Ulf Hansson
2015-06-11 12:33 ` Krzysztof Kozlowski
2015-07-16 8:51 ` Ulf Hansson
0 siblings, 2 replies; 5+ messages in thread
From: Ulf Hansson @ 2015-06-11 11:51 UTC (permalink / raw)
To: linux-arm-kernel
While powering up a genpd, its domain masters are first being powered up.
In the error path of __pm_genpd_poweron(), we didn't care to try power off
these domain masters. Let's deal with that to avoid leaving unused PM
domains powered.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/base/power/domain.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 2327613..32dcb80 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -235,6 +235,18 @@ static int genpd_power_off(struct generic_pm_domain *genpd)
}
/**
+ * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff().
+ * @genpd: PM domait to power off.
+ *
+ * Queue up the execution of pm_genpd_poweroff() unless it's already been done
+ * before.
+ */
+static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
+{
+ queue_work(pm_wq, &genpd->power_off_work);
+}
+
+/**
* __pm_genpd_poweron - Restore power to a given PM domain and its masters.
* @genpd: PM domain to power up.
*
@@ -315,8 +327,12 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd)
return 0;
err:
- list_for_each_entry_continue_reverse(link, &genpd->slave_links, slave_node)
+ list_for_each_entry_continue_reverse(link,
+ &genpd->slave_links,
+ slave_node) {
genpd_sd_counter_dec(link->master);
+ genpd_queue_power_off_work(link->master);
+ }
return ret;
}
@@ -490,18 +506,6 @@ static bool genpd_abort_poweroff(struct generic_pm_domain *genpd)
}
/**
- * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff().
- * @genpd: PM domait to power off.
- *
- * Queue up the execution of pm_genpd_poweroff() unless it's already been done
- * before.
- */
-static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
-{
- queue_work(pm_wq, &genpd->power_off_work);
-}
-
-/**
* pm_genpd_poweroff - Remove power from a given PM domain.
* @genpd: PM domain to power down.
*
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
2015-06-11 11:51 [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron() Ulf Hansson
@ 2015-06-11 12:33 ` Krzysztof Kozlowski
2015-06-25 11:17 ` Ulf Hansson
2015-07-16 8:51 ` Ulf Hansson
1 sibling, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2015-06-11 12:33 UTC (permalink / raw)
To: linux-arm-kernel
W dniu 11.06.2015 o 20:51, Ulf Hansson pisze:
> While powering up a genpd, its domain masters are first being powered up.
> In the error path of __pm_genpd_poweron(), we didn't care to try power off
> these domain masters. Let's deal with that to avoid leaving unused PM
> domains powered.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
> drivers/base/power/domain.c | 30 +++++++++++++++++-------------
> 1 file changed, 17 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 2327613..32dcb80 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -235,6 +235,18 @@ static int genpd_power_off(struct generic_pm_domain *genpd)
> }
>
> /**
> + * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff().
> + * @genpd: PM domait to power off.
> + *
> + * Queue up the execution of pm_genpd_poweroff() unless it's already been done
> + * before.
> + */
> +static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
> +{
> + queue_work(pm_wq, &genpd->power_off_work);
> +}
> +
> +/**
> * __pm_genpd_poweron - Restore power to a given PM domain and its masters.
> * @genpd: PM domain to power up.
> *
> @@ -315,8 +327,12 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd)
> return 0;
>
> err:
> - list_for_each_entry_continue_reverse(link, &genpd->slave_links, slave_node)
> + list_for_each_entry_continue_reverse(link,
> + &genpd->slave_links,
> + slave_node) {
> genpd_sd_counter_dec(link->master);
> + genpd_queue_power_off_work(link->master);
It looks sensible to revert work already done however I wonder if this
is necessary for each slave. The first successful call to
pm_genpd_poweroff() will also walk through slave_links and queue the work.
Best regards,
Krzysztof
> + }
>
> return ret;
> }
> @@ -490,18 +506,6 @@ static bool genpd_abort_poweroff(struct generic_pm_domain *genpd)
> }
>
> /**
> - * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff().
> - * @genpd: PM domait to power off.
> - *
> - * Queue up the execution of pm_genpd_poweroff() unless it's already been done
> - * before.
> - */
> -static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
> -{
> - queue_work(pm_wq, &genpd->power_off_work);
> -}
> -
> -/**
> * pm_genpd_poweroff - Remove power from a given PM domain.
> * @genpd: PM domain to power down.
> *
>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
2015-06-11 12:33 ` Krzysztof Kozlowski
@ 2015-06-25 11:17 ` Ulf Hansson
2015-06-26 0:10 ` Krzysztof Kozlowski
0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2015-06-25 11:17 UTC (permalink / raw)
To: linux-arm-kernel
On 11 June 2015 at 14:33, Krzysztof Kozlowski <k.kozlowski.k@gmail.com> wrote:
> W dniu 11.06.2015 o 20:51, Ulf Hansson pisze:
>> While powering up a genpd, its domain masters are first being powered up.
>> In the error path of __pm_genpd_poweron(), we didn't care to try power off
>> these domain masters. Let's deal with that to avoid leaving unused PM
>> domains powered.
>>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>> drivers/base/power/domain.c | 30 +++++++++++++++++-------------
>> 1 file changed, 17 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>> index 2327613..32dcb80 100644
>> --- a/drivers/base/power/domain.c
>> +++ b/drivers/base/power/domain.c
>> @@ -235,6 +235,18 @@ static int genpd_power_off(struct generic_pm_domain *genpd)
>> }
>>
>> /**
>> + * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff().
>> + * @genpd: PM domait to power off.
>> + *
>> + * Queue up the execution of pm_genpd_poweroff() unless it's already been done
>> + * before.
>> + */
>> +static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
>> +{
>> + queue_work(pm_wq, &genpd->power_off_work);
>> +}
>> +
>> +/**
>> * __pm_genpd_poweron - Restore power to a given PM domain and its masters.
>> * @genpd: PM domain to power up.
>> *
>> @@ -315,8 +327,12 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd)
>> return 0;
>>
>> err:
>> - list_for_each_entry_continue_reverse(link, &genpd->slave_links, slave_node)
>> + list_for_each_entry_continue_reverse(link,
>> + &genpd->slave_links,
>> + slave_node) {
>> genpd_sd_counter_dec(link->master);
>> + genpd_queue_power_off_work(link->master);
>
> It looks sensible to revert work already done however I wonder if this
> is necessary for each slave. The first successful call to
> pm_genpd_poweroff() will also walk through slave_links and queue the work.
>
For the current genpd, each slave link represents that the current
genpd is a subdomain to another genpd. The corresponding master for
each link is the "link->master". As genpds are allowed to have several
masters, we can't just try to power off one of them.
Sorry for a delayed response and thanks for your review!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
2015-06-25 11:17 ` Ulf Hansson
@ 2015-06-26 0:10 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2015-06-26 0:10 UTC (permalink / raw)
To: linux-arm-kernel
2015-06-25 20:17 GMT+09:00 Ulf Hansson <ulf.hansson@linaro.org>:
> On 11 June 2015 at 14:33, Krzysztof Kozlowski <k.kozlowski.k@gmail.com> wrote:
>> W dniu 11.06.2015 o 20:51, Ulf Hansson pisze:
>>> While powering up a genpd, its domain masters are first being powered up.
>>> In the error path of __pm_genpd_poweron(), we didn't care to try power off
>>> these domain masters. Let's deal with that to avoid leaving unused PM
>>> domains powered.
>>>
>>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>> ---
>>> drivers/base/power/domain.c | 30 +++++++++++++++++-------------
>>> 1 file changed, 17 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>>> index 2327613..32dcb80 100644
>>> --- a/drivers/base/power/domain.c
>>> +++ b/drivers/base/power/domain.c
>>> @@ -235,6 +235,18 @@ static int genpd_power_off(struct generic_pm_domain *genpd)
>>> }
>>>
>>> /**
>>> + * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff().
>>> + * @genpd: PM domait to power off.
>>> + *
>>> + * Queue up the execution of pm_genpd_poweroff() unless it's already been done
>>> + * before.
>>> + */
>>> +static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
>>> +{
>>> + queue_work(pm_wq, &genpd->power_off_work);
>>> +}
>>> +
>>> +/**
>>> * __pm_genpd_poweron - Restore power to a given PM domain and its masters.
>>> * @genpd: PM domain to power up.
>>> *
>>> @@ -315,8 +327,12 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd)
>>> return 0;
>>>
>>> err:
>>> - list_for_each_entry_continue_reverse(link, &genpd->slave_links, slave_node)
>>> + list_for_each_entry_continue_reverse(link,
>>> + &genpd->slave_links,
>>> + slave_node) {
>>> genpd_sd_counter_dec(link->master);
>>> + genpd_queue_power_off_work(link->master);
>>
>> It looks sensible to revert work already done however I wonder if this
>> is necessary for each slave. The first successful call to
>> pm_genpd_poweroff() will also walk through slave_links and queue the work.
>>
>
> For the current genpd, each slave link represents that the current
> genpd is a subdomain to another genpd. The corresponding master for
> each link is the "link->master". As genpds are allowed to have several
> masters, we can't just try to power off one of them.
Right, makes sense.
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
2015-06-11 11:51 [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron() Ulf Hansson
2015-06-11 12:33 ` Krzysztof Kozlowski
@ 2015-07-16 8:51 ` Ulf Hansson
1 sibling, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2015-07-16 8:51 UTC (permalink / raw)
To: linux-arm-kernel
On 11 June 2015 at 13:51, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> While powering up a genpd, its domain masters are first being powered up.
> In the error path of __pm_genpd_poweron(), we didn't care to try power off
> these domain masters. Let's deal with that to avoid leaving unused PM
> domains powered.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Rafael, just to let you know, this one still applies nicely for me on
top of the latest genpd changes.
Kind regards
Uffe
> ---
> drivers/base/power/domain.c | 30 +++++++++++++++++-------------
> 1 file changed, 17 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 2327613..32dcb80 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -235,6 +235,18 @@ static int genpd_power_off(struct generic_pm_domain *genpd)
> }
>
> /**
> + * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff().
> + * @genpd: PM domait to power off.
> + *
> + * Queue up the execution of pm_genpd_poweroff() unless it's already been done
> + * before.
> + */
> +static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
> +{
> + queue_work(pm_wq, &genpd->power_off_work);
> +}
> +
> +/**
> * __pm_genpd_poweron - Restore power to a given PM domain and its masters.
> * @genpd: PM domain to power up.
> *
> @@ -315,8 +327,12 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd)
> return 0;
>
> err:
> - list_for_each_entry_continue_reverse(link, &genpd->slave_links, slave_node)
> + list_for_each_entry_continue_reverse(link,
> + &genpd->slave_links,
> + slave_node) {
> genpd_sd_counter_dec(link->master);
> + genpd_queue_power_off_work(link->master);
> + }
>
> return ret;
> }
> @@ -490,18 +506,6 @@ static bool genpd_abort_poweroff(struct generic_pm_domain *genpd)
> }
>
> /**
> - * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff().
> - * @genpd: PM domait to power off.
> - *
> - * Queue up the execution of pm_genpd_poweroff() unless it's already been done
> - * before.
> - */
> -static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
> -{
> - queue_work(pm_wq, &genpd->power_off_work);
> -}
> -
> -/**
> * pm_genpd_poweroff - Remove power from a given PM domain.
> * @genpd: PM domain to power down.
> *
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-16 8:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-11 11:51 [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron() Ulf Hansson
2015-06-11 12:33 ` Krzysztof Kozlowski
2015-06-25 11:17 ` Ulf Hansson
2015-06-26 0:10 ` Krzysztof Kozlowski
2015-07-16 8:51 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).