From nobody Sun Sep 14 22:46:34 2025 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 940BCC54EE9 for ; Tue, 13 Sep 2022 14:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233165AbiIMO21 (ORCPT ); Tue, 13 Sep 2022 10:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233744AbiIMO1k (ORCPT ); Tue, 13 Sep 2022 10:27:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80A5B62A84; Tue, 13 Sep 2022 07:17:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F08EF614B6; Tue, 13 Sep 2022 14:17:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B399C433C1; Tue, 13 Sep 2022 14:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663078625; bh=clkQyZKh5bH63+URz0rVRixmIuxpZVkeNeCIrGtcjM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6+X/bTJHZR0r8qlh8RQ7AxMy2Tgw2fB+s2xeQvGaH+I1h2beznyamUtWq6Vy94RW yNyx71QtUqXJH3KgECmsnQaMvciHvOHTE8vh4AhKXqv5ROnhxHh2VHBTvQy2CCq9/c /WR+0UAfydr+F7b7ooW1639m+NBRC/NuqzESv2Bs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Viresh Kumar , Lukasz Luba , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 021/121] cpufreq: check only freq_table in __resolve_freq() Date: Tue, 13 Sep 2022 16:03:32 +0200 Message-Id: <20220913140358.254160115@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140357.323297659@linuxfoundation.org> References: <20220913140357.323297659@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukasz Luba [ Upstream commit 6ca7076fbfaeccce173aeab832d76b9e49e1034b ] 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 Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- 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 cddf7e13c2322..799431d287ee8 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.35.1