Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1491750imm; Tue, 15 May 2018 21:33:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqgP8Sr8R/2Q7zyN0ykmcH+U89BEY1wTE+7tNw2le/J0oiBrZFmGOJCcaaFociYd512Go6j X-Received: by 2002:a65:62c3:: with SMTP id m3-v6mr14340984pgv.385.1526445223621; Tue, 15 May 2018 21:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526445223; cv=none; d=google.com; s=arc-20160816; b=GS15LoshKpH/Z2/VfALhwngsmGxZjZGCb17p/0WMBrtD1UNCqN1L8YQhJ2d/xzXLeJ BCiq42YC12hNexLhkjoI94W3r8F/mVBnySNDosP/hXtUHwOvwgIRyd8GbVf17H3xlR1R msvCZEBSncd4e1UWdV/7N1NXJXFAjYxrF0idV4wZdybbxdnVgD4TLqMp6kUR9lADeCUO x5Q6RoaQ4q1xGNGrMwMREERx2NoawdcHoYjLhqwCyWXmWu6b/l9W+cQMMRu78p4g6LKA vFitpOdb2JeQqkah89pwFp7tcX42akYb+V+zGK4XRNFBHcR1k+TTnfIbcToLd4MOw55u 68pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=gYkzybQv6fWMeulS7BVo/DW0sEnXH6NJw4N/CbHj9YI=; b=V0uQx6WIX7bZIVCPAB4BvC9Xba7iPb16hNEMse9xYiQrN9fbNstB0qHJzSsYI10tsp B2dxQ4A4IVcUyQHpe9FQlI7jRuK0/GybFva5f+C30QgEjgmnmQkan6iKYGcjBqxqOhbk zXXozQgYaaqn884IIR1E55GlKxmEPAxbMDJSwZdCy3YvnewMRf/2cZFMQEY4NSeo8doc vx4NxeT9nSwiaYZWGFhbpMQqQy14Z/D/+DEe2L0VDohstcMnm/GuPbJJr9eSUP/jBvjG q0TdAzuayT3omBg9gGeLVINjO9fop6cKmWr8PeOMNMSxcfjFHK2a2T53Hx/AjJq3TQvx ND6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJFeg8Le; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si1717381pfi.285.2018.05.15.21.33.29; Tue, 15 May 2018 21:33:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJFeg8Le; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752154AbeEPEcY (ORCPT + 99 others); Wed, 16 May 2018 00:32:24 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36632 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751182AbeEPEcW (ORCPT ); Wed, 16 May 2018 00:32:22 -0400 Received: by mail-pg0-f67.google.com with SMTP id z70-v6so1016237pgz.3 for ; Tue, 15 May 2018 21:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gYkzybQv6fWMeulS7BVo/DW0sEnXH6NJw4N/CbHj9YI=; b=gJFeg8LeRZ9OMy1kAad/uswyZpoEND0fdso7tw1YrENPVdtsDGTHxKwY0hxqlwp2HH zvs7KImEdHKfwgxrMIMsEO9mqKcRJT+cq3dkwbjUgSIHi6Cio/RPL9eXc0BGRBKua22U H+4tzmVTrwqS6u8dW9fYDYIz7lzO6Gy3GKnjI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gYkzybQv6fWMeulS7BVo/DW0sEnXH6NJw4N/CbHj9YI=; b=RkTRm9spsLt5D34FpacNodcLaOnapqpFffsSoiTpe/NOYHnTaG2Z29pFf5H5p8kPo6 JCKSzUuzQFSSkBX3FEK11iqei2m8ZXCnb0pS3Pisq1TiAzzLb3hMzHAKKmbntwLzZiHS bncfaLhSqdidAAb3m2Wn9RRyU1MXnCsVGjU9IGEUI+8pUFZLXqFXy7VqZY3WgxGoayCd APgi0sX9CmKzZhl/aMlF4RbG9mOD1iF87guUUyRq45J6gBnpFqsBPfAq2RlCSbQHnzD1 Srw496JPPlPQgNqw6Lm8X8wOYWQ3EIc2ZqOCpzUyB0MvAkVG0UFbDjU2F/K6EXi4iGi3 Cplw== X-Gm-Message-State: ALKqPwdOdSWcPjZYjiXgX7d3kc0P0+uzSQDDA0dqXYDvDYcQrqsTW5et jLHjZ+kR9kEUAWq7ThaTjaU4oQ== X-Received: by 2002:a62:d508:: with SMTP id d8-v6mr17713928pfg.234.1526445142019; Tue, 15 May 2018 21:32:22 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id o5-v6sm1431999pgv.47.2018.05.15.21.32.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 21:32:21 -0700 (PDT) Date: Wed, 16 May 2018 10:02:18 +0530 From: Viresh Kumar To: Markus Mayer Cc: "Rafael J. Wysocki" , Brian Norris , Gregory Fong , Florian Fainelli , Markus Mayer , Broadcom Kernel List , Power Management List , ARM Kernel List , Linux Kernel Mailing List Subject: Re: [PATCH] cpufreq: brcmstb-avs-cpufreq: sort frequencies in ascending order Message-ID: <20180516043218.7ktq5vjq2rhcszz5@vireshk-i7> References: <20180516034954.56475-1-code@mmayer.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180516034954.56475-1-code@mmayer.net> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15-05-18, 20:49, Markus Mayer wrote: > From: Markus Mayer > > Most CPUfreq drivers (at least on ARM) seem to be sorting the available > frequencies from lowest to highest. To match this behaviour, we reverse > the sorting order in brcmstb-avs-cpufreq, so it is now also lowest to > highest. The reasoning isn't correct. Just because everyone else is doing it doesn't make it right and so you shouldn't change just because of that. What you must written instead in the commit log is that the cpufreq core performs better if the table is sorted (in any order), and so we must sort it as well. But I feel the table is already sorted for your platform, isn't it? And I don't see a clear advantage of merging this patch. > Signed-off-by: Markus Mayer > --- > drivers/cpufreq/brcmstb-avs-cpufreq.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c > index b07559b9ed99..7dac3205d3eb 100644 > --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c > +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c > @@ -403,7 +403,7 @@ brcm_avs_get_freq_table(struct device *dev, struct private_data *priv) > { > struct cpufreq_frequency_table *table; > unsigned int pstate; > - int i, ret; > + int p, i, ret; > > /* Remember P-state for later */ > ret = brcm_avs_get_pstate(priv, &pstate); > @@ -415,12 +415,13 @@ brcm_avs_get_freq_table(struct device *dev, struct private_data *priv) > if (!table) > return ERR_PTR(-ENOMEM); > > - for (i = AVS_PSTATE_P0; i <= AVS_PSTATE_MAX; i++) { > - ret = brcm_avs_set_pstate(priv, i); > + for (p = AVS_PSTATE_MAX, i = 0; p >= 0; p--, i++) { > + ret = brcm_avs_set_pstate(priv, p); > if (ret) > return ERR_PTR(ret); > table[i].frequency = brcm_avs_get_frequency(priv->base); > - table[i].driver_data = i; > + /* Store the corresponding P-state with each frequency */ > + table[i].driver_data = p; > } > table[i].frequency = CPUFREQ_TABLE_END; > > -- > 2.7.4 -- viresh