aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adt7470.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-12-09 14:35:57 -0500
committerJean Delvare <khali@linux-fr.org>2009-12-09 14:35:57 -0500
commit52df6440a29123eed912183fe785bbe174ef14b9 (patch)
tree3a3b9f4110d21c2ec4f5711444dd9cec6fb3d32c /drivers/hwmon/adt7470.c
parenta1fa4cdcc4abd4c02a81ab7052c16a342d29f060 (diff)
hwmon: Clean up detect functions
As kind is now hard-coded to -1, there is room for code clean-ups. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Corentin Labbe <corentin.labbe@geomatys.fr> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Riku Voipio <riku.voipio@iki.fi> Acked-by: "Hans J. Koch" <hjk@linutronix.de> Cc: Rudolf Marek <r.marek@assembler.cz>
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