[Cbe-oss-dev] [PATCH] cell: Safer of_has_vicinity routine
Arnd Bergmann
arnd at arndb.de
Tue Sep 11 20:42:29 EST 2007
From: Andre Detsch <adetsch at br.ibm.com>
This patch changes the way we check for the existence of
vicinity property in spe device nodes.
The new implementation does not depend on having an initialized
cbe_spu_info[0].spus, and checks for presence of vicinity in all
nodes, not only in the first one.
Signed-off-by: Andre Detsch <adetsch at br.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
---
Jeremy, please apply to spufs.git
Index: linux-2.6/arch/powerpc/platforms/cell/spu_manage.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spu_manage.c
+++ linux-2.6/arch/powerpc/platforms/cell/spu_manage.c
@@ -403,10 +403,15 @@ static void init_affinity_qs20_harcoded(
static int of_has_vicinity(void)
{
- struct spu* spu;
+ struct device_node *dn;
- spu = list_first_entry(&cbe_spu_info[0].spus, struct spu, cbe_list);
- return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
+ for_each_node_by_type(dn, "spe") {
+ if (of_find_property(dn, "vicinity", NULL)) {
+ of_node_put(dn);
+ return 1;
+ }
+ }
+ return 0;
}
static struct spu *devnode_spu(int cbe, struct device_node *dn)
More information about the cbe-oss-dev
mailing list