[Cbe-oss-dev] [PATCH] fix cbe_thermal for "old" SLOF tree.
Jean-Christophe Dubois
jcd at tribudubois.net
Fri Jun 22 01:06:19 EST 2007
On some "old" 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 <jcd at tribudubois.net>
Index: linux-2.6.22-rc4/arch/powerpc/platforms/cell/cbe_thermal.c
===================================================================
--- linux-2.6.22-rc4.orig/arch/powerpc/platforms/cell/cbe_thermal.c
+++ linux-2.6.22-rc4/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -108,6 +108,9 @@ static ssize_t spu_show_temp(struct sys_
pmd_regs = get_pmd_regs(sysdev);
+ if (!pmd_regs)
+ return 0;
+
value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1);
return sprintf(buf, "%d\n", reg_to_temp(value));
@@ -117,6 +120,9 @@ static ssize_t show_throttle(struct cbe_
{
u64 value;
+ if (!pmd_regs)
+ return 0;
+
value = in_be64(&pmd_regs->tm_tpr.val);
/* access the corresponding byte */
value >>= pos;
@@ -186,6 +192,10 @@ static ssize_t ppe_show_temp(struct sys_
u64 value;
pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id);
+
+ if (!pmd_regs)
+ return 0;
+
value = in_be64(&pmd_regs->ts_ctsr2);
value = (value >> pos) & 0x3f;
@@ -339,8 +349,15 @@ static void __init init_default_values(v
for_each_possible_cpu (cpu) {
pr_debug("processing cpu %d\n", cpu);
sysdev = get_cpu_sysdev(cpu);
+
+ if (!sysdev)
+ continue;
+
pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id);
+ if (!pmd_regs)
+ continue;
+
out_be64(&pmd_regs->tm_str2, str2);
out_be64(&pmd_regs->tm_str1.val, str1.val);
out_be64(&pmd_regs->tm_tpr.val, tpr.val);
More information about the cbe-oss-dev
mailing list