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: 9150119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C6FFA60751 for ; Thu, 2 Jun 2016 14:22:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7C4D25E13 for ; Thu, 2 Jun 2016 14:22:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC131282ED; Thu, 2 Jun 2016 14:22:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38D8E25E13 for ; Thu, 2 Jun 2016 14:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161171AbcFBOTm (ORCPT ); Thu, 2 Jun 2016 10:19:42 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35304 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161172AbcFBOTk (ORCPT ); Thu, 2 Jun 2016 10:19:40 -0400 Received: by mail-pa0-f53.google.com with SMTP id xk1so6206418pac.2 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=Eu2dIW+VLLkk4hPLTkZtozRZjbtksENcEmNUGgAl0lxwlCzfuxJLyFgzHtMWEB1Ine rJrG8d0yWrQyPH/Yn7gkszHV/H8XJSvBbFE8iJMH3APdCp87KNh3wEe5K26KYqGWQV+X LLzkt8HLmZ9k8FRJBcp+V6ebe78m0zK2nW6DdqIwN4I+qkYg+XYiLF+hKNqRwa+QWPOT rD3/diZBXp6ByEDFE/4mPxHlqTmcSOh119gODUclTjMa+LhL1WxqB8v3U/PUCZW67D7V ZbKOqrQtzDsmFzbkTR1WWQWDtrPGqi2YcKPExIb4wyiDkO9cpSnmMQuwlecfLaoyonp3 qX4w== X-Gm-Message-State: ALyK8tKsa5xlrRu8BDahVPWcawgz2+1m0cXYgmojW9HiL+OFApq2UeZ9Ro6zxuODYzzk0UJW 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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); }