[POWERPC] spu_base: fix initialisation on systems with no SPEs
authorJeremy Kerr <jk@ozlabs.org>
Mon, 23 Apr 2007 19:08:29 +0000 (21:08 +0200)
committerArnd Bergmann <arnd@klappe.arndb.de>
Mon, 23 Apr 2007 19:19:00 +0000 (21:19 +0200)
This change fixes the case where spu_base and spufs are initialised on a
system with no SPEs - unconditionally create the spu_lists so spu_alloc
doesn't explode, and check for spu_management ops before starting spufs.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
 arch/powerpc/platforms/cell/spu_base.c    |    7 ++++---
 arch/powerpc/platforms/cell/spufs/inode.c |    5 +++++
 2 files changed, 9 insertions(+), 3 deletions(-)

arch/powerpc/platforms/cell/spu_base.c
arch/powerpc/platforms/cell/spufs/inode.c

index 2e8aa9433b3b8659b94ec4f0ca3b5fa1b456588d..8086eb1ed60d95e85ab47d5e17aca84854855e7d 100644 (file)
@@ -36,6 +36,8 @@
 #include <asm/xmon.h>
 
 const struct spu_management_ops *spu_management_ops;
+EXPORT_SYMBOL_GPL(spu_management_ops);
+
 const struct spu_priv1_ops *spu_priv1_ops;
 
 static struct list_head spu_list[MAX_NUMNODES];
@@ -589,6 +591,9 @@ static int __init init_spu_base(void)
 {
        int i, ret = 0;
 
+       for (i = 0; i < MAX_NUMNODES; i++)
+               INIT_LIST_HEAD(&spu_list[i]);
+
        if (!spu_management_ops)
                goto out;
 
@@ -597,9 +602,6 @@ static int __init init_spu_base(void)
        if (ret)
                goto out;
 
-       for (i = 0; i < MAX_NUMNODES; i++)
-               INIT_LIST_HEAD(&spu_list[i]);
-
        ret = spu_enumerate_spus(create_spu);
 
        if (ret) {
index 8f6cd876330607771d680f403e10f53051c053a7..13e4f70ec8c09d3c98de6204b4494ef0ed18fe4f 100644 (file)
@@ -36,6 +36,7 @@
 #include <asm/prom.h>
 #include <asm/semaphore.h>
 #include <asm/spu.h>
+#include <asm/spu_priv1.h>
 #include <asm/uaccess.h>
 
 #include "spufs.h"
@@ -665,6 +666,10 @@ static int __init spufs_init(void)
 {
        int ret;
 
+       ret = -ENODEV;
+       if (!spu_management_ops)
+               goto out;
+
        ret = -ENOMEM;
        spufs_inode_cache = kmem_cache_create("spufs_inode_cache",
                        sizeof(struct spufs_inode_info), 0,