From patchwork Fri Jun 3 13:35:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69255 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp269232qgf; Fri, 3 Jun 2016 06:36:44 -0700 (PDT) X-Received: by 10.98.44.134 with SMTP id s128mr6119354pfs.153.1464961004627; Fri, 03 Jun 2016 06:36:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si7641923pfj.174.2016.06.03.06.36.44; Fri, 03 Jun 2016 06:36:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932909AbcFCNfu (ORCPT + 14 others); Fri, 3 Jun 2016 09:35:50 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:36776 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422678AbcFCNft (ORCPT ); Fri, 3 Jun 2016 09:35:49 -0400 Received: by mail-pa0-f48.google.com with SMTP id te7so11415677pab.3 for ; Fri, 03 Jun 2016 06:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=9v5cV/NGzm3SN9b0LPEgkEF2ivLFXm0tt1/liithe8Q=; b=JuiV2AmgD3WhFokLplntG+cqfw9CI+idGhCU/ZxW9/xufpq5NymBa8bB1xOmecM0an cSmGO75Rge/tCrMpHkWKWjPRnwk6xikZvI3uw0+M2LjNVHfc6Ag6LPVbi8/yj/bs8rLT QaT23k6ysVIL6Lcvgl2CWiX1LHE0MfZt3R258= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=9v5cV/NGzm3SN9b0LPEgkEF2ivLFXm0tt1/liithe8Q=; b=hOEzoPBQbXM8AZJAGwklPAom/gbl8WOmFGRQOZETID/Nl/DW2MvFg08BYMfRN/AmZU qxxWWitx/sgQltoBxqvSkoMUnTtOI+yiHz8QxyrcYcWBOju3PvwzMcgSLcLFMIc3A98y 5MQZkkTi1nralMxu3YkWkAbZ31U32D3UWi96ALGuuTUR1UopjQxyt8S7V0TlBUh/dxFG Dhbycrzzg7X54Qu4Bih0vkuWn//rMZ1J1P0rXY9C/ZGrW9AE19KdAFXG4GzhIEZu+JFn U5Yb798SPCmQ5OKYljSAhFNkKwyWW6Qj36fdaivh64cam8ALxqXA13VbWoLpGITFRvnj 7psA== X-Gm-Message-State: ALyK8tIIr6ejUxVOM9LlkRuO+CxnZCoKMCr/aLNTcp6So+Va4nUguxoAkY0VBWE8YySFTBEw X-Received: by 10.66.84.164 with SMTP id a4mr5286480paz.90.1464960948388; Fri, 03 Jun 2016 06:35:48 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id ap3sm6213357pad.33.2016.06.03.06.35.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jun 2016 06:35:47 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, steve.muckle@linaro.org, Shawn Guo , Dmitry Eremin-Solenikov , Krzysztof Kozlowski , Kukjin Kim , Steven Miao Subject: [PATCH V3 6/9] cpufreq: imx: Use 'index' only to index into policy->freq_table Date: Fri, 3 Jun 2016 19:05:12 +0530 Message-Id: <5be64daa9fc2967351f7e5949b814d866264598e.1464960877.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Later patches would make changes in cpufreq core, after which policy->freq_table may be reordered by cpufreq core and it wouldn't be safe anymore to use 'index' for any other local arrays. To prepare for that, use policy->freq_table[index].driver_data for other driver specific usage of 'index'. The 'driver_data' fields are already set properly by the driver. Cc: Shawn Guo Signed-off-by: Viresh Kumar --- drivers/cpufreq/imx6q-cpufreq.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 3858dc7e617b..e7da85890e8c 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -42,14 +42,21 @@ static unsigned int transition_latency; static u32 *imx6_soc_volt; static u32 soc_opp_count; -static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) +static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int pindex) { struct dev_pm_opp *opp; unsigned long freq_hz, volt, volt_old; - unsigned int old_freq, new_freq; + unsigned int old_freq, new_freq, index; int ret; - new_freq = policy->freq_table[index].frequency; + new_freq = policy->freq_table[pindex].frequency; + + /* + * policy->freq_table may be sorted differently, get the index value we + * are concerned about. + */ + index = policy->freq_table[pindex].driver_data; + freq_hz = new_freq * 1000; old_freq = clk_get_rate(arm_clk) / 1000;