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: 9150077 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 1686C60751 for ; Thu, 2 Jun 2016 14:19:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0714828047 for ; Thu, 2 Jun 2016 14:19:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF71128294; Thu, 2 Jun 2016 14:19:45 +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=ham 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 1D30F28303 for ; Thu, 2 Jun 2016 14:19:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161173AbcFBOTm (ORCPT ); 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 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); }