Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3487450rwb; Tue, 16 Aug 2022 04:05:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR4aUls+vBFFPtuZUoeVBY4jkPpsVhRDYvCfbsmoSctdS5y7YXquL8D9S57mR+Ebh70gIZGh X-Received: by 2002:a17:907:2c44:b0:731:85d9:786e with SMTP id hf4-20020a1709072c4400b0073185d9786emr12828603ejc.102.1660647942572; Tue, 16 Aug 2022 04:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660647942; cv=none; d=google.com; s=arc-20160816; b=WUSXVLmonNdNlx1eDIJCOd1hKy6M3V5XXZI9vKPzB2c6+MdeUgmX7wiIvVziIU6TCf OOyM2PQKI35Yj64Gz78pKeRbDZHCTZHx4XwPuyHKafWP1S5R8HBNXRJHimskIExdgs56 b0N1qlUEXTvsxkCghFFBLSAHCSrVfU7kexhUey3TfeyyHGJP1owGtqMED48AHVtrCcxl mMIfcUFvGVSDEGs38tXeK/R0KWTMQ5uXrtHSFbS8xLUke0bzNPP8E4C5egfCEPCLL2wC qzehJe+iSadbmnZmnAsefqHR5AyXWYsqCYxtIAug2VwUEdEvLu9lQJ+LjcJ/XPbe2MsJ wi6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ndTDWBpOc+4H4E6Ky5d3/8UYOmksqc/I1Y2AnOP27uM=; b=Frmx15cRrlEM1EfG41YdXG2++AyIvMNMf4YeNBzBOsWNW8i5goPSe7XN+dPzSwNppU jQFddfC8dyFHTh4YYmkgpGqm6yc1B5X53BpduOoxKBbE/nNcYKAKXNZHD7hMvDHXQ5Yq 7+7nvVtSrBDiIep/sz+TZRLS8mOEYJfX3R5n2rl8PZQrPqgHk72MUL7Efgl9aV9OGbxk eGaUNuMa1ledIfDbs9p4EP3kYAawQ8M2oagcYnka0Erd6VbGz28LV6WuWSaoAV4n3p2Z R/5Gi9x2I7rF/Mnlz6o9sQoHDLVNz2aRK4Bdug7lfkR5PhdUPClsKC63OOSltFANe/HH u5Rg== 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 z15-20020a05640235cf00b0043be8c8a743si11382018edc.35.2022.08.16.04.05.15; Tue, 16 Aug 2022 04:05:42 -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 S234991AbiHPLEE (ORCPT + 99 others); Tue, 16 Aug 2022 07:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234931AbiHPLDl (ORCPT ); Tue, 16 Aug 2022 07:03:41 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 81CB7C3F62; Tue, 16 Aug 2022 03:16:32 -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 A2785113E; Tue, 16 Aug 2022 03:16:32 -0700 (PDT) Received: from [10.57.14.225] (unknown [10.57.14.225]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0785A3F70D; Tue, 16 Aug 2022 03:16:30 -0700 (PDT) Message-ID: <04a18937-bb11-736f-2cb3-0cb76a25bcc7@arm.com> Date: Tue, 16 Aug 2022 11:16:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] cpufreq: check only freq_table in __resolve_freq() Content-Language: en-US To: Viresh Kumar Cc: linux-kernel@vger.kernel.org, rafael@kernel.org, linux-pm@vger.kernel.org References: <20220811165408.23027-1-lukasz.luba@arm.com> <20220812040545.gcmyjjpqfup3bo5u@vireshk-i7> From: Lukasz Luba In-Reply-To: <20220812040545.gcmyjjpqfup3bo5u@vireshk-i7> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 On 8/12/22 05:05, Viresh Kumar wrote: > On 11-08-22, 17:54, Lukasz Luba wrote: >> The there is no need to check if the cpufreq driver implements callback > > s/The there/There/ > >> 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); > > Acked-by: Viresh Kumar > Thanks Viresh! I'll resend this patch w/ fixed description and your ACK