From patchwork Thu Apr 12 11:14:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 133240 Delivered-To: patches@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1573414ljb; Thu, 12 Apr 2018 04:14:42 -0700 (PDT) X-Received: by 10.46.136.77 with SMTP id z13mr377662ljj.126.1523531682030; Thu, 12 Apr 2018 04:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523531682; cv=none; d=google.com; s=arc-20160816; b=03aRvVB4QWBplFk7Iwk7Qe1EYXdNpOVh1Dd42AJ6GKsgwr8B98Z4CLJkP5iLLs4ZkN PohpYR89gzrN64XCcT1Y50u0td2afqXEeowctBB1ctz8iN7OhXPXWpb+p5zONc6+L82V 2FhOXiueVXPOFJZf71AqyftPl/q7OKuduRgUWjRbcsUUft9iCKfNYjUiAF2FY1nQUOQ5 K0RFnx+7bMp74jLNzhUJLSWOo9yiK14maGLpBBRwg0UamSlMITrmVq9qjZ66sQ0x6Yso n8Tu5nFYCRuYIMxEvJ/CPRcEWalkMgyxFyVYVpQHeFYHWlOfbh1s3defUGLckj305rmp 0AqQ== 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=hSa1vuv7p5LGnqIFGONCS9906USFez9Y+cts+oPVryk=; b=MhxsbHkZ7YjPxXrmWMyglIY+ACtAH7qs2bgcGDjX7PBosY3oDSinp8rqPkFd248LDh uMCAqAYUlEXJGj1JGcEPPXVDJftIBgQomO3dvWwKbM3JK9SkkdIktXoyC6Oa5X0AhWg2 tSTmv/bupaZU+t0oC4Cg1s5eRFTRIOGah2re8isu7wvxEKeUIfiedLuW9aXjNSNLfE23 cBsm3jHWiSXmJEz33pnNiCFxV+GoKZZ6A03lH8VM3lLs5fjMcE6VHLSYPw7Ei16Sxdlg 9qFMn2/7F0dM2MWcdg8Ic32LM+kl9do/qRggN0Gf+gwgezh3XvezCyG7XpgSbtPt71NC 3K4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RbtSddt9; 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 g141-v6sor936398lfg.20.2018.04.12.04.14.41 for (Google Transport Security); Thu, 12 Apr 2018 04:14:42 -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=RbtSddt9; 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=hSa1vuv7p5LGnqIFGONCS9906USFez9Y+cts+oPVryk=; b=RbtSddt9aHlgmWnazYvtL7cFKdvDagqywsqLjl7uFpgohSHcX8p/1vctI8RvPIxGRv 3pOhGhr+rY2q4lfbNTvTdSJrhJgnf+KYPGUyKvQ3XhI3ihELb1H+vAGg+95ylzRaFbF+ NnlKY7mtB4l8YpCTC65BLYKg2AihPyX9xX8zU= 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=hSa1vuv7p5LGnqIFGONCS9906USFez9Y+cts+oPVryk=; b=i6NJNXsU5e/DJUdrceJKgwex7d8KiwHio1vChmoRrYrxc3SS2m5h+V5n5BqMXl8nMI mLrQ/JiWe9gUsh0YZt3+4tY+J6AY/sBnss2bRR3GPgSKicdeiE2AFFXCs85jHCn72zv+ 6XabxsjfZ8i1iPqHn3kTt3LmfZsVZ1R0huFR5cap1zs3YtubQtucSA6elml749gpt5CJ AnIuh0nlfmqhDRv4zXO2MavvjfqPR0kcOILbrqaqTk49Db8KkP58Wd+d5wf3fbs2BBkn f3K3hyXbOCDCAYclALkZqwHDNc/XbGYIYLWwMN02+B7B+HVFroLcrRw4L5oAaRMQMT3K Hr+g== X-Gm-Message-State: ALQs6tDR/bRDMZk1xHdo96vCAbSkPVSZzb7o0Kb2LTH5fGPxFlBE0Nh/ zCGJPisN+RP6gmoEpkmtTZlbyxrJ X-Google-Smtp-Source: AIpwx4/kN3Zg2iIgfZ3XjIm1cwk0RfPJetxKc63A1N0ZfQcHynNv8b1DqqOStnQesU8Bl4L01LJeDw== X-Received: by 2002:a19:7390:: with SMTP id h16-v6mr508362lfk.67.1523531681797; Thu, 12 Apr 2018 04:14:41 -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 r29sm543187lje.72.2018.04.12.04.14.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Apr 2018 04:14:41 -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 v7 02/26] PM / Domains: Deal with multiple states but no governor in genpd Date: Thu, 12 Apr 2018 13:14:07 +0200 Message-Id: <1523531671-27491-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> References: <1523531671-27491-1-git-send-email-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 --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c2ef944..9aff79d 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -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; @@ -1694,6 +1698,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);