Subject: [patch 1/5] spu_manage: use newer physical-id attribute

From: Arnd Bergmann <[email-masked]>
Date: Wed, 22 Aug 2007 19:01:25 +0200

From: Christian Krafft <[email-masked]>
Legacy device tree used the reg property for the physical id of an spe.
On newer device tree layouts the reg property contains the "correct" value
in the reg attribute. So there has been intoduced the "physical-id" on newer
devicetree layouts. The id is stored by spu_manage into the spu struct as spe_id.
cbe_thermal has been changed to use the spu->spe_id.
There's no need for the thermal code has to check devicetree attributes for itself.

Signed-off-by: Christian Krafft <[email-masked]>
Cc: Jeremy Kerr <[email-masked]>
Signed-off-by: Arnd Bergmann <[email-masked]>

---

Jeremy, please Ack

Index: linux-2.6/arch/powerpc/platforms/cell/cbe_thermal.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/cbe_thermal.c
+++ linux-2.6/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -88,17 +88,13 @@ static struct cbe_pmd_regs __iomem *get_
 /* returns the value for a given spu in a given register */
 static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg)
 {
-	const unsigned int *id;
 	union spe_reg value;
 	struct spu *spu;
 
-	/* getting the id from the reg attribute will not work on future device-tree layouts
-	 * in future we should store the id to the spu struct and use it here */
 	spu = container_of(sysdev, struct spu, sysdev);
-	id = of_get_property(spu_devnode(spu), "reg", NULL);
 	value.val = in_be64(&reg->val);
 
-	return value.spe[*id];
+	return value.spe[spu->spe_id];
 }
 
 static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf)
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
@@ -48,7 +48,7 @@ static u64 __init find_spu_unit_number(s
 {
 	const unsigned int *prop;
 	int proplen;
-	prop = of_get_property(spe, "unit-id", &proplen);
+	prop = of_get_property(spe, "physical-id", &proplen);
 	if (proplen == 4)
 		return (u64)*prop;

--