From patchwork Fri Jun 3 13:35:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69252 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp269044qgf; Fri, 3 Jun 2016 06:36:20 -0700 (PDT) X-Received: by 10.67.3.161 with SMTP id bx1mr5361179pad.86.1464960980864; Fri, 03 Jun 2016 06:36:20 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4si7646275pfj.173.2016.06.03.06.36.20; Fri, 03 Jun 2016 06:36:20 -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 S932971AbcFCNfz (ORCPT + 31 others); Fri, 3 Jun 2016 09:35:55 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34042 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932842AbcFCNfw (ORCPT ); Fri, 3 Jun 2016 09:35:52 -0400 Received: by mail-pa0-f52.google.com with SMTP id bz2so14805246pad.1 for ; Fri, 03 Jun 2016 06:35:52 -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=aXVEtKnC5mhW53sw6tXslJWdQH6SZlsIGp9ozyjNt77JfSDBR91nUYlVEi1JmIE8lG iWLOYXOJuK/4cLifjaidPapDJi+aOxveLgItsSku5/iKFl2OEJrUHviB/8NKvEyxtHZu LlOWg48k7/tsgn5Ocu2j+Iy+maDvz5LUD34e0= 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=eBUlj2GzzgNmRiVwPIDP2EUUbr8yq+Pknz/xETmI+ns2pRXSt2uuLStFb6NESeY91Y yMvgPXv1F9+Zrtl8aXKDvbE1VhYWt4eh2mf8mGB7Su9HBUQo+KzOOsAnUGg44zaOyl/3 eYLJZfTD53PIJi1GmoGUAHdmnd1OVxiZ4zFr6d0eI4OVP6/BCFrzDRSfw9PyYGl+49OM QWiC7vmHOb5AlhlIuukbk8rzefHKXAv+HK91YBWNHt0Pgc5VtTcntjo2AxU5eQ6tCK+o tJYraejEz0MycRjzJwOYVo//p7hSVd4sNjBDZFGm1e93u1tCKZ9+SKrnEB3a1prWb801 85fA== X-Gm-Message-State: ALyK8tIXKsSSwmBL+KM03Ae08KCoJabHoTIIiahw7LkAqEdAdP6YIhDu2z1NFwFgoYKtO7io X-Received: by 10.66.51.135 with SMTP id k7mr5283721pao.155.1464960951592; Fri, 03 Jun 2016 06:35:51 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id s131sm8675223pfs.45.2016.06.03.06.35.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jun 2016 06:35:50 -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, Dmitry Eremin-Solenikov , Krzysztof Kozlowski , Kukjin Kim , Shawn Guo , Steven Miao Subject: [PATCH V3 7/9] cpufreq: maple: Use 'index' only to index into policy->freq_table Date: Fri, 3 Jun 2016 19:05:13 +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: 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); }