2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 13:57:41 +00:00

Unconditional prevention of 24RF08 corruption.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2541 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2004-05-16 16:29:19 +00:00
parent 354572a5e6
commit d58370d0a2
2 changed files with 6 additions and 4 deletions

View File

@@ -229,11 +229,12 @@ int ddcmon_detect(struct i2c_adapter *adapter, int address,
new_client->driver = &ddcmon_driver; new_client->driver = &ddcmon_driver;
new_client->flags = 0; new_client->flags = 0;
/* prevent 24RF08 corruption (just in case) */
i2c_smbus_write_quick(new_client, 0);
/* Now, we do the remaining detection. */ /* Now, we do the remaining detection. */
if (checksum) { if (checksum) {
int cs = 0; int cs = 0;
/* prevent 24RF08 corruption (just in case) */
i2c_smbus_write_quick(new_client, 0);
for (i = 0; i < 0x80; i++) for (i = 0; i < 0x80; i++)
cs += i2c_smbus_read_byte_data(new_client, i); cs += i2c_smbus_read_byte_data(new_client, i);
if ((cs & 0xff) != 0) if ((cs & 0xff) != 0)

View File

@@ -208,12 +208,13 @@ int eeprom_detect(struct i2c_adapter *adapter, int address,
new_client->driver = &eeprom_driver; new_client->driver = &eeprom_driver;
new_client->flags = 0; new_client->flags = 0;
/* prevent 24RF08 corruption */
i2c_smbus_write_quick(new_client, 0);
/* Now, we do the remaining detection. It is not there, unless you force /* Now, we do the remaining detection. It is not there, unless you force
the checksum to work out. */ the checksum to work out. */
if (checksum) { if (checksum) {
int cs = 0; int cs = 0;
/* prevent 24RF08 corruption */
i2c_smbus_write_quick(new_client, 0);
for (i = 0; i <= 0x3e; i++) for (i = 0; i <= 0x3e; i++)
cs += i2c_smbus_read_byte_data(new_client, i); cs += i2c_smbus_read_byte_data(new_client, i);
cs &= 0xff; cs &= 0xff;