Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp718781ybb; Wed, 25 Mar 2020 08:19:01 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuA9JkFtx074cS1LQkd9L32q0lYeJrMKpl5CR0ggE8Iu2JINjN6WUE08j0wUyanF4p1So3W X-Received: by 2002:a9d:6358:: with SMTP id y24mr2992133otk.49.1585149541089; Wed, 25 Mar 2020 08:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585149541; cv=none; d=google.com; s=arc-20160816; b=COH5XY43aP+i5aR122XvwyZNGFdwskvimsX6cPXRe2Pj3ZsdArDnw+hWJP87GW+aLg sg0XgdQWkuKVkrBzFd+h2c/G0VjuUIw3A4hNX1ZOZgL46G2r9hvMb3I3ysO3B2XHXPna BTSFcLok919qMY4RJquiOc448aTlgJ/CeKKe5wCDJq1wsYy/wLT937xnrSiL0bi7drXR HivJm2XUWo4Z5doa0e1Rg0E7jn4Nfqcly/oBdSdh2kak5QtROIGAyxn9q+pl/8S/pcRB JDsAwQGc5N3NGIO+6DrOC9sJzCxue4XHJsOVx9EK4v/OKiEH6xKuM7IOly/g7pHbiLph WoPg== 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 :message-id:date:subject:cc:to:from; bh=+KiBvr0yMHLq7l+TTlCFQlr3cD2I6H9TuQ2P7bCvIBw=; b=PB9lktnsGDx7nOY0WDHJ5UR2V8/7rn7uSN/LZaXsWnMeuhl/xUYRozVzmR7gI+wW7b NYUwZCgIyg92Qz8AACV2AXG40G0dfIBsnVyl4KiaFtBMLN6fYSbz9aVUOnp8AfF8l60H DPEad+NkkFKLvb/yvvud7gUHLxPWmh9ToD4piRb89nh7r7LRloR5MMINImRijJ0hBDSn TFkTxD3XPKCqBe4Kc+uNj4TU6e/aP8WTtiGcfCaovv5GvRoF6DLS0sXsPZXijm9xfPCU YGOGwywy28T4tfXlU8dAQ1Fm+a2aHu/RFtpAwuYQ8nf02KMV/5qMAk+0ItrfpygVfvWp z6Wg== ARC-Authentication-Results: i=1; mx.google.com; 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 j4si1511683ooj.58.2020.03.25.08.18.46; Wed, 25 Mar 2020 08:19:01 -0700 (PDT) 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; 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 S1727569AbgCYPSM (ORCPT + 99 others); Wed, 25 Mar 2020 11:18:12 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:51317 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbgCYPSM (ORCPT ); Wed, 25 Mar 2020 11:18:12 -0400 Received: from 185.80.35.16 (185.80.35.16) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 37eb982999ca91a4; Wed, 25 Mar 2020 16:18:09 +0100 From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Srinivas Pandruvada Subject: [PATCH] cpufreq: intel_pstate: Simplify intel_pstate_cpu_init() Date: Wed, 25 Mar 2020 16:18:09 +0100 Message-ID: <2521958.mvXUDI8C0e@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki The initial policy value set by intel_pstate_cpu_init() depends on whether or not CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is set, but that is not necessary, because the core will set the policy to "performance" in cpufreq_init_policy() if the default governor is "performance" anyway. Accordingly, change intel_pstate_cpu_init() to always set policy to CPUFREQ_POLICY_POWERSAVE initially to provide a valid fallback value to cpufreq_init_policy() in case the default cpufreq governor is neither "powersave" nor "performance". Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/intel_pstate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) Index: linux-pm/drivers/cpufreq/intel_pstate.c =================================================================== --- linux-pm.orig/drivers/cpufreq/intel_pstate.c +++ linux-pm/drivers/cpufreq/intel_pstate.c @@ -2247,10 +2247,11 @@ static int intel_pstate_cpu_init(struct if (ret) return ret; - if (IS_ENABLED(CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE)) - policy->policy = CPUFREQ_POLICY_PERFORMANCE; - else - policy->policy = CPUFREQ_POLICY_POWERSAVE; + /* + * Set the policy to powersave to provide a valid fallback value in case + * the default cpufreq governor is neither powersave nor performance. + */ + policy->policy = CPUFREQ_POLICY_POWERSAVE; return 0; }