From patchwork Fri Jun 3 13:35:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 9153099 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 C0B736072B for ; Fri, 3 Jun 2016 13:37:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1BAA2780C for ; Fri, 3 Jun 2016 13:37:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A667026E39; Fri, 3 Jun 2016 13:37:17 +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 2C7B426E39 for ; Fri, 3 Jun 2016 13:37:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932604AbcFCNhO (ORCPT ); Fri, 3 Jun 2016 09:37:14 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:36764 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422660AbcFCNfs (ORCPT ); Fri, 3 Jun 2016 09:35:48 -0400 Received: by mail-pa0-f47.google.com with SMTP id te7so11415032pab.3 for ; Fri, 03 Jun 2016 06:35:47 -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=EQ1dSa7i2IEClv9iDwoZSuy7POhT/HjA5gTLsSQlzdZArDtNJ7EJHdKjCSgEphU26O 3ihN1tADhhuMfrbNm4A2Yu9gmQ9hoBcSObGKwVSzqHDr1pUCz+h/3FY2kDlbwG3mb3Fi ji3XXSMSljNcW3fTIerwV8NBrGvWOPcbnJMLo= 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=AxYfwgWUBK2hDsxzBYsGLXqc532FFzqMDbte4myYW/EH2UW1N/M+sESW9+Vv6rVkqf OtBzfVat4yP00vkfZOgAF94LSHHqtP1TReytTdDPPh9ETLRTzZ8e6DLZy0oK2RVOW3I1 zE79IjSqsyha/uDcYtckbUz5g4xv49gwemRPguNSgubc8jRMs7aXgFI9vTf2DxL+j1ci 9sQvoHOgK1lfzVdCJTpSLkeEL+3iDaLeOsox/V57ZwCnqkgkreGlOP15Ws7iFhzALnjw 38aTsJQ/QMEuT2eMSCvnpcgbveL4dHAY3DILBdOmEfBR05rL/Rbhtl7I5HAMQphvfGXz R7hw== X-Gm-Message-State: ALyK8tIlean45o7oGq26JnY6kdTVxQjcyFkFeUulGOvVrRTDOTTYTR+aP0nxLztfsebBt4iE X-Received: by 10.66.90.196 with SMTP id by4mr5302384pab.117.1464960942063; Fri, 03 Jun 2016 06:35:42 -0700 (PDT) Received: from localhost ([122.167.17.193]) by smtp.gmail.com with ESMTPSA id 141sm8640131pfx.68.2016.06.03.06.35.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jun 2016 06:35:41 -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, steve.muckle@linaro.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Dmitry Eremin-Solenikov , Shawn Guo , Steven Miao Subject: [PATCH V3 4/9] cpufreq: exynos: Use 'index' only to index into policy->freq_table Date: Fri, 3 Jun 2016 19:05:10 +0530 Message-Id: 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 Acked-by: Krzysztof Kozlowski --- 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); }