diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-09 20:35:57 +0100 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-09 20:35:57 +0100 |
commit | 52df6440a29123eed912183fe785bbe174ef14b9 (patch) | |
tree | 3a3b9f4110d21c2ec4f5711444dd9cec6fb3d32c /drivers/hwmon/smsc47m192.c | |
parent | hwmon: (w83l785ts) Clean up detect function (diff) | |
download | linux-52df6440a29123eed912183fe785bbe174ef14b9.tar.xz linux-52df6440a29123eed912183fe785bbe174ef14b9.zip |
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.c | 28 |
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, return -ENODEV; /* Detection criteria from sensors_detect script */ - if (kind < 0) { - if (i2c_smbus_read_byte_data(client, + version = i2c_smbus_read_byte_data(client, SMSC47M192_REG_VERSION); + if (i2c_smbus_read_byte_data(client, SMSC47M192_REG_COMPANY_ID) == 0x55 - && ((version = i2c_smbus_read_byte_data(client, - SMSC47M192_REG_VERSION)) & 0xf0) == 0x20 - && (i2c_smbus_read_byte_data(client, + && (version & 0xf0) == 0x20 + && (i2c_smbus_read_byte_data(client, SMSC47M192_REG_VID) & 0x70) == 0x00 - && (i2c_smbus_read_byte_data(client, + && (i2c_smbus_read_byte_data(client, SMSC47M192_REG_VID4) & 0xfe) == 0x80) { - dev_info(&adapter->dev, - "found SMSC47M192 or compatible, " - "version 2, stepping A%d\n", version & 0x0f); - } else { - dev_dbg(&adapter->dev, - "SMSC47M192 detection failed at 0x%02x\n", - client->addr); - return -ENODEV; - } + dev_info(&adapter->dev, + "found SMSC47M192 or compatible, " + "version 2, stepping A%d\n", version & 0x0f); + } else { + dev_dbg(&adapter->dev, + "SMSC47M192 detection failed at 0x%02x\n", + client->addr); + return -ENODEV; } strlcpy(info->type, "smsc47m192", I2C_NAME_SIZE); |