From patchwork Thu Jun 2 14:19:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69180 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp144407qgf; Thu, 2 Jun 2016 07:20:28 -0700 (PDT) X-Received: by 10.98.102.25 with SMTP id a25mr5086124pfc.30.1464877224082; 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.23; 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 S1161240AbcFBOTr (ORCPT + 31 others); Thu, 2 Jun 2016 10:19:47 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:34613 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161198AbcFBOTn (ORCPT ); Thu, 2 Jun 2016 10:19:43 -0400 Received: by mail-pa0-f54.google.com with SMTP id bz2so6213143pad.1 for ; Thu, 02 Jun 2016 07:19:43 -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=E998VJ4JVkJ9xj4knSGCeKsaG2qiVULLMEb6R76Fsfrb4SRrObMh/5C/+c+UO41uWY ODcLwuvMDuVKg1FbjRopRghhMMgfYNu0b0Gi+O1AOlCXMJ4QNMVl+e6mZT0eACSVp/AR uC+HyT1nUm+pWzwEKmkyrENlPPV4IrlO+qqMg= 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=WDfSyFScbAFT3gids7m16xd3ZMwLCPxi4bmO2zPJofJ1Ia1A5o6gq1MdljQTUBBvG0 0ZjK0g/j7YqTBb9lD/Ug+vT2+qxadhBorGeDbjKW2zYJwzTC+7u7ZuBy2BHgWO4YTJJb VUjzi6AM0iIxbUPCniMxIbwX6cdSqgrKfHWqDUtKL69dW97EJOaiSLPAuDvDCrEsjE80 B3NhYFFXXN3Waxq7uyB1R+y5NUEdRCS9Y4jrNACBkWpe/BkZ5kYxiFVRJvSRYAF1R7Zg rnSKjhQnwypeXqHrXnGn9zKdBKO8QPevejMd2QvrLfIq+8MPnnpkp/67dmlxN6kCns94 V1rg== X-Gm-Message-State: ALyK8tJC+Q/nimsJj/+8RG0yDX4O8Gr9n1EnxwDviLfXx1nQPODU+owEyasXsRd9css+SAAh X-Received: by 10.66.138.69 with SMTP id qo5mr5982891pab.31.1464877182918; Thu, 02 Jun 2016 07:19:42 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id bf4sm70751405pac.4.2016.06.02.07.19.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 07:19:42 -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 07/11] cpufreq: ia64: Use 'index' only to index into policy->freq_table Date: Thu, 2 Jun 2016 19:49:07 +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);