Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3581004rwb; Tue, 16 Aug 2022 05:42:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Ep9caGsiBdkX2SpB6HHoiEhU/3bEcGrql3/p9DVyvRtQJc/1+rfnHZ2n1F/3CYA45+Dsx X-Received: by 2002:a17:907:b590:b0:730:9e0f:e9a3 with SMTP id qx16-20020a170907b59000b007309e0fe9a3mr12950607ejc.112.1660653767109; Tue, 16 Aug 2022 05:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660653767; cv=none; d=google.com; s=arc-20160816; b=WAXmJEDSbiD30xPE86Y62Hhyi1PCvPulsnvJsKnvuBDdHxSSJYMVBCUeWaAl+sVFuz pMMGR2/wVIpMA0W8mMXaeR/rDtcRbsExmYo1rF1Nh8yCgpNcX7YhVqQ7ZXYthL7IEws+ GHg4WM0jpiu8qOPzmloca3Zttw+71gG6IcuFkXIPcpuj9QzwqZ/FkgFTsAsogXDAhpyp NbqB6BZFoYbWltrTY2ASDxYMFU0dJv3IJYs7HGP/2Z4/He8p5eS5O1yW9Azh0oUi3ly7 fx1b1D7u74KPEqqI3IataWY8fXdSxYyhK5IiWM+5ymB7LHB1pS+Piyp8kx/wpwbY3+lv Fleg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=mIoymzt+0/rznLOQj0WxuL/HEgD1VB0DGPWVPsY/G7M=; b=s/D/8I36r0FG7hfDAYN024m7WQZz14Mkvpd2uF7WVS2drbM4aqwzO3H9w4787tQtPx efyfh9jcotak0Pi3I2tq7N7MUb0KPvgf3hMG5kT278JlRI08CTosf28bsUpLm0gZRvC0 FunKtlrS0E4LKa0jC+hrBHG7/vSjVSM/AO6xiE3UGcoEdTVKMQT353+0Kh/iM+iEX4aZ 0p/HgKCtPMe9UH2Y4sp0IRKaGKlxckrP8TqYSB9flx+FZngludf6L1fm44IpvPRgy2gt CRNC1BM1G4SoerPrGJgtrzpKb1bhfZUkRfVXeAkXtCFhw3mm1v+puwu74mfCzR4DkoMZ HIVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a056402194600b004408bac1e00si8337574edz.103.2022.08.16.05.42.21; Tue, 16 Aug 2022 05:42:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234787AbiHPMKu (ORCPT + 99 others); Tue, 16 Aug 2022 08:10:50 -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 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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_policy *policy, target_freq = clamp_val(target_freq, policy->min, policy->max); - if (!cpufreq_driver->target_index) + if (!policy->freq_table) return target_freq; idx = cpufreq_frequency_table_target(policy, target_freq, relation); -- 2.17.1