From: Jean-Christophe DUBOIS Date: Fri, 20 Jul 2007 19:39:23 +0000 (+0200) Subject: [CELL] fix cbe_cpufreq for legacy SLOF tree. X-Git-Tag: v2.6.23-rc1~195^2~31 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=64bafa9db7e92d5a46402613188b71800924ca1f;p=linux-2.6-omap-h63xx.git [CELL] fix cbe_cpufreq for legacy SLOF tree. Previous patch changed based on Christian Krafft's comment. On some legacy SLOF tree the generic code is unable to ioremap some Cell BE registers. Therefore the "generic" functions are returning a NULL pointer, triggering a crash on such platforms. Let's handle this more gracefully. Signed-off-by: Jean-Christophe DUBOIS Acked-by: Christian Kraff Signed-off-by: Arnd Bergmann --- diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c index 9a9932624c0..0b6e8ee85ab 100644 --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c @@ -24,6 +24,7 @@ #include #include #include +#include "cbe_regs.h" #include "cbe_cpufreq.h" static DEFINE_MUTEX(cbe_switch_mutex); @@ -78,6 +79,15 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) pr_debug("init cpufreq on CPU %d\n", policy->cpu); + /* + * Let's check we can actually get to the CELL regs + */ + if (!cbe_get_cpu_pmd_regs(policy->cpu) || + !cbe_get_cpu_mic_tm_regs(policy->cpu)) { + pr_info("invalid CBE regs pointers for cpufreq\n"); + return -EINVAL; + } + max_freqp = of_get_property(cpu, "clock-frequency", NULL); of_node_put(cpu);