Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp793450ybc; Sat, 16 Nov 2019 08:48:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyfX96r279cFWtCD/0dAPTSYcwW6XR7K16Xk/yGhB9HT6lNff9Kt0xVW58iTVJpHbRAl1K6 X-Received: by 2002:a17:906:ecf5:: with SMTP id qt21mr10943484ejb.295.1573922924833; Sat, 16 Nov 2019 08:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573922924; cv=none; d=google.com; s=arc-20160816; b=YA2/s3pfSD4JdmqCBM6ld+LG4O5hKvaxLSPOpiWDV/trL5CrankjUOiPA1b+14hKF4 +y+CCLoJHFxImMNwyzgL1HRvaNLhfPVbUWDvno0qt1EfZfMfwWaavDcTtXyTcchq9e9E ZrpaJQe0JQ+KR5SyxJyCEuF1IktpyF1km2J+WITqEyvBjBi8j7mkrc6RDQIbTo5+Fmwo CWZiE6c/kemcs5Fp95XGXSHbG6rLOB59qZtSPePF6WjMwPZDw0acySRP7tRUm8c5tnAN 1uCAC2I+QulrztkPVGTrC0FLtT/3Fre/9AUUx2OTBukys2xHf8EQpB2ukAPqFyzJBTA0 MjJg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=83uXGCc5E2l5ebIxSQOTeerrjmH4Hd0k0R3Hk29rlWg=; b=CJTd8316wQTVstWm81TC+ghhPNEt5dx2/zHE9mmiGjk11sjnCLIBzYL+XHAbpuXVxt jzegbW56sfSx2pWBxQtQYdKrqGssiW9Qm0J5nPjIbcJhsH5Fg4C2yzVVPVNOeMxLTTZZ qG5lzbE4HWd2m/yMRNm1Tunjk4tNJDoJTYrSOi8+xGeSD1mTiclA2oz6kBr33Nr1kKNS 1rU/Oovvmw97QfYisU08f0+/PrUpyNpbgaG0kJ0xMPxcLtWwMqBQFdgj1cp/ILVqIqi4 VJgfVYwhInxgXO99DQWg5EuVQt9p3DmkMOsdt8XpnNMGWiLc6HGgHO9QJT9xImwQuF4W w+bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TNlyaeq9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c44si8939009ede.398.2019.11.16.08.48.17; Sat, 16 Nov 2019 08:48:44 -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=TNlyaeq9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728407AbfKPPmn (ORCPT + 99 others); Sat, 16 Nov 2019 10:42:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:46238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728338AbfKPPme (ORCPT ); Sat, 16 Nov 2019 10:42:34 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A9E320700; Sat, 16 Nov 2019 15:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573918954; bh=d5aN0u3+tlQOnw6rz7zLvdGW+WvOSXR1GFhj+QuTke8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TNlyaeq9MZlFWAZXzbVdra6q2EgrIMUf7/in/qBsGzGOmHsoZpoIUa9ZaXYYTiTpO g34/CLyl34016zx3N6OE2NTHTEAxwrbuFLq9O+X2DYagcQN2DCl5/vRrvaXBHeCdgs UKdR+b5t8ZTzUz16EBqjVBcHmbzSFzlGlvkSeppA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulf Hansson , Lina Iyer , "Rafael J . Wysocki" , Sasha Levin , linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 073/237] PM / Domains: Deal with multiple states but no governor in genpd Date: Sat, 16 Nov 2019 10:38:28 -0500 Message-Id: <20191116154113.7417-73-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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