From patchwork Thu Jun 2 14:19:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69177 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp144073qgf; Thu, 2 Jun 2016 07:19:48 -0700 (PDT) X-Received: by 10.66.77.165 with SMTP id t5mr5815992paw.61.1464877183172; Thu, 02 Jun 2016 07:19:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fl5si5132332pad.79.2016.06.02.07.19.42; Thu, 02 Jun 2016 07:19:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161170AbcFBOTi (ORCPT + 14 others); Thu, 2 Jun 2016 10:19:38 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:35011 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161131AbcFBOTh (ORCPT ); Thu, 2 Jun 2016 10:19:37 -0400 Received: by mail-pf0-f170.google.com with SMTP id g64so31984823pfb.2 for ; Thu, 02 Jun 2016 07:19:36 -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=9r+ZZ9iQDYtWgtV6BaFP7O0BCpYWrHfoUmlXN6aqmrs=; b=bHis/qUADRuj7q+pclKXcKRAe3CsZet+tWZpVdIpAYjxd1eO5WSlfN5bB6T0Ss341H MjRRIxKNncM2untybh55lTmiRdx7gUSGt0KU3GGq0KX+R8UhrC0uaT+lcKu1s4JQusNZ oyaOjr5yEWDd68oFSKCZfP7aSvlByfYJ1tgOg= 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=9r+ZZ9iQDYtWgtV6BaFP7O0BCpYWrHfoUmlXN6aqmrs=; b=TJdTrbpW8fC+6l26aZ4sWMMbZUNAnwMgCzvx/PEYzwOgjmvOiPi0na5klkuF6mPkM1 +/Oz29rFIXUpYmGvUW8NlCkM1LzHDs5YP6EJybA0JkbJjDkp8YnhFbAwG8bVb3IxZYra sXKX9x9ndg4ru9z6tzy4m9TeUOcX/yIg8TO5UXwhIpzSv+LtcGlIPSTpzJc79bJO8YM1 wOy5H1RysDTqMqE76euj/nmtlsrKIqik6Qs2JhBUOC1R8KokqSGaCw0TUrVrvYYtpIrt mUKzGcjHEghqxfjyw26qO5Iy0iGhEUz78YPzBmuWDAT8VKrGBmWS/k7986DOMtCXlPIy VTkg== X-Gm-Message-State: ALyK8tKa5PK8yYL2ZVZLNbbvsrRNUHpra90INiH2ps6DQ3cXHWi0OQvuCkC3pY3Zk10YAkqm X-Received: by 10.98.24.68 with SMTP id 65mr4913819pfy.160.1464877176454; Thu, 02 Jun 2016 07:19:36 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id m75sm1369021pfj.31.2016.06.02.07.19.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 07:19:35 -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 05/11] cpufreq: elanfreq: Use 'index' only to index into policy->freq_table Date: Thu, 2 Jun 2016 19:49:05 +0530 Message-Id: <9f63bf6fdb8b90b64e5423803f3b38b29a11646b.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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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. Signed-off-by: Viresh Kumar --- drivers/cpufreq/elanfreq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c index bfce11cba1df..bd4a51091986 100644 --- a/drivers/cpufreq/elanfreq.c +++ b/drivers/cpufreq/elanfreq.c @@ -108,9 +108,15 @@ static unsigned int elanfreq_get_cpu_frequency(unsigned int cpu) static int elanfreq_target(struct cpufreq_policy *policy, - unsigned int state) + unsigned int index) { /* + * policy->freq_table may be sorted differently, get the index value we + * are concerned about. + */ + unsigned int state = policy->freq_table[index].driver_data; + + /* * Access to the Elan's internal registers is indexed via * 0x22: Chip Setup & Control Register Index Register (CSCI) * 0x23: Chip Setup & Control Register Data Register (CSCD)