From patchwork Wed Nov 27 20:29:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 180320 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp6635453ilf; Wed, 27 Nov 2019 12:48:22 -0800 (PST) X-Google-Smtp-Source: APXvYqy1B6nUtY63X/Psgh9FGHaFhGz3IqkuSLw89dSRSSEevCU0/T3AgKq9lJ1/vURJ7pD98lBM X-Received: by 2002:a17:906:a457:: with SMTP id cb23mr50905014ejb.191.1574887702001; Wed, 27 Nov 2019 12:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887701; cv=none; d=google.com; s=arc-20160816; b=F8JohwNRuFcvwHOvhzplWrvLYBId9yvzkiBNimxyK47tWF0yxPhBcMF2vHQ/CJY+R5 /y8nbvfuoQAuuVa5Lp8phjYPFlE/pQYU/gnjz1slqANYw6n6aem6iTwae3WfDzVHM6iz GJc/n6s0nWF64LgorRotY8vy/7oszJLk6shAkqkmExJkQFubWfgQBGlLPgofxEEHUjle KA1xXY40NCr8/RxRD4+FO1fweBPw12CavKQfrBrDG5gRvSjjO6KdzrxmKIN6G0lB3SRS gpYllZgM0DBEgr9fQFvQWHiHIVcnM/aROX3DvMduXp1o92EzrkHSQHSUTsSa1/0RcrJE MhXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+NSFEQL7aum7FHbrN08mebVoRD02Xh7prCTJHYNM1+k=; b=MfY0Z0Po61NMjK+PUOTrK5Jt1d7nOR4LLY9ToZSo78Z6aLFX1TeeUGemt4oV93KkoZ wHLWpgMXDUP/sMDyDcSxGE1sFuprRw//pftNLAHTrU8Oe2QU/b8B/lku84/pjVHQIa31 rdvmZhecuG8j+ogyiY1y93qn8JvWgiTcTk+WRP+MB+/y66buIMu+WMzr3kLERJNnwubn 3epydCxoEsabiXFq5rodGh6JCHEuuI+o+hMEswr1RH8Ym07vES94Q9ZaLOvVyas2Ai18 n2Pf/PGpo8hcxRK5dcEypjVy7e6OjX3vgRuN+WXY1pmZ6gi+yzw+7ME7ocQGx6CUAGW8 M1Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VDBMgyvI; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z17si4729410edr.229.2019.11.27.12.48.21; Wed, 27 Nov 2019 12:48:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VDBMgyvI; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730116AbfK0UsU (ORCPT + 15 others); Wed, 27 Nov 2019 15:48:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:33506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbfK0UsT (ORCPT ); Wed, 27 Nov 2019 15:48:19 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BBC4921826; Wed, 27 Nov 2019 20:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887699; bh=J1to47OMKRkj9YZVUv1UjENY/JLzYU8gnUrjNEuIuok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDBMgyvIcnQsuHF+rQaVoOPEf+Nau0RdHYRg8P2I/x/28RL0fLuAUl4gzTSZSwJTr huJlAKLU6UrvrCrb7t/oZvfxkMZp1lGqF9/P1KosRk68bSgVNScZ5apIAjSiGKHhtt 1mAbftU5yFee1J4NiFBMNKKUMVpSdalizAWDQDRM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson , Lina Iyer , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 061/211] PM / Domains: Deal with multiple states but no governor in genpd Date: Wed, 27 Nov 2019 21:29:54 +0100 Message-Id: <20191127203059.762982903@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson [ 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 Reviewed-by: Lina Iyer Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.1 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);