From patchwork Fri Jun 3 13:35:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69251 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp268876qgf; Fri, 3 Jun 2016 06:35:59 -0700 (PDT) X-Received: by 10.98.1.132 with SMTP id 126mr6164276pfb.27.1464960953104; Fri, 03 Jun 2016 06:35:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ce1si5842876pad.166.2016.06.03.06.35.52; Fri, 03 Jun 2016 06:35:53 -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 S1422679AbcFCNft (ORCPT + 31 others); Fri, 3 Jun 2016 09:35:49 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:34835 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422640AbcFCNfq (ORCPT ); Fri, 3 Jun 2016 09:35:46 -0400 Received: by mail-pf0-f182.google.com with SMTP id g64so43966676pfb.2 for ; Fri, 03 Jun 2016 06:35:45 -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=5AGaubx1fzJNLjScqt2bfC8UJ6ivSano7ZyZJMKwS0c=; b=bktt0q8GTK3i16HHQIzq/4Mqv84oxoiZMmGm/2KMFzTrcFn+pucuQzYBMBakL2JmvH KGr3NkDi5683YXj+9J3RdpWOZjwXcdEdCuFp2jJ+XHO+Xm8wBI0lC/Vf4Si1iXwGi1Zy zDkzXOw+prnvadvFEvOj1HS//7/+wCCbZAyqw= 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=5AGaubx1fzJNLjScqt2bfC8UJ6ivSano7ZyZJMKwS0c=; b=Df5sNEufuFp65llP8l50nqwpeYCFDEd5COT62mpEQ5sSzR4REtODgKxdnZswN5dNFP o0uefwi1fwK1pDvIj1KU6sA25OO1TJ+sYgLKBnbdkJ/8y5+oakF/zPU3jUel28+mCDvm wcc3GWznMRNBZF4Qqolp9OUCTZboNfe37ZhofOPWC1UKlZFvl7FCovkuFkUIDgr0fZzl TdXbZpprqH+BAZHpjy0tuHc8yOkHqoBoVaSzVbFiUAx8ifw6eWEavcuKayK/ogGouDkR MX0dapPUR4PLKhbrJEFzDye5mBCYykkwk0vZTR3J/esMSC6aR1f8FFsMRB+G+8MtUd1L WKlw== X-Gm-Message-State: ALyK8tJBv2q3uLqX8dtVfo7PupKe1wmI0rlidZdL/o83QrIlEYEN422dnF1cK6qP4U+sRbho X-Received: by 10.98.53.70 with SMTP id c67mr6134805pfa.63.1464960945205; Fri, 03 Jun 2016 06:35:45 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id s86sm8633537pfi.69.2016.06.03.06.35.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jun 2016 06:35:44 -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 5/9] cpufreq: ia64: Use 'index' only to index into policy->freq_table Date: Fri, 3 Jun 2016 19:05:11 +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 set properly by the driver now. Signed-off-by: Viresh Kumar --- drivers/cpufreq/ia64-acpi-cpufreq.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.7.1.410.g6faf27b diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c b/drivers/cpufreq/ia64-acpi-cpufreq.c index 759612da4fdc..cc8bb1e5ac50 100644 --- a/drivers/cpufreq/ia64-acpi-cpufreq.c +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c @@ -210,7 +210,12 @@ acpi_cpufreq_target ( struct cpufreq_policy *policy, unsigned int index) { - return processor_set_freq(acpi_io_data[policy->cpu], policy, index); + /* + * policy->freq_table may be sorted differently, get the index value we + * are concerned about. + */ + return processor_set_freq(acpi_io_data[policy->cpu], policy, + policy->freq_table[index].driver_data); } static int @@ -282,6 +287,8 @@ acpi_cpufreq_cpu_init ( } else { freq_table[i].frequency = CPUFREQ_TABLE_END; } + + freq_table[i].driver_data = i; } result = cpufreq_table_validate_and_show(policy, freq_table);