Skip to content

Commit

Permalink
[PATCH] pca9539: Honor the force parameter
Browse files Browse the repository at this point in the history
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@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ben Gardner authored and Greg Kroah-Hartman committed Jul 12, 2006
1 parent 5313775 commit 50436a4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/i2c/chips/pca9539.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 50436a4

Please sign in to comment.