Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5991066ybc; Wed, 27 Nov 2019 13:02:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxHPtvYfQ7nlAuycR4C8c0zPaW/RgSOoBnfUWmdvcC4PQzV/YWH59/pyo3+vk1bEivMJ9qO X-Received: by 2002:aa7:d3da:: with SMTP id o26mr35196290edr.302.1574888532004; Wed, 27 Nov 2019 13:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888531; cv=none; d=google.com; s=arc-20160816; b=m/6ToL6RQFGugbXkN8Ug0JVoXtyXr3qg86YriotOEVPeZ4MDxfBBun6geUoO2ac8TM gUoYwdFECsAe4w4iUaXL2B6VPYH29vMFIjHJ8XdtEJxOdImsiiggC1Bsi83pg12P3v8G 1zHadDmEG15GhFDPTZedm6toudCPGKuz8itHiDeuP+G2IDmkErvT2AzotAboeyDCqW5c 9jWMpBfqnNf08I1jQ4ov2cLaHlCDssieeB+QVEit3sfzcL7b3omOyKuhvJhisnwh6Ufg 1Wb1/aK5tH9dH6OuDg70SQ1jPZaFvtXiZ1M3HJwd4drLNK1OLaymqg+BAqN1iw1Lj1kX DKuA== 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=83uXGCc5E2l5ebIxSQOTeerrjmH4Hd0k0R3Hk29rlWg=; b=cuPKUUC31FtbI81r5aI60APybr8rYN0XQLWYUzoLhfBoWfvI1HdnzUZkVWMcGkgeFB ZhIh8OTgLAbpuD2zfJh2N3/4eXrBkXJ5Rnd2WNMQ5vfxYFhnXFcmDKtukByqovHRqc3+ 3r28uvbK0r2S/EJwjcOVF+X7CvvgKWbWHFvSrmF9n4nai9wLv1Tl8j/Pr00NW27zzmHy 2RFqQqpBAo52swJneMuYsVB8PZcC/lc3VTrXM3JAznuHhpuodayih9Zdcq1mkYHUOCPv sc58g0/Rskc3PwkpEB4HxhWWHBn7wmYgTpB6QlGjkJ4RVUZUOwhCcPRy6S6vsuZU40E4 5AzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=es1JX6w1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 t4si3885887ejs.400.2019.11.27.13.01.47; Wed, 27 Nov 2019 13:02:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=es1JX6w1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730966AbfK0U65 (ORCPT + 99 others); Wed, 27 Nov 2019 15:58:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:50316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730816AbfK0U6z (ORCPT ); Wed, 27 Nov 2019 15:58:55 -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 A192E20678; Wed, 27 Nov 2019 20:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888334; bh=d5aN0u3+tlQOnw6rz7zLvdGW+WvOSXR1GFhj+QuTke8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=es1JX6w1lCWDxeW1v6EK3tIeSOfa5dGxBUKCzhbTCon/bg81KWwe3EC/5WuE9A7R7 Q//F4SSz2HaMUAeIsw1b8FeN4nW9JhXbeSO6VxEGzvpGvvVH79J6la7F+cgCmLNeIy 0mskWH7uLRm/y9H5Fm47dYidQu2m8c0WEl7dTfPo= 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.19 092/306] PM / Domains: Deal with multiple states but no governor in genpd Date: Wed, 27 Nov 2019 21:29:02 +0100 Message-Id: <20191127203121.631580626@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index bf5be0bfaf773..52c292d0908a2 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; @@ -1686,6 +1690,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); -- 2.20.1