[i2c] [PATCH 12/13] pca9539: Honor the force parameter

Jean Delvare khali at linux-fr.org
Sat Jul 1 17:22:18 CEST 2006


From: Ben Gardner <gardner.ben at gmail.com>
Content-Disposition: inline; filename=i2c-pca9539-force.patch

The pca9539 driver doesn't honor the force parameter; it always does
detection. This patch will skip detection if forced.

Signed-off-by: Ben Gardner <gardner.ben at gmail.com>
Signed-off-by: Jean Delvare <khali at linux-fr.org>
---
 drivers/i2c/chips/pca9539.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--- linux-2.6.17-git.orig/drivers/i2c/chips/pca9539.c	2006-06-18 15:56:15.000000000 +0200
+++ linux-2.6.17-git/drivers/i2c/chips/pca9539.c	2006-06-29 22:47:10.000000000 +0200
@@ -134,11 +134,13 @@
 	new_client->driver = &pca9539_driver;
 	new_client->flags = 0;
 
-	/* Detection: the pca9539 only has 8 registers (0-7).
-	   A read of 7 should succeed, but a read of 8 should fail. */
-	if ((i2c_smbus_read_byte_data(new_client, 7) < 0) ||
-	    (i2c_smbus_read_byte_data(new_client, 8) >= 0))
-		goto exit_kfree;
+	if (kind < 0) {
+		/* Detection: the pca9539 only has 8 registers (0-7).
+		   A read of 7 should succeed, but a read of 8 should fail. */
+		if ((i2c_smbus_read_byte_data(new_client, 7) < 0) ||
+		    (i2c_smbus_read_byte_data(new_client, 8) >= 0))
+			goto exit_kfree;
+	}
 
 	strlcpy(new_client->name, "pca9539", I2C_NAME_SIZE);
 

-- 
Jean Delvare



More information about the i2c mailing list