From 46b7fe94995fd166786a301dbba919046e70e702 Mon Sep 17 00:00:00 2001 From: Aisheng Dong Date: Wed, 6 Mar 2019 13:25:12 +0000 Subject: [PATCH 1/3] PM / Domains: Improve warn for multiple states but no governor It's possible a PM domain defines only one state and it does not need a governor to work. For such case, a warning actually is not necessary. Signed-off-by: Dong Aisheng Reviewed-by: Ulf Hansson Signed-off-by: Rafael J. Wysocki --- drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 2c334c01fc43..394f9daa3983 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1766,7 +1766,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd, ret = genpd_set_default_power_state(genpd); if (ret) return ret; - } else if (!gov) { + } else if (!gov && genpd->state_count > 1) { pr_warn("%s : no governor for states\n", genpd->name); } From 0cec68a97787db1ca5772f5939ec4db22de78d65 Mon Sep 17 00:00:00 2001 From: Aisheng Dong Date: Wed, 6 Mar 2019 13:25:15 +0000 Subject: [PATCH 2/3] PM / Domains: Return early for all errors in _genpd_power_off() It is strange to only return early for -EBUSY state and left other errors to be still measured execution time. As for error cases, the elapsed_ns computed actually is not quite accurate and meaningful for governor to use. So let's simply return for all error cases. Signed-off-by: Dong Aisheng Reviewed-by: Ulf Hansson Signed-off-by: Rafael J. Wysocki --- drivers/base/power/domain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 394f9daa3983..f01257607bf7 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -457,19 +457,19 @@ static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed) time_start = ktime_get(); ret = genpd->power_off(genpd); - if (ret == -EBUSY) + if (ret) return ret; elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); if (elapsed_ns <= genpd->states[state_idx].power_off_latency_ns) - return ret; + return 0; genpd->states[state_idx].power_off_latency_ns = elapsed_ns; genpd->max_off_time_changed = true; pr_debug("%s: Power-%s latency exceeded, new value %lld ns\n", genpd->name, "off", elapsed_ns); - return ret; + return 0; } /** From d9dfca7f81246db9a2c28ac1c811fc1085fbd478 Mon Sep 17 00:00:00 2001 From: Aisheng Dong Date: Wed, 6 Mar 2019 13:25:29 +0000 Subject: [PATCH 3/3] PM / domains: Remove one unnecessary blank line Remove one unnecessary blank line Signed-off-by: Dong Aisheng Signed-off-by: Rafael J. Wysocki --- drivers/base/power/domain_governor.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index 99896fbf18e4..4d07e38a8247 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c @@ -128,7 +128,6 @@ static bool __default_power_down_ok(struct dev_pm_domain *pd, off_on_time_ns = genpd->states[state].power_off_latency_ns + genpd->states[state].power_on_latency_ns; - min_off_time_ns = -1; /* * Check if subdomains can be off for enough time.