diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/chips/eeprom.c | 8 | ||||
-rw-r--r-- | drivers/i2c/chips/max6875.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 6ea413f6d5e5..a2da31b0dd7b 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c @@ -163,6 +163,11 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) struct eeprom_data *data; int err = 0; + /* prevent 24RF08 corruption */ + if (kind < 0) + i2c_smbus_xfer(adapter, address, 0, 0, 0, + I2C_SMBUS_QUICK, NULL); + /* There are three ways we can read the EEPROM data: (1) I2C block reads (faster, but unsupported by most adapters) (2) Consecutive byte reads (100% overhead) @@ -187,9 +192,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) new_client->driver = &eeprom_driver; new_client->flags = 0; - /* prevent 24RF08 corruption */ - i2c_smbus_write_quick(new_client, 0); - /* Fill in the remaining client fields */ strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); data->valid = 0; diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index c4f14d9623c4..0230375f72e5 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c @@ -343,6 +343,11 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) struct max6875_data *data; int err = 0; + /* Prevent 24RF08 corruption (in case of user error) */ + if (kind < 0) + i2c_smbus_xfer(adapter, address, 0, 0, 0, + I2C_SMBUS_QUICK, NULL); + /* There are three ways we can read the EEPROM data: (1) I2C block reads (faster, but unsupported by most adapters) (2) Consecutive byte reads (100% overhead) @@ -370,9 +375,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) new_client->driver = &max6875_driver; new_client->flags = 0; - /* Prevent 24RF08 corruption */ - i2c_smbus_write_quick(new_client, 0); - /* Setup the user section */ data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; |