
From: Colin Leroy <colin@colino.net>

This patch lets therm_adt746x handle the latest powerbooks.  In these ones,
Apple doesn't put the i2c bus number in the "reg" property of the fan node.
 Instead, we can get the bus number from the fan node path, which looks
like "/proc/device-tree/.../i2c-bus@1/.../fan".  Here's a patch that
handles both old and new form.

Signed-off-by: Colin Leroy <colin@colino.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/macintosh/therm_adt746x.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)

diff -puN drivers/macintosh/therm_adt746x.c~make-therm_adt746x-handle-latest-powerbooks drivers/macintosh/therm_adt746x.c
--- 25/drivers/macintosh/therm_adt746x.c~make-therm_adt746x-handle-latest-powerbooks	2005-03-07 20:41:25.000000000 -0800
+++ 25-akpm/drivers/macintosh/therm_adt746x.c	2005-03-07 20:41:25.000000000 -0800
@@ -548,7 +548,15 @@ thermostat_init(void)
 	prop = (u32 *)get_property(np, "reg", NULL);
 	if (!prop)
 		return -ENODEV;
-	therm_bus = ((*prop) >> 8) & 0x0f;
+
+	/* look for bus either by path or using "reg" */
+	if (strstr(np->full_name, "/i2c-bus@") != NULL) {
+		const char *tmp_bus = (strstr(np->full_name, "/i2c-bus@") + 9);
+		therm_bus = tmp_bus[0]-'0';
+	} else {
+		therm_bus = ((*prop) >> 8) & 0x0f;
+	}
+
 	therm_address = ((*prop) & 0xff) >> 1;
 
 	printk(KERN_INFO "adt746x: Thermostat bus: %d, address: 0x%02x, "
_
