]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
PM / Domains: Deal with multiple states but no governor in genpd
authorUlf Hansson <ulf.hansson@linaro.org>
Wed, 3 Oct 2018 14:38:15 +0000 (16:38 +0200)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:20:51 +0000 (14:20 -0300)
BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit 2c9b7f8772033cc8bafbd4eefe2ca605bf3eb094 ]

A caller of pm_genpd_init() that provides some states for the genpd via the
->states pointer in the struct generic_pm_domain, should also provide a
governor. This because it's the job of the governor to pick a state that
satisfies the constraints.

Therefore, let's print a warning to inform the user about such bogus
configuration and avoid to bail out, by instead picking the shallowest
state before genpd invokes the ->power_off() callback.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/base/power/domain.c

index 805ccc380ead038aaed7950b4fd1af94769e936e..e49ff21b483deafe9d9f5079303923241c6538eb 100644 (file)
@@ -466,6 +466,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
                        return -EAGAIN;
        }
 
+       /* Default to shallowest state. */
+       if (!genpd->gov)
+               genpd->state_idx = 0;
+
        if (genpd->power_off) {
                int ret;
 
@@ -1688,6 +1692,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
                ret = genpd_set_default_power_state(genpd);
                if (ret)
                        return ret;
+       } else if (!gov) {
+               pr_warn("%s : no governor for states\n", genpd->name);
        }
 
        mutex_lock(&gpd_list_lock);