aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/eeprom.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-07-29 15:15:33 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-29 16:12:51 -0400
commit0d73adc14e239b05a9393c09c067a26a5ba86b6c (patch)
tree2d37b52c21c02c4f7be2e2551abad3d4cbc69e73 /drivers/i2c/chips/eeprom.c
parent86749e8512d2c37618dc5814ef41abbf168f291b (diff)
[PATCH] I2C: 24RF08 corruption prevention (again)
The 24RF08 corruption prevention in the eeprom and max6875 drivers wasn't complete. For one thing, the additional quick write should happen as soon as possible and unconditionally, while both drivers had error paths before. For another, when a given chip is forced, the core does not emit a quick write, so a second quick write would cause the corruption rather than prevent it. I plan to move the corruption prevention in the core in the long run, so that individual drivers don't have to care anymore. But I need to merge i2c_probe and i2c_detect before I do (work in progress). Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/i2c/chips/eeprom.c')
-rw-r--r--drivers/i2c/chips/eeprom.c8
1 files changed, 5 insertions, 3 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)
163 struct eeprom_data *data; 163 struct eeprom_data *data;
164 int err = 0; 164 int err = 0;
165 165
166 /* prevent 24RF08 corruption */
167 if (kind < 0)
168 i2c_smbus_xfer(adapter, address, 0, 0, 0,
169 I2C_SMBUS_QUICK, NULL);
170
166 /* There are three ways we can read the EEPROM data: 171 /* There are three ways we can read the EEPROM data:
167 (1) I2C block reads (faster, but unsupported by most adapters) 172 (1) I2C block reads (faster, but unsupported by most adapters)
168 (2) Consecutive byte reads (100% overhead) 173 (2) Consecutive byte reads (100% overhead)
@@ -187,9 +192,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
187 new_client->driver = &eeprom_driver; 192 new_client->driver = &eeprom_driver;
188 new_client->flags = 0; 193 new_client->flags = 0;
189 194
190 /* prevent 24RF08 corruption */
191 i2c_smbus_write_quick(new_client, 0);
192
193 /* Fill in the remaining client fields */ 195 /* Fill in the remaining client fields */
194 strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); 196 strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE);
195 data->valid = 0; 197 data->valid = 0;