From patchwork Thu Jun 2 14:19:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69185 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp145041qgf; Thu, 2 Jun 2016 07:21:45 -0700 (PDT) X-Received: by 10.98.157.89 with SMTP id i86mr4917224pfd.121.1464877305271; Thu, 02 Jun 2016 07:21:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si811273pfj.44.2016.06.02.07.21.44; Thu, 02 Jun 2016 07:21:45 -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; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932937AbcFBOVm (ORCPT + 31 others); Thu, 2 Jun 2016 10:21:42 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:35038 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161131AbcFBOTq (ORCPT ); Thu, 2 Jun 2016 10:19:46 -0400 Received: by mail-pf0-f177.google.com with SMTP id g64so31986252pfb.2 for ; Thu, 02 Jun 2016 07:19:46 -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=WKyYh+KydchHenz1T7zZSwvJAX5DDXjtsLJEuVDzWgtv9OLjlU2bu9q3AfFMaCtvrW E4/LZFgNfuiO4t+Lp3qEanmLBYw5xYyKwZm+khz5tGzp1zeYXltLF7hEt/u6d+BpMIYx +d1r/4xXhPTQx/qv9gxn79IFGJXt2LzcyQuGQ= 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=Ocnus0iNPIPPX1D2kJF4fbmMuuJTFtYMpUSvpfuSZgvKFA7DBpjiex/MIGW3ksCa/C c9zUNL9XXCX4gv9R5y6jFhoEdRp1aquDqQllrYDuqWcyeT/yUccMXtgrcHWOTTy08HAO BCcWLXrjOe7yYvzrzmt9d66/vcQmIvSiEAYS429mmxlGAcBZOD5td90WJOUbUWYFkJS+ fb5eTW8Nh20mICGe/doW9iw3DKLrW+SMQ9o7G8MBpRJRUPdlMkxv0YspSnk8gk4XNNIv /i4au8VptRfDy4Ux58aUcU0wAEiv/Gl0V4JLBw96ylWClEAmcn3iSXM1tupW0/6QtnRT wusA== X-Gm-Message-State: ALyK8tJZ02hNdfw2LuwItt4eChkGJ9ypflxb750wcaAEas8FVJO/GAyB7GGWsv4aivhE4Kwf X-Received: by 10.98.94.194 with SMTP id s185mr5043942pfb.32.1464877186072; Thu, 02 Jun 2016 07:19:46 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id vy8sm70720499pab.22.2016.06.02.07.19.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 07:19:45 -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, Shawn Guo , Dmitry Eremin-Solenikov , Kevin Hilman , Krzysztof Kozlowski , Kukjin Kim , Sekhar Nori , Steven Miao Subject: [PATCH 08/11] cpufreq: imx: Use 'index' only to index into policy->freq_table Date: Thu, 2 Jun 2016 19:49:08 +0530 Message-Id: X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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;