From patchwork Wed Jun 19 11:35:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 167224 Delivered-To: patch@linaro.org Received: by 2002:ac9:6410:0:0:0:0:0 with SMTP id r16csp500556ock; Wed, 19 Jun 2019 04:35:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqymjwy/Iynqf+9d+apugAJVIAIK/D8wUphFYV5xd/cfGm7Cu0gVTWqczlne/5E/WCH/09hY X-Received: by 2002:a17:90a:8c82:: with SMTP id b2mr10490182pjo.97.1560944159224; Wed, 19 Jun 2019 04:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560944159; cv=none; d=google.com; s=arc-20160816; b=INvyQfEGoYGUXVP+5f3ElYFksVeovNX1nRpmBa0sCqho/+Wk/C63dc99wHXrvtwvIt GoE2TEHOHXk7c4RFnLCsWKX5KRRxFYT0sb6T2qjIkMfOSDdUz2ftYOzHSfg1q9YDYdyu ccQ5CJ0lXOMmRJw2OuyaUlpYOVkKludDFbejzjIyP7/HVoKLdJl94d9Xe778leLnJS2k uKKwCdvgGYob5Ht6vkwrqA39eQqTBLpjYwe/JIdZmp7DUGtFp8nVAglZVwFPcMnp3GJ/ /TfP+lkki5cpuevPD2cXXTCCc8aG0qsXk9l0TRsZMDB95sJS3Z6IVeRisSKjRuH64/+g UH0w== 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=WHo+CK98Hk560A324w9NgmPfYqiucAAoOc1YvZRRmoc=; b=KniALnjHMWbDMtmHQtX1AEgBsBzuAQPWil6cYaS4Nkl6lQ3qC4znz4pFMl3SNcwtXu nzon/Bma/D0Ey0wsvHDse2NyQ7MHlemxxPwlwSUhJ8PTLLXpZ9GSjsXZw4mEcBOuY8oy UUYidbWfaiZCQndkd/4dgkYs/DuGXpwFlOMZ50trXZ4iUCPLUt7zMyPaHt7lKIZuoiBj 5JVbMwN3XwdptLIVsWjX6OT4DOHJ/2Teunu9iB8K5HeVaj/WWcpqvTRy0ygKpRVKfKZ0 bGdW5KQocZPtj6/1s+bAwcDeVt12tTNKJHj+3FyTu9/vNocY43ULfUE9PNouWXTQ+CET Wb2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OiuBJyYM; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si1551643pgm.219.2019.06.19.04.35.58; Wed, 19 Jun 2019 04:35:59 -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; dkim=pass header.i=@linaro.org header.s=google header.b=OiuBJyYM; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731694AbfFSLf5 (ORCPT + 30 others); Wed, 19 Jun 2019 07:35:57 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33280 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731678AbfFSLfy (ORCPT ); Wed, 19 Jun 2019 07:35:54 -0400 Received: by mail-pf1-f193.google.com with SMTP id x15so9598077pfq.0 for ; Wed, 19 Jun 2019 04:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WHo+CK98Hk560A324w9NgmPfYqiucAAoOc1YvZRRmoc=; b=OiuBJyYMUwp7Feymf81ldAOyO51jCbmcCR+ngPCLcmMfJHERBLuEK/NtPFeN8+K+6T 5/0SjsluzJJsesg4+W5STJStN4hWNLIcBT1aCRImcHUGxT3RG/6WbQ5aLsJR13ptzBpD p+QEtCFBEOATUSVe2ryWCzsoIeDaI39Bm7GB0aMEfN6LG2nFoW2+vjpRABHRvUTCdlQy UYrE3MLG4Oosu0hnZIIBU8BwsjW479JrJxmnoQZ2dcvYeSFh2hoGcACQ4peHEKnfsiTW FXNHd+kydKJOwYyrxFX8yxTIV+2HiZ/7KSpYEGXw8jhg6+fMMEtFImqU237wWKj+1wQN N+IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WHo+CK98Hk560A324w9NgmPfYqiucAAoOc1YvZRRmoc=; b=ZFwC4UGTPNI2i1xsnkSCgZb13RqbWx27TstZiGQvSfq+l+vhST445VadyowacEoV8z tVv/GilAvCq/tv+60Bif25Fw9KTe5VpSqOmIWeTlbCCS2hKbkY/CNEGpHyfO+mvM5gTg zaP5ya1zVy+quPm3VLB7m3n4nUNPSz3EWtr9IoXODCxCOS6wKVczNAnxp2tsKtKabBKV Jo5V3K4fxtux0gIHLOFtMkHVKmTZAgmaUfyiJ1jKHz/tzMn6Sv73lvU50jIBGvOEsCG4 h2XHVQEZlk8DsOHqzBztsDUgvCxmc6JzTs7lqOqnZLnK8ETUd3ZP0/5682UTALIxkmeF qJFw== X-Gm-Message-State: APjAAAWiFQ00QaQjSq62Q7y7YXQREiH6aTfxzD9o/kVok7wEiC7YZQ72 3lyzH6jg/957Wofx8sU5j0CkEg== X-Received: by 2002:a63:6f47:: with SMTP id k68mr7245648pgc.327.1560944154053; Wed, 19 Jun 2019 04:35:54 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id d9sm19205662pgj.34.2019.06.19.04.35.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 04:35:53 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 2/6] cpufreq: Replace few CPUFREQ_CONST_LOOPS checks with has_target() Date: Wed, 19 Jun 2019 17:05:38 +0530 Message-Id: <0660b023a0d80c63ec7a1f7fcb692de9a9f4d604.1560944014.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CPUFREQ_CONST_LOOPS was introduced in a very old commit from pre-2.6 kernel release commit 6a4a93f9c0d5 ("[CPUFREQ] Fix 'out of sync' issue"). Probably the initial idea was to just avoid these checks for set_policy type drivers and then things got changed over the years. And it is very unclear why these checks are there at all. Replace the CPUFREQ_CONST_LOOPS check with has_target(), which makes more sense now. Also remove () around freq comparison statement as they aren't required and checkpatch also warns for them. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 54befd775bd6..e59194c2c613 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -359,12 +359,10 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy, * which is not equal to what the cpufreq core thinks is * "old frequency". */ - if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { - if (policy->cur && (policy->cur != freqs->old)) { - pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n", - freqs->old, policy->cur); - freqs->old = policy->cur; - } + if (has_target() && policy->cur && policy->cur != freqs->old) { + pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n", + freqs->old, policy->cur); + freqs->old = policy->cur; } srcu_notifier_call_chain(&cpufreq_transition_notifier_list, @@ -1618,8 +1616,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy) if (policy->fast_switch_enabled) return ret_freq; - if (ret_freq && policy->cur && - !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { + if (has_target() && ret_freq && policy->cur) { /* verify no discrepancy between actual and saved value exists */ if (unlikely(ret_freq != policy->cur)) {