Subject: cell: fix initialisation on systems with no SPEs From: Jeremy Kerr 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 Signed-off-by: Arnd Bergmann arch/powerpc/platforms/cell/spu_base.c | 7 ++++--- arch/powerpc/platforms/cell/spufs/inode.c | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) Index: linux-cg/arch/powerpc/platforms/cell/spu_base.c =================================================================== --- linux-cg.orig/arch/powerpc/platforms/cell/spu_base.c +++ linux-cg/arch/powerpc/platforms/cell/spu_base.c @@ -38,6 +38,8 @@ #include "spu_priv1_mmio.h" const struct spu_management_ops *spu_management_ops; +EXPORT_SYMBOL_GPL(spu_management_ops); + const struct spu_priv1_ops *spu_priv1_ops; EXPORT_SYMBOL_GPL(spu_priv1_ops); @@ -766,6 +768,11 @@ static int __init init_spu_base(void) { int i, ret = 0; + for (i = 0; i < MAX_NUMNODES; i++) { + INIT_LIST_HEAD(&be_spu_info[i].spus); + INIT_LIST_HEAD(&be_spu_info[i].free_spus); + } + if (!spu_management_ops) goto out; @@ -774,11 +781,6 @@ static int __init init_spu_base(void) if (ret) goto out; - for (i = 0; i < MAX_NUMNODES; i++) { - INIT_LIST_HEAD(&be_spu_info[i].spus); - INIT_LIST_HEAD(&be_spu_info[i].free_spus); - } - ret = spu_enumerate_spus(create_spu); if (ret) { printk(KERN_WARNING "%s: Error initializing spus\n", Index: linux-cg/arch/powerpc/platforms/cell/spufs/inode.c =================================================================== --- linux-cg.orig/arch/powerpc/platforms/cell/spufs/inode.c +++ linux-cg/arch/powerpc/platforms/cell/spufs/inode.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "spufs.h" @@ -785,6 +786,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,