From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: To: , From: Jeremy Kerr Date: Fri, 13 Apr 2007 11:48:59 +1000 Subject: [PATCH 3/4] cell: fix initialisation on systems with no SPEs Message-Id: <1176428939.367182.371199141244.qpush@pokey> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 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-2.6-spufs/arch/powerpc/platforms/cell/spu_base.c =================================================================== --- linux-2.6-spufs.orig/arch/powerpc/platforms/cell/spu_base.c +++ linux-2.6-spufs/arch/powerpc/platforms/cell/spu_base.c @@ -43,6 +43,7 @@ static LIST_HEAD(spu_full_list); static DEFINE_MUTEX(spu_mutex); static spinlock_t spu_list_lock = SPIN_LOCK_UNLOCKED; +EXPORT_SYMBOL_GPL(spu_management_ops); EXPORT_SYMBOL_GPL(spu_priv1_ops); void spu_invalidate_slbs(struct spu *spu) @@ -723,6 +724,9 @@ static int __init init_spu_base(void) { int i, ret; + for (i = 0; i < MAX_NUMNODES; i++) + INIT_LIST_HEAD(&spu_list[i]); + if (!spu_management_ops) return 0; @@ -731,9 +735,6 @@ static int __init init_spu_base(void) if (ret) return ret; - for (i = 0; i < MAX_NUMNODES; i++) - INIT_LIST_HEAD(&spu_list[i]); - ret = spu_enumerate_spus(create_spu); if (ret) { Index: linux-2.6-spufs/arch/powerpc/platforms/cell/spufs/inode.c =================================================================== --- linux-2.6-spufs.orig/arch/powerpc/platforms/cell/spufs/inode.c +++ linux-2.6-spufs/arch/powerpc/platforms/cell/spufs/inode.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "spufs.h" @@ -653,6 +654,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,