From nobody Sat Apr 11 03:52:12 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18AAAC25B0E for ; Tue, 16 Aug 2022 12:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234911AbiHPMKw (ORCPT ); Tue, 16 Aug 2022 08:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235507AbiHPMKa (ORCPT ); Tue, 16 Aug 2022 08:10:30 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F33C97F127; Tue, 16 Aug 2022 05:02:09 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 07877113E; Tue, 16 Aug 2022 05:02:10 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.14.225]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 101303F66F; Tue, 16 Aug 2022 05:02:07 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: lukasz.luba@arm.com, viresh.kumar@linaro.org, rafael@kernel.org Subject: [PATCH v2] cpufreq: check only freq_table in __resolve_freq() Date: Tue, 16 Aug 2022 13:01:57 +0100 Message-Id: <20220816120157.24455-1-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There is no need to check if the cpufreq driver implements callback cpufreq_driver::target_index. The logic in the __resolve_freq uses the frequency table available in the policy. It doesn't matter if the driver provides 'target_index' or 'target' callback. It just has to populate the 'policy->freq_table'. Thus, check only frequency table during the frequency resolving call. Acked-by: Viresh Kumar Signed-off-by: Lukasz Luba --- Changes: v2: - collected ACK from Viresh - corrected patch description (Viresh) drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 7820c4e74289..69b3d61852ac 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -532,7 +532,7 @@ static unsigned int __resolve_freq(struct cpufreq_polic= y *policy, =20 target_freq =3D clamp_val(target_freq, policy->min, policy->max); =20 - if (!cpufreq_driver->target_index) + if (!policy->freq_table) return target_freq; =20 idx =3D cpufreq_frequency_table_target(policy, target_freq, relation); --=20 2.17.1