From 50436a47c6b10c6e4e84e24ea44c5cb85bbcd290 Mon Sep 17 00:00:00 2001 From: Ben Gardner Date: Sat, 1 Jul 2006 17:22:18 +0200 Subject: [PATCH] [PATCH] pca9539: Honor the force parameter 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 Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/chips/pca9539.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c index 54b6e6a4beed..cb22280cdd27 100644 --- a/drivers/i2c/chips/pca9539.c +++ b/drivers/i2c/chips/pca9539.c @@ -134,11 +134,13 @@ static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind) 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); -- GitLab