Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp813240rwb; Thu, 11 Aug 2022 10:18:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ikna19SqyoT1B7dH3KHf28oyLqOGOO/24OdEaRCpgrYwlLNMk4lLC5c2rBC+KTKuA3bc+ X-Received: by 2002:a17:90a:c58e:b0:1f3:1ab5:22ae with SMTP id l14-20020a17090ac58e00b001f31ab522aemr9741140pjt.45.1660238287948; Thu, 11 Aug 2022 10:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660238287; cv=none; d=google.com; s=arc-20160816; b=KymzrF0urzJU84aUijrDsUU7qMmnL/3bq45savOKBY3MR61QWEWxrNUvciQjPy0xBf L7mshwGGJdOLZkWwbjeuYokaqjE5DS6V4Z07XNc7gJAHQyqmvsdorGtSiYCYFVEn5NQq 4KfyaH4fsMCa4o21b9XiWqiTiq/PEHmrCteXAHW0q67INy9XKFl3boxXg7mQE7scXqc/ sEIOfF+3mzCncOmmXFfV0ct52oGuuEBwu/iNNyovH6p0rgoO/inifs3ShOsvoa+f8cs2 PpqqZgSq+ZjPMlSZXSOG1cdDdRQfthmJjprIt18TG1cRDkFOKdvfA8JNJAkN7zMtfRQq AOVg== 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=0sGlOvNcGi22aLG/jdA3bM78qEsz58hULXy5/44zlJs=; b=j4HHVwmYPRmxj2rjAN5pen1uvt7mNL7I/cXLTI1xSNxvQiCUb++EZwb1K3k/k0Q4ZX KtNxWKsOuT1TVKYn2rs0x71TZ5tkR6zkVh78Tl94P/l9sQbJermuwlZtTDHnWI7CHLI/ QUHKtpVbZdOTvTsbUkrlrGpZiWNeiWDgG8QvvEKgQFJlR2Aze/cKGtX/eVWrDKaNjGGJ uiDAFhDZgsGJ2a61sbbwCUdgvHYZ8wtOH/5xRlL+eAEr9eMoFO1N8JBP8QFz13F1o6dR q24scVG81im0f60FpfBalAJAUL8aSCegZwvEI8wtTmpoGuWyYJMQONb6LcdQN7NFEF2m aDow== 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 s7-20020a637707000000b004215af667a8si847887pgc.514.2022.08.11.10.17.49; Thu, 11 Aug 2022 10:18:07 -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 S234456AbiHKRN6 (ORCPT + 99 others); Thu, 11 Aug 2022 13:13:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235915AbiHKRNg (ORCPT ); Thu, 11 Aug 2022 13:13:36 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 58AF99E13F; Thu, 11 Aug 2022 09:54:49 -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 B4D44113E; Thu, 11 Aug 2022 09:54:49 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.15.253]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C8AEE3F5A1; Thu, 11 Aug 2022 09:54:47 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, viresh.kumar@linaro.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, lukasz.luba@arm.com Subject: [PATCH] cpufreq: check only freq_table in __resolve_freq() Date: Thu, 11 Aug 2022 17:54:08 +0100 Message-Id: <20220811165408.23027-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 The 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. Signed-off-by: Lukasz Luba --- 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