Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 5472
b: refs/heads/master
c: 0d73adc
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare authored and Linus Torvalds committed Jul 29, 2005
1 parent 0f5e30b commit 81704d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 86749e8512d2c37618dc5814ef41abbf168f291b
refs/heads/master: 0d73adc14e239b05a9393c09c067a26a5ba86b6c
8 changes: 5 additions & 3 deletions trunk/drivers/i2c/chips/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions trunk/drivers/i2c/chips/max6875.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 81704d4

Please sign in to comment.