From patchwork Thu Jun 2 14:19:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 69179 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp144349qgf; Thu, 2 Jun 2016 07:20:23 -0700 (PDT) X-Received: by 10.66.4.129 with SMTP id k1mr5669797pak.45.1464877223024; Thu, 02 Jun 2016 07:20:23 -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.22; Thu, 02 Jun 2016 07:20:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-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 S1161173AbcFBOTm (ORCPT + 4 others); Thu, 2 Jun 2016 10:19:42 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36696 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161171AbcFBOTk (ORCPT ); Thu, 2 Jun 2016 10:19:40 -0400 Received: by mail-pa0-f46.google.com with SMTP id te7so2839363pab.3 for ; Thu, 02 Jun 2016 07:19:40 -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=nFR4Z++9Jw0D0U3iTzl2mbCnxPASo/ETbI83Fkrz6yY=; b=A7lBbERD2TSWC/YeqtfS3j07oi2m6Y3XswHgflbT9Qa0/9wA6ZRts1SHCUKV1c7u6z 2R8bHM02vTrbVtqP0BMqsgvOeWvT5JX3o/SdlO6eJpJ33kNaQNkjw7GhOWaICyqxwT6T 4B9ckzAIbQdrjhKyn+AWGuiy9Ur3Am10dWndA= 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=nFR4Z++9Jw0D0U3iTzl2mbCnxPASo/ETbI83Fkrz6yY=; b=kR/mRwhzzmj8be3msyGA6y1jF873TOVVP/WD4UvK0FuysJ0g6Bqa43xXyw3O8OJIbo t/GBxiVmZz1BPhwbL2J2bM8NYcJs7hbwG2ZqslDUXOXzfG9eUaDmfooVOTbdqcbx5oLI XQ5gkMf6mZptgpf4oIWhO/38P3yw2hgbZdyMY6emEx70TzJ1tViA6oQboDNgqMGdpxSC uhY6BIwa7Nv7bf5ajYeCZ+YCS2io9pEPBb1Cw/7c3uWyRQCOxqotbNaeUN+s3Hjmd6Om 7ImJbu0ItQvKEKvptUxRp2NyRVAc/PxOC6QFp/Y27OhoYz0peptSc7dY1vSexe3gdezv IEDg== X-Gm-Message-State: ALyK8tJyMzRcZCSv8SGMhBwNFU45qnJ4CHHlYxNbJrhmIcmIUidMZXPdAj8C2JqWxqEOtZMe X-Received: by 10.66.141.76 with SMTP id rm12mr5876581pab.129.1464877179601; Thu, 02 Jun 2016 07:19:39 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id y2sm1357951pfi.39.2016.06.02.07.19.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 07:19:39 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Kukjin Kim , Krzysztof Kozlowski Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Dmitry Eremin-Solenikov , Kevin Hilman , Sekhar Nori , Shawn Guo , Steven Miao Subject: [PATCH 06/11] cpufreq: exynos: Use 'index' only to index into policy->freq_table Date: Thu, 2 Jun 2016 19:49:06 +0530 Message-Id: <110d79013778c722a0196af48023ff21aef45726.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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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: Kukjin Kim Cc: Krzysztof Kozlowski Signed-off-by: Viresh Kumar --- drivers/cpufreq/exynos5440-cpufreq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 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/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c index 085f07d31ef0..6138cbb7594e 100644 --- a/drivers/cpufreq/exynos5440-cpufreq.c +++ b/drivers/cpufreq/exynos5440-cpufreq.c @@ -210,7 +210,7 @@ static void exynos_enable_dvfs(unsigned int cur_frequency) static int exynos_target(struct cpufreq_policy *policy, unsigned int index) { - unsigned int tmp; + unsigned int tmp, rindex; int i; mutex_lock(&cpufreq_lock); @@ -218,13 +218,19 @@ static int exynos_target(struct cpufreq_policy *policy, unsigned int index) freqs.old = policy->cur; freqs.new = policy->freq_table[index].frequency; + /* + * policy->freq_table may be sorted differently, get the index value we + * are concerned about. + */ + rindex = policy->freq_table[index].driver_data; + cpufreq_freq_transition_begin(policy, &freqs); /* Set the target frequency in all C0_3_PSTATE register */ for_each_cpu(i, policy->cpus) { tmp = __raw_readl(dvfs_info->base + XMU_C0_3_PSTATE + i * 4); tmp &= ~(P_VALUE_MASK << C0_3_PSTATE_NEW_SHIFT); - tmp |= (index << C0_3_PSTATE_NEW_SHIFT); + tmp |= (rindex << C0_3_PSTATE_NEW_SHIFT); __raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + i * 4); }