aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/smsc47m192.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/smsc47m192.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/smsc47m192.c')
-rw-r--r--drivers/hwmon/smsc47m192.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c
index 8bb5cb532d4d..4d88c045781c 100644
--- a/drivers/hwmon/smsc47m192.c
+++ b/drivers/hwmon/smsc47m192.c
@@ -491,24 +491,22 @@ static int smsc47m192_detect(struct i2c_client *client, int kind,
491 return -ENODEV; 491 return -ENODEV;
492 492
493 /* Detection criteria from sensors_detect script */ 493 /* Detection criteria from sensors_detect script */
494 if (kind < 0) { 494 version = i2c_smbus_read_byte_data(client, SMSC47M192_REG_VERSION);
495 if (i2c_smbus_read_byte_data(client, 495 if (i2c_smbus_read_byte_data(client,
496 SMSC47M192_REG_COMPANY_ID) == 0x55 496 SMSC47M192_REG_COMPANY_ID) == 0x55
497 && ((version = i2c_smbus_read_byte_data(client, 497 && (version & 0xf0) == 0x20
498 SMSC47M192_REG_VERSION)) & 0xf0) == 0x20 498 && (i2c_smbus_read_byte_data(client,
499 && (i2c_smbus_read_byte_data(client,
500 SMSC47M192_REG_VID) & 0x70) == 0x00 499 SMSC47M192_REG_VID) & 0x70) == 0x00
501 && (i2c_smbus_read_byte_data(client, 500 && (i2c_smbus_read_byte_data(client,
502 SMSC47M192_REG_VID4) & 0xfe) == 0x80) { 501 SMSC47M192_REG_VID4) & 0xfe) == 0x80) {
503 dev_info(&adapter->dev, 502 dev_info(&adapter->dev,
504 "found SMSC47M192 or compatible, " 503 "found SMSC47M192 or compatible, "
505 "version 2, stepping A%d\n", version & 0x0f); 504 "version 2, stepping A%d\n", version & 0x0f);
506 } else { 505 } else {
507 dev_dbg(&adapter->dev, 506 dev_dbg(&adapter->dev,
508 "SMSC47M192 detection failed at 0x%02x\n", 507 "SMSC47M192 detection failed at 0x%02x\n",
509 client->addr); 508 client->addr);
510 return -ENODEV; 509 return -ENODEV;
511 }
512 } 510 }
513 511
514 strlcpy(info->type, "smsc47m192", I2C_NAME_SIZE); 512 strlcpy(info->type, "smsc47m192", I2C_NAME_SIZE);