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: 69250 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp268857qgf; Fri, 3 Jun 2016 06:35:57 -0700 (PDT) X-Received: by 10.66.132.37 with SMTP id or5mr5327625pab.144.1464960952768; Fri, 03 Jun 2016 06:35:52 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ce1si5842876pad.166.2016.06.03.06.35.52; Fri, 03 Jun 2016 06:35:52 -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 S1422656AbcFCNfp (ORCPT + 14 others); Fri, 3 Jun 2016 09:35:45 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34024 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422640AbcFCNfm (ORCPT ); Fri, 3 Jun 2016 09:35:42 -0400 Received: by mail-pa0-f44.google.com with SMTP id bz2so14804266pad.1 for ; Fri, 03 Jun 2016 06:35:42 -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=Yix11jzKxsU2eAo93I6kqt/IiBlOfVBX782GhKSn7yjd9I8eG687d6kpAqQEpzTTi2 4INd4uIum2Tr52jSO9kc73+WbVU62XJG9pVoiLo4aITzrGDT4TupmwXkemBGHDaCI8VS oZ7nMvQqEH73Q9ot5NE3RM+yogs41Ie2rJgdcAOhf5PNsvp6iFc3QYaz4USTVQYAqrX6 nuNqqqb5wspbsOZz1cDZ8JiLNarTWc0epRQ4HxNPxDsHjf46m/jLUfxwzEGF9n6LFBmJ YiyB8IFP7rUchx+B1LImXgsTpGKa7Ii/wQyEQBuw0/ldL/fg8gVdfDiY0Uyz+H4zgwNf Rp6w== X-Gm-Message-State: ALyK8tJzeUp0owbWJxXOAF82J4E6dsh6ZdJhksnI2he/7D+7JG2gM/iYlSD0Kh9CzFc17cYB 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-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. 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-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/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); }