From patchwork Wed Jun 20 17:22:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 139370 Delivered-To: patches@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1050379lji; Wed, 20 Jun 2018 10:22:39 -0700 (PDT) X-Received: by 2002:a2e:2d11:: with SMTP id t17-v6mr3025120ljt.145.1529515359676; Wed, 20 Jun 2018 10:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515359; cv=none; d=google.com; s=arc-20160816; b=kEwnSce2cmW1c5tkBvXtIrUrzeCWGg0J16W79KBbG529gaCeRm9Urg99Hb2mExsk7/ qVksZiH7Ho63CzU6LLo05DEqMxsuBvikURY4qp8W0zupd7tVOkoD4kK8uyEVwoFZ0ddr WfwUgsR62ECJ1b2TuyJernKCVd3Wc+g7LtRp7dISqR66zJyjIycOwPh3dle869CBomE0 Od0oWZM329qAWVGsWg6bI8mHGfmFabhB+NcybICL8Pizq8FfIrtma+eMA97RCAjSrCzA uRH7JZoCrSWEQpk1kudUfsvQ+Qabqa7LIyqKpu/aTuTLCr5wQxM6xz2Ewm+zqkywZEh7 BU3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=BZqpdm4C3crCBCfotBf9OcWNkhZg/AfpeooWj+mQ4ng=; b=0sS5BkDqQPVsvtwtRqSIy5NkyT1UYdGOtiofwIZoi0tSw8dBic8FjsKfLpvCuxsNrX 2t2wA+2fMwuXD/fh56OAiPhjk/tEx79W5d+YCp9M93q7KxGOecDsHYvMmWWKhNynOztl XzeCsMauT522pSgZX1ETBFKSCJNp+XZuweSXTNmoKAUweQbwZtr6S2mxbWbrBJUwKA8w GZr6WLuuqV9e9N0SJ11awt9O8p4MET4SxuB6UATxbGqhJDjSX1XGwE0H3twXIqWEZtd9 07bNbHvmeMXtAvgULQK0x7OOatXJYhyE+Z2qleEQurVdTr+1xA4fWM2u3VH+m5N277QW ZvXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HuZKqg5P; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c19-v6sor679894lfb.93.2018.06.20.10.22.39 for (Google Transport Security); Wed, 20 Jun 2018 10:22:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HuZKqg5P; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BZqpdm4C3crCBCfotBf9OcWNkhZg/AfpeooWj+mQ4ng=; b=HuZKqg5POieJbocrPk9ygoclVSJQuhhEuFrRfV+4xXpfR9GYqCiSTE7nQU8vuMEqZW 2DiX2fjdAa8dUMsMo+P9lNOfJ3Md1XR4lvfQZ7nNwEMUtR2o5XTyDvE0MaVgEzKdmEGU 9OB3SEj3oB8gI4wqYtPMvfL0CoiyoZnb2ShpM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BZqpdm4C3crCBCfotBf9OcWNkhZg/AfpeooWj+mQ4ng=; b=HtPquqTpSqiqendHtYuHNUXIYHlUPMOSMYa3nRDQlL/y5W8mQQpfzu+vl38NnYTT+V 0x2HZBFzVytepooeocAvSDVQKZ6Zv/+Lbwq1LMaR0S7Eo2t196H9jodpWVeKgrYyzNSs jZAnkP0N6wEXXv7FP3TsO5ZxE1LuCHGkLADx89pqcN1uRZ8ju4S/Jw43+93KRvBU9xvG BfU+3kGgSvGxFWf6qvLlrEMRNNxnoOIofX5NbwKFnmWUJdIs1+TiOCrZBi228taNR+pL 2rfQ0uscxp9BlDoojToIooAGYUdPgdgr9hww0g5EjL8n01Ki8J1prwRtjJdJEY/cKIbY KAzg== X-Gm-Message-State: APt69E0lOa1111o7CMCdId4NKyo+0SaRtuWVsG2vN+1HxsGwyT6zB02R nf2xA7CrDb/zUmm3PxwsyRoUi1Du X-Google-Smtp-Source: ADUXVKK38wCwZLwB7I+7b8fn114FAubC4FEf9GTEb8eTjTSMDF6qQC6hOxWLaufsFg64ot3ikFni4w== X-Received: by 2002:a19:20c1:: with SMTP id g184-v6mr14014452lfg.96.1529515359346; Wed, 20 Jun 2018 10:22:39 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b2-v6sm514441lji.85.2018.06.20.10.22.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:22:38 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 02/26] PM / Domains: Deal with multiple states but no governor in genpd Date: Wed, 20 Jun 2018 19:22:02 +0200 Message-Id: <20180620172226.15012-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620172226.15012-1-ulf.hansson@linaro.org> References: <20180620172226.15012-1-ulf.hansson@linaro.org> 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. Cc: Lina Iyer Signed-off-by: Ulf Hansson Reviewed-by: Lina Iyer --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 62969c3d5d04..21d298e1820b 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -467,6 +467,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; @@ -1687,6 +1691,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); } device_initialize(&genpd->dev);