diff options
Diffstat (limited to 'drivers/hwmon/ds1621.c')
-rw-r--r-- | drivers/hwmon/ds1621.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 53f88f51181..2a4c6a05b14 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
@@ -237,20 +237,16 @@ static int ds1621_detect(struct i2c_client *client, int kind, | |||
237 | return -ENODEV; | 237 | return -ENODEV; |
238 | 238 | ||
239 | /* Now, we do the remaining detection. It is lousy. */ | 239 | /* Now, we do the remaining detection. It is lousy. */ |
240 | if (kind < 0) { | 240 | /* The NVB bit should be low if no EEPROM write has been requested |
241 | /* The NVB bit should be low if no EEPROM write has been | 241 | during the latest 10ms, which is highly improbable in our case. */ |
242 | requested during the latest 10ms, which is highly | 242 | conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF); |
243 | improbable in our case. */ | 243 | if (conf < 0 || conf & DS1621_REG_CONFIG_NVB) |
244 | conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF); | 244 | return -ENODEV; |
245 | if (conf < 0 || conf & DS1621_REG_CONFIG_NVB) | 245 | /* The 7 lowest bits of a temperature should always be 0. */ |
246 | for (i = 0; i < ARRAY_SIZE(DS1621_REG_TEMP); i++) { | ||
247 | temp = i2c_smbus_read_word_data(client, DS1621_REG_TEMP[i]); | ||
248 | if (temp < 0 || (temp & 0x7f00)) | ||
246 | return -ENODEV; | 249 | return -ENODEV; |
247 | /* The 7 lowest bits of a temperature should always be 0. */ | ||
248 | for (i = 0; i < ARRAY_SIZE(DS1621_REG_TEMP); i++) { | ||
249 | temp = i2c_smbus_read_word_data(client, | ||
250 | DS1621_REG_TEMP[i]); | ||
251 | if (temp < 0 || (temp & 0x7f00)) | ||
252 | return -ENODEV; | ||
253 | } | ||
254 | } | 250 | } |
255 | 251 | ||
256 | strlcpy(info->type, "ds1621", I2C_NAME_SIZE); | 252 | strlcpy(info->type, "ds1621", I2C_NAME_SIZE); |