From: Jean Delvare <khali@linux-fr.org>
Date: Thu, 11 Aug 2005 21:36:49 +0000 (+0200)
Subject: [PATCH] I2C: Kill i2c_algorithm.id (2/7)
X-Git-Tag: v2.6.14-rc1~752^2~19
X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=e51cc6b3a365e170d3ebe51c2308fdd42e027a46;p=linux-2.6-omap-h63xx.git

[PATCH] I2C: Kill i2c_algorithm.id (2/7)

Use the adapter id rather than the algorithm id to detect the i2c-isa
pseudo-adapter. This saves one level of dereferencing, and the
algorithm ids will soon be gone anyway.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---

diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
index bbfd4449b92..dc666d7cf45 100644
--- a/drivers/i2c/busses/i2c-isa.c
+++ b/drivers/i2c/busses/i2c-isa.c
@@ -50,6 +50,7 @@ static struct i2c_algorithm isa_algorithm = {
 /* There can only be one... */
 static struct i2c_adapter isa_adapter = {
 	.owner		= THIS_MODULE,
+	.id		= I2C_ALGO_ISA | I2C_HW_ISA,
 	.class          = I2C_CLASS_HWMON,
 	.algo		= &isa_algorithm,
 	.name		= "ISA main adapter",
diff --git a/include/linux/i2c-isa.h b/include/linux/i2c-isa.h
index db793b68356..54c27e88d10 100644
--- a/include/linux/i2c-isa.h
+++ b/include/linux/i2c-isa.h
@@ -28,9 +28,9 @@ extern int i2c_isa_del_driver(struct i2c_driver *driver);
 
 /* Detect whether we are on the isa bus. This is only useful to hybrid
    (i2c+isa) drivers. */
-#define i2c_is_isa_client(clientptr) \
-        ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
 #define i2c_is_isa_adapter(adapptr) \
-        ((adapptr)->algo->id == I2C_ALGO_ISA)
+        ((adapptr)->id == (I2C_ALGO_ISA | I2C_HW_ISA))
+#define i2c_is_isa_client(clientptr) \
+        i2c_is_isa_adapter((clientptr)->adapter)
 
 #endif /* _LINUX_I2C_ISA_H */