From patchwork Wed May 18 07:37:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 792962 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4I7bqvK028870 for ; Wed, 18 May 2011 07:37:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754923Ab1ERHh4 (ORCPT ); Wed, 18 May 2011 03:37:56 -0400 Received: from na3sys009aog117.obsmtp.com ([74.125.149.242]:39859 "EHLO na3sys009aog117.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754427Ab1ERHh4 (ORCPT ); Wed, 18 May 2011 03:37:56 -0400 Received: from mail-yw0-f41.google.com ([209.85.213.41]) (using TLSv1) by na3sys009aob117.postini.com ([74.125.148.12]) with SMTP ID DSNKTdN3U8gOOn64ebCOnaYDh58aUxmKvuTf@postini.com; Wed, 18 May 2011 00:37:55 PDT Received: by ywa1 with SMTP id 1so585566ywa.14 for ; Wed, 18 May 2011 00:37:54 -0700 (PDT) Received: by 10.150.197.17 with SMTP id u17mr1235601ybf.333.1305704274753; Wed, 18 May 2011 00:37:54 -0700 (PDT) Received: from localhost (dragon.ti.com [192.94.94.33]) by mx.google.com with ESMTPS id r10sm645420ybl.24.2011.05.18.00.37.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 May 2011 00:37:53 -0700 (PDT) From: Nishanth Menon To: kevin Cc: linux-omap , Nishanth Menon Subject: [PM-WIP_CPUFREQ][PATCH 2/6 v2] OMAP2+: cpufreq: handle invalid cpufreq table Date: Wed, 18 May 2011 02:37:42 -0500 Message-Id: <1305704266-17623-3-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <[PM-WIP_CPUFREQ][PATCH 0/5] Cleanups for cpufreq> References: <[PM-WIP_CPUFREQ][PATCH 0/5] Cleanups for cpufreq> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 18 May 2011 07:37:57 +0000 (UTC) Handle the case when cpufreq_frequency_table_cpuinfo fails. freq_table that we passed failed the internal test of cpufreq generic driver, so we should'nt be using the freq_table as such. Instead, warn and fallback to clock functions for validation and operation. Signed-off-by: Nishanth Menon --- arch/arm/mach-omap2/omap2plus-cpufreq.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c index e38ebb8..6e3666a 100644 --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c @@ -182,10 +182,18 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) if (freq_table) { result = cpufreq_frequency_table_cpuinfo(policy, freq_table); - if (!result) + if (!result) { cpufreq_frequency_table_get_attr(freq_table, policy->cpu); - } else { + } else { + WARN(true, "%s: fallback to clk_round(freq_table=%d)\n", + __func__, result); + kfree(freq_table); + freq_table = NULL; + } + } + + if (!freq_table) { policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000; policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, VERY_HI_RATE) / 1000;