aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adt7470.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/adt7470.c')
-rw-r--r--drivers/hwmon/adt7470.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index 633e1a1e9d79..32b1750a6890 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -1229,27 +1229,22 @@ static int adt7470_detect(struct i2c_client *client, int kind,
1229 struct i2c_board_info *info) 1229 struct i2c_board_info *info)
1230{ 1230{
1231 struct i2c_adapter *adapter = client->adapter; 1231 struct i2c_adapter *adapter = client->adapter;
1232 int vendor, device, revision;
1232 1233
1233 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 1234 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1234 return -ENODEV; 1235 return -ENODEV;
1235 1236
1236 if (kind <= 0) { 1237 vendor = i2c_smbus_read_byte_data(client, ADT7470_REG_VENDOR);
1237 int vendor, device, revision; 1238 if (vendor != ADT7470_VENDOR)
1238 1239 return -ENODEV;
1239 vendor = i2c_smbus_read_byte_data(client, ADT7470_REG_VENDOR);
1240 if (vendor != ADT7470_VENDOR)
1241 return -ENODEV;
1242 1240
1243 device = i2c_smbus_read_byte_data(client, ADT7470_REG_DEVICE); 1241 device = i2c_smbus_read_byte_data(client, ADT7470_REG_DEVICE);
1244 if (device != ADT7470_DEVICE) 1242 if (device != ADT7470_DEVICE)
1245 return -ENODEV; 1243 return -ENODEV;
1246 1244
1247 revision = i2c_smbus_read_byte_data(client, 1245 revision = i2c_smbus_read_byte_data(client, ADT7470_REG_REVISION);
1248 ADT7470_REG_REVISION); 1246 if (revision != ADT7470_REVISION)
1249 if (revision != ADT7470_REVISION) 1247 return -ENODEV;
1250 return -ENODEV;
1251 } else
1252 dev_dbg(&adapter->dev, "detection forced\n");
1253 1248
1254 strlcpy(info->type, "adt7470", I2C_NAME_SIZE); 1249 strlcpy(info->type, "adt7470", I2C_NAME_SIZE);
1255 1250