From d58370d0a2f76b81a5803207616fbb7a7748db3c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 16 May 2004 16:29:19 +0000 Subject: [PATCH] Unconditional prevention of 24RF08 corruption. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2541 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/chips/ddcmon.c | 5 +++-- kernel/chips/eeprom.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/chips/ddcmon.c b/kernel/chips/ddcmon.c index 2daa96f6..93a66b35 100644 --- a/kernel/chips/ddcmon.c +++ b/kernel/chips/ddcmon.c @@ -229,11 +229,12 @@ int ddcmon_detect(struct i2c_adapter *adapter, int address, new_client->driver = &ddcmon_driver; new_client->flags = 0; + /* prevent 24RF08 corruption (just in case) */ + i2c_smbus_write_quick(new_client, 0); + /* Now, we do the remaining detection. */ if (checksum) { int cs = 0; - /* prevent 24RF08 corruption (just in case) */ - i2c_smbus_write_quick(new_client, 0); for (i = 0; i < 0x80; i++) cs += i2c_smbus_read_byte_data(new_client, i); if ((cs & 0xff) != 0) diff --git a/kernel/chips/eeprom.c b/kernel/chips/eeprom.c index a12653fb..030240cd 100644 --- a/kernel/chips/eeprom.c +++ b/kernel/chips/eeprom.c @@ -208,12 +208,13 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, new_client->driver = &eeprom_driver; 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 the checksum to work out. */ if (checksum) { int cs = 0; - /* prevent 24RF08 corruption */ - i2c_smbus_write_quick(new_client, 0); for (i = 0; i <= 0x3e; i++) cs += i2c_smbus_read_byte_data(new_client, i); cs &= 0xff;