lkml.org 
[lkml]   [2019]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 061/211] PM / Domains: Deal with multiple states but no governor in genpd
    Date
    From: Ulf Hansson <ulf.hansson@linaro.org>

    [ 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>
    ---
    drivers/base/power/domain.c | 6 ++++++
    1 file changed, 6 insertions(+)

    diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
    index c276ba1c0a19e..e811f24148897 100644
    --- a/drivers/base/power/domain.c
    +++ b/drivers/base/power/domain.c
    @@ -369,6 +369,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;

    @@ -1598,6 +1602,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);
    --
    2.20.1


    \
     
     \ /
      Last update: 2019-11-27 22:36    [W:2.265 / U:0.060 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site