From patchwork Tue Feb 14 21:50:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuki Hashimoto X-Patchwork-Id: 57242 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3223031wrn; Tue, 14 Feb 2023 14:06:30 -0800 (PST) X-Google-Smtp-Source: AK7set8f5EAqkM6FFkdhz7+yDzSW8RdKPW+NI6QoXVmavX+11AWTa+UkPKMceNZHHBqb6fFmeyp+ X-Received: by 2002:a17:906:d0d5:b0:8b1:2cdb:b8dd with SMTP id bq21-20020a170906d0d500b008b12cdbb8ddmr3708478ejb.58.1676412389915; Tue, 14 Feb 2023 14:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676412389; cv=none; d=google.com; s=arc-20160816; b=bzWrxVyrvYf2/r+xs0dWXVG3W4bcVO8o1JTCK9XzCGsA2C/vzXfB21SWEx+OcqqR/0 CiyGaMJpcmHtP1DdrPwfAzVsHWb+325Bks9B4GvbbruT+nXXHyelksFx4rQBCW+/As5s DnniSs1bfE/hixbJCN8wMFe+GzHKbbtJS3V2vb67YW6HQ1QsE7MDvfhsYdbjK1Kd5l7n d35lANgfWloJIzm2H4v9/qwVwbN9XdntrgPUBi0e4ZCrfE5w83t+uYZNyIVxqnaVsiiv wxEkTU/54xYW8z0E3/pRPFEDhrmik2boKmImDBVhP3W+ADfQ2EpzktLQpHrrHYqw8GU7 5wug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=oV3VgFBLdqdFf0Ea+vkgthoqfBBbr34vGspqoFBdBuY=; b=IgOWOk+A45i0Q7cQ3CRjrfuaXvkVHTo6zypFWNYxCfJ4alNxj9y4N/NyNwDZvVXWTl Bz82RbHKwrhRV0km6Yu0Iid0jWTo2pr3UMbpZOsJlT18XjjkIp+wqoSx3UApJZHTK9G2 SgBaM8yo0weLIhZrWB8Y8DfyLX0D/ORdlhyGHq7Tw92jhaSps18LgP95ECGlgt/Kn0g/ KnxqLuxId4Kq/F4Yk90ZzYIP0KjuVdPSi+O8vxkFV+KR17XvdDAI1hJunG8dPZpnPfWQ xp2eDI0Z0v31yPj6RVWI/7pJ4V1zdD4OCGEuMFXyt0CVtC4/M0EM6z7C5duWANpcuhSC J8yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="ci6jB/L5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gg32-20020a17090689a000b0088af44e487fsi15973119ejc.182.2023.02.14.14.05.58; Tue, 14 Feb 2023 14:06:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="ci6jB/L5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233059AbjBNWEo (ORCPT + 99 others); Tue, 14 Feb 2023 17:04:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233212AbjBNWEm (ORCPT ); Tue, 14 Feb 2023 17:04:42 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FC0B3AAA; Tue, 14 Feb 2023 14:04:39 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id d8so17225339plr.10; Tue, 14 Feb 2023 14:04:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oV3VgFBLdqdFf0Ea+vkgthoqfBBbr34vGspqoFBdBuY=; b=ci6jB/L5E5M98Nw7Z5xC1J1e0t9D3ayUJF0Fb03GdIxeHHbkym8/PRcs7av+rDcq1Z osJFuYQ8zwoJKUO+5e2xMLXaT6pfQmtI/3I0a2uX6gOH3ZaxXZNdgOJ6QFMBjaWHw3q7 LMeEpIavISB31JJvk35mO0ZCv35C9poV2uiT3Lz92wgCB3GbwXvrmErdjuapg2PLuk0U 8n3bV6OteJRnbhggxEMnlylqFr6RB3kQwSBDYgutxYEkVGijTvXdAFNb1cJpk2BPt2L8 HRFL1nw32Oz854hiCrt7iUQs1iC0DyKo4p2UzdzHuHnDmvHPcs5LMz7/w1UhAGTfrgqM 22NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oV3VgFBLdqdFf0Ea+vkgthoqfBBbr34vGspqoFBdBuY=; b=N/+Nq5KuAAduIjxKjnwSpJZPBwdZqngZ8cAZdwOkOKQQc8uf3xx3r8j8b6dOxL555p tREu3rB29vWw+n2ovw1490fsvBPyLpsDPFEx4+f8yvumh7corJzBG9aJAp9h/oTS1ZIQ zqBbnWnTkmKA4S8xtFfPPnSjLwBVCsnCVFYqwF5h5rhRKGPkZMFjCxk9fK2Zkfg9GRd9 EkT1+iKf+U2fqniDQKP9vIoe+ny4MxX3oNWnAjFUzf1VFlmWnQLajNleneJAZLOohz++ 0wiY879EwR/TRO+VHqXbCcIRY6WXzWlc6gwaEOdBoqFY+dHoxjBaqaKGN3cmM42PCMSY jrow== X-Gm-Message-State: AO0yUKVkH8xLAX5vinkfmCBVte+w2L9sdLWuyyGaVP9Alv1RbrcVmPnm vpVYvXpQHFELRRF2yYRP+w9oALKDeQ6Pbg== X-Received: by 2002:a17:90b:4b0b:b0:233:e940:d3f9 with SMTP id lx11-20020a17090b4b0b00b00233e940d3f9mr347227pjb.34.1676412279094; Tue, 14 Feb 2023 14:04:39 -0800 (PST) Received: from kazuki-mac.lan ([2400:4051:ea3:5910::19a]) by smtp.gmail.com with ESMTPSA id e17-20020a17090ab39100b00233e8a83853sm23759pjr.34.2023.02.14.14.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 14:04:38 -0800 (PST) From: Kazuki Hashimoto To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sudeep Holla , "Rafael J. Wysocki" , Daniel Lezcano , Lorenzo Pieralisi , Hector Martin , Sven Peter , Len Brown , Pavel Machek , Kazuki Hashimoto Subject: [PATCH] PM: s2idle: Don't allow s2idle when cpuidle isn't supported Date: Wed, 15 Feb 2023 06:50:03 +0900 Message-Id: <20230214215003.70683-1-kazukih0205@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757845798571013432?= X-GMAIL-MSGID: =?utf-8?q?1757845798571013432?= s2idle isn't supported on platforms that don't support cpuidle as of 31a3409065d1 ("cpuidle / sleep: Do sanity checks in cpuidle_enter_freeze() too"), so update the suspend framework to reflect this in order to avoid breakages. Link: https://lore.kernel.org/all/20230204152747.drte4uitljzngdt6@kazuki-mac Fixes: 31a3409065d1 ("cpuidle / sleep: Do sanity checks in cpuidle_enter_freeze() too") Signed-off-by: Kazuki Hashimoto --- kernel/power/suspend.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 3f436282547c..27507ae7c9c9 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -556,6 +556,12 @@ static int enter_state(suspend_state_t state) trace_suspend_resume(TPS("suspend_enter"), state, true); if (state == PM_SUSPEND_TO_IDLE) { + struct cpuidle_device *dev = cpuidle_get_device(); + struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); + + if (cpuidle_not_available(drv, dev)) + return -EINVAL; + #ifdef CONFIG_PM_DEBUG if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) { pr_warn("Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform.\n");