Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp211865iog; Tue, 28 Jun 2022 20:56:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1toMWTaUbZooIWusO5J5o3a4tM0KChn5lfhA3Eu/qiLiLadr0ruJVJ5T1EidHng3FR/KHXV X-Received: by 2002:a63:185b:0:b0:411:75ee:c87a with SMTP id 27-20020a63185b000000b0041175eec87amr1167081pgy.607.1656475014586; Tue, 28 Jun 2022 20:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656475014; cv=none; d=google.com; s=arc-20160816; b=IJvN4Ocq7/H/WspwNIg+VCHqhhYfoIXD/4pxu1B9iTzUe79VDy+ho0tCK+6Zk6Qdga psGC4BiorsAAIEgMr8vbKdhfSjTLMWGRTtvmwQjm0DQ5iMMCyQEPYfTG9//ZyvgaW0X3 oxs8fS9DhZGgrU/T61cSuaStKK93zCuRxxtGfF8twkHNC7fLS0/fA6Xk0pZdMOgVGQDe sudRmKDMchyzL5agz6kia9BePXowKdYVRGQaRAIXPEkD9AKhL421dqnjblgi3/8vj48f iJRnBsKCArWxThfssmm7yObE0pNy2d1S0p7Sp1sKeEptDqAPW2+GmHx5f06aZPzt0f52 9zOQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Fbd8uoz2m4BkWqvQgDQK1pD3CI8hU7Eqxi98a3mOAR8=; b=QBX58GTXj8IYGnmzaWG6LykQ80iwCfmlViHXl7a63jAdJO1UiaJDFL5bI5Cj1bWBkG a2xVKj4ttVMWTAdLJvb3LlkGX3nwuLrTnVPSe1iPJEzOZg9sdQeyQrvhzSv+W0Rhw2z0 iq/hj3h98kbmHUXEKHGNgjJud/QltXgRfZWRQ9KdkUafiU/v6TZcpcNDXVDSQW+1Jkaj rKDpWImuxjRC0LAbjrXftK5PAc6B5mPh9Tfki0SyBhZcTuO7BNeP3G3HCXZTUZbQxTPQ uMapfcFLmy93D1e+q6OsQNFDoutz7p88/KTckw/yoZbMGBdgwLbneUVQ/jokQ/re9c+A y0Ig== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f131-20020a636a89000000b0040cf84add25si20203782pgc.878.2022.06.28.20.56.42; Tue, 28 Jun 2022 20:56:54 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229733AbiF2Dky (ORCPT + 99 others); Tue, 28 Jun 2022 23:40:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231187AbiF2Dkp (ORCPT ); Tue, 28 Jun 2022 23:40:45 -0400 Received: from mailgw.kylinos.cn (unknown [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C30CD1F62F for ; Tue, 28 Jun 2022 20:40:38 -0700 (PDT) X-UUID: 1bb1e23ddc46451eb27756f03547cb43-20220629 X-Spam-Fingerprint: 0 X-GW-Reason: 11109 X-Policy-Incident: 5pS25Lu25Lq66LaF6L+HNeS6uumcgOimgeWuoeaguA== X-Content-Feature: ica/max.line-size 74 audit/email.address 1 dict/notice 1 dict/time 1 meta/cnt.alert 1 X-CPASD-INFO: dccd2544217d4dcf97ace11f98851172@rbOdhF9nYmReUXmwg6euoFlokZOVXVG 1e3JYZV9hY1KVgnxsTWBnX1OEgnBQYl5dZFZ3dG9RYmBgYlB_i4Jyj1RgXmCCVHSTgKadg5RgZQ== X-CLOUD-ID: dccd2544217d4dcf97ace11f98851172 X-CPASD-SUMMARY: SIP:-1,APTIP:-2.0,KEY:0.0,FROMBLOCK:1,OB:0.0,URL:-5,TVAL:182. 0,ESV:0.0,ECOM:-5.0,ML:0.0,FD:0.0,CUTS:143.0,IP:-2.0,MAL:-5.0,PHF:-5.0,PHC:-5 .0,SPF:4.0,EDMS:-5,IPLABEL:4480.0,FROMTO:0,AD:0,FFOB:0.0,CFOB:0.0,SPC:0,SIG:- 5,AUF:1,DUF:127,ACD:2,DCD:2,SL:0,EISP:0,AG:0,CFC:0.576,CFSR:0.037,UAT:0,RAF:0 ,IMG:-5.0,DFA:0,DTA:0,IBL:-2.0,ADI:-5,SBL:0,REDM:0,REIP:0,ESB:0,ATTNUM:0,EAF: 0,CID:-5.0,VERSION:2.3.17 X-CPASD-ID: 1bb1e23ddc46451eb27756f03547cb43-20220629 X-CPASD-BLOCK: 1000 X-CPASD-STAGE: 1 X-UUID: 1bb1e23ddc46451eb27756f03547cb43-20220629 X-User: xiongxin@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 2032682121; Wed, 29 Jun 2022 08:34:17 +0800 From: xiongxin To: rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, xiongxin@kylinos.cn Subject: [PATCH -next 1/2] PM: suspend: expand the assignment scope of the pm_suspend_target_state Date: Wed, 29 Jun 2022 08:33:37 +0800 Message-Id: <20220629003338.299195-2-xiongxin@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629003338.299195-1-xiongxin@kylinos.cn> References: <20220629003338.299195-1-xiongxin@kylinos.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, RCVD_IN_PBL,RDNS_DYNAMIC,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** 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 The pm_suspend_target_state variable can be used as a suspend state identifier and given to the specific device driver as a code judgment; Because the suspend_prepare() function is time-consuming for the operation of freezing processes, and this stage is actually in the suspend stage, it is necessary to expand the scope of the pm_suspend_target_state variable to be assigned to the suspend state at enter_state() function; Another reason is that the specific device driver can locate whether it is in the suspend state based on this variable, so as to determine the validity of its wake-up source. Signed-off-by: xiongxin --- kernel/power/suspend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 827075944d28..c754b084ec03 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -564,6 +564,12 @@ static int enter_state(suspend_state_t state) if (state == PM_SUSPEND_TO_IDLE) s2idle_begin(); + /* + * Expand the scope of suspend state for suspend operations + * performed from the /sys/power/state entry. + */ + pm_suspend_target_state = state; + if (sync_on_suspend_enabled) { trace_suspend_resume(TPS("sync_filesystems"), 0, true); ksys_sync_helper(); @@ -590,6 +596,7 @@ static int enter_state(suspend_state_t state) pm_pr_dbg("Finishing wakeup.\n"); suspend_finish(); Unlock: + pm_suspend_target_state = PM_SUSPEND_ON; mutex_unlock(&system_transition_mutex); return error; } -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus