From patchwork Thu Jun 2 14:19:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69181 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp144439qgf; Thu, 2 Jun 2016 07:20:32 -0700 (PDT) X-Received: by 10.66.132.37 with SMTP id or5mr5914477pab.144.1464877224789; Thu, 02 Jun 2016 07:20:24 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si25021741pay.32.2016.06.02.07.20.24; Thu, 02 Jun 2016 07:20:24 -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 S1161266AbcFBOTw (ORCPT + 31 others); Thu, 2 Jun 2016 10:19:52 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:33177 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161242AbcFBOTu (ORCPT ); Thu, 2 Jun 2016 10:19:50 -0400 Received: by mail-pf0-f170.google.com with SMTP id b124so31967066pfb.0 for ; Thu, 02 Jun 2016 07:19: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=z1s4ohyrPDhy8XeqIQ9ps29bidsxxSdubDCbdESATOw=; b=XfFnbdOa54v+vNFVLuKB6lZQNfvrE0Og+93uiUyAOIgvJxlCeNYd3ZbhM8fRGZ33n8 G3G9KIgbp30ib9fB6FlhEix/uxpCMgV7Pg47HBrRw86dsRTpKuEgVEi1YbUYrFIeCNgr AzWaym6CpAHarqpT/dUO7rwhwRyXETesM30kk= 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=z1s4ohyrPDhy8XeqIQ9ps29bidsxxSdubDCbdESATOw=; b=Gm3VgJa6KrYH+TL4pe+/yIDKMXgk5nN17+Ln1i7G1FPQEKD49pLxfer9dcx6H6jarP +NdTAqdblp4NqZ7v8lBDvmHV9WeP3vO8l7sc5R8QQRgdhuyddL+sYkmG/dxPlKK3knUa //Po/apsASUczwXgtqUtg2c8PsrVLoo1+lMy3DDjCV/DZ1VhsZf2W9LTrzSe1vWGYWfU Az4q5XyLzP7aWm+YukQXaWlQo5EzjHYgkUx0R4COlh6VtbhLRRbg3Q0g0Gg2cV4ET61a eaSNzFA14La+tEcPNN1VD7D43orzzNXntiil+nS7w1u4K6jiASwgEFDN2uLWSljqASkK OVjA== X-Gm-Message-State: ALyK8tKUEDqqsxiiNfP33WoIIi7CtOzyYewBrUxL+by2vW4lPslzzSQ5EfJ6rdyB++Skboc2 X-Received: by 10.98.102.154 with SMTP id s26mr5009615pfj.41.1464877189328; Thu, 02 Jun 2016 07:19:49 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id i65sm1291914pfk.84.2016.06.02.07.19.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 07:19:48 -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, Dmitry Eremin-Solenikov , Kevin Hilman , Krzysztof Kozlowski , Kukjin Kim , Sekhar Nori , Shawn Guo , Steven Miao Subject: [PATCH 09/11] cpufreq: maple: Use 'index' only to index into policy->freq_table Date: Thu, 2 Jun 2016 19:49:09 +0530 Message-Id: <4930072c05d216e86acd6246fdbc116bcc8026ac.1464876460.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-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: Dmitry Eremin-Solenikov Signed-off-by: Viresh Kumar --- drivers/cpufreq/maple-cpufreq.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.1.410.g6faf27b diff --git a/drivers/cpufreq/maple-cpufreq.c b/drivers/cpufreq/maple-cpufreq.c index d9df89392b84..8ce92ee7dd8d 100644 --- a/drivers/cpufreq/maple-cpufreq.c +++ b/drivers/cpufreq/maple-cpufreq.c @@ -133,6 +133,12 @@ static int maple_scom_query_freq(void) static int maple_cpufreq_target(struct cpufreq_policy *policy, unsigned int index) { + /* + * policy->freq_table may be sorted differently, get the index value we + * are concerned about. + */ + index = policy->freq_table[index].driver_data; + return maple_scom_switch_freq(index); }