Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2825809pxv; Sat, 3 Jul 2021 22:50:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwztBepdX6RFylzf8SnuIBBJvSFtzCJcBPnlDT6Ws4bpZ2u2iqtHuiiUNru8nsJxSM4XIjo X-Received: by 2002:a6b:6616:: with SMTP id a22mr6669034ioc.27.1625377840589; Sat, 03 Jul 2021 22:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625377840; cv=none; d=google.com; s=arc-20160816; b=e0Eg5HBVP7BPgJpk3ht3II4TKbGM2VV8BQvexk4IVrwJ8x38eG+IbpJLGHUxKQEoQF mmZkHpvPsz6ZHH8QJBMlWyuye3+T+MzDZVAqNUTYGDCxb8W8QMqL7rYWay4u2VOtt1QE 7MDi+oZQCKHropG+v9uHkmwJr8Bwm7TcpJrzh+lArQV42MIP9rxyVuIygNSpJr5Mxhhq +DZ8QWSmYwdXxspopDSQBUnUFRJl1l3Bm0ko0Je7iHb3POJxLr1+8hTnG/gxtAMLc4lQ 0VXkAbET7QoDuEhrXea5KHEYin0HB4nMQGV2o6JAONP3ft3b1J+JA6AA158YB/e1D9sg 32VQ== 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; bh=Kfcau82+aF71IMQ7/QnmBy3I+BaYF4vAbupivNqGImA=; b=U8xHN28UCJZ6M8gQPJEEh9u/hAQSqSnU9H/CPt1eCEN/u5ddvIhbwnop1EucL3iAiA pSELsO8WpQkC6bh9UuaOnyR5gDTH+95hgS2ZmwLlFeTbr7FIBEXJjnZOlZDrT9DeuD3q YYlVExfPwdxscAEFz7i0AaUlb5KmXoWdAwwyi6JC5RkeLAruM6TznpSECNkpNCuRPniW UzweXxU+hWYhFLKgzzDvQ0gcGWUo60KpDsi3LE+5Zw/P3jNGhZWl6BrjCdTi+NLgzPqD s9okbryK2/fz2eTWG/lBeWdoMaVQm60BG//SoH0M76W5f6WTpwVrltNDJJXx705UHeyC 92sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si9479670ioo.61.2021.07.03.22.50.28; Sat, 03 Jul 2021 22:50:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229499AbhGDFwi (ORCPT + 99 others); Sun, 4 Jul 2021 01:52:38 -0400 Received: from mailgw.kylinos.cn ([123.150.8.42]:49557 "EHLO nksmu.kylinos.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229476AbhGDFwh (ORCPT ); Sun, 4 Jul 2021 01:52:37 -0400 X-UUID: 077d661e23cc427a8fc7c9e0983c0c3d-20210704 X-UUID: 077d661e23cc427a8fc7c9e0983c0c3d-20210704 X-User: xiongxin@kylinos.cn Received: from localhost.localdomain [(111.28.186.210)] by nksmu.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 797888787; Sun, 04 Jul 2021 13:49:02 +0800 From: xiongxin To: len.brown@intel.com Cc: rjw@rjwysocki.net, pavel@ucw.cz, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, xiongxin Subject: [PATCH] PM / s2idle: Fix the failure of specifying "mem_sleep_default=" parameter Date: Sun, 4 Jul 2021 13:49:54 +0800 Message-Id: <20210704054954.9349-1-xiongxin@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On the arm64 platform, the psci driver is used by default to set the suspend_ops structure; but the psci_acpi_init() function is called before the command-line parameter "mem_sleep_default=" is specified; the user cannot set the desired suspend mode through the "mem_sleep_default=" parameter; In mem_sleep_default_setup(), judge whether suspend_ops is set, if it has been assigned, rewrite the value of mem_sleep_current variable; in order to complete the user setting; Signed-off-by: xiongxin diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index d8cae434f9eb..bef4b17de3f6 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -192,6 +192,21 @@ static int __init mem_sleep_default_setup(char *str) break; } + /* + * When the suspend_ops has been set, "mem_sleep_default=*" will + * be invalid, here to fix this situation. + */ + if (suspend_ops) { + if (mem_sleep_default == PM_SUSPEND_TO_IDLE) + mem_sleep_current = PM_SUSPEND_TO_IDLE; + else if ((mem_sleep_default == PM_SUSPEND_STANDBY) && + valid_state(PM_SUSPEND_STANDBY)) + mem_sleep_current = PM_SUSPEND_STANDBY; + else if ((mem_sleep_default >= PM_SUSPEND_MEM) && + valid_state(PM_SUSPEND_MEM)) + mem_sleep_current = PM_SUSPEND_MEM; + } + return 1; } __setup("mem_sleep_default=", mem_sleep_default_setup); -- 2.25.1