aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwmon/lm93.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-12-09 20:35:57 +0100
committerJean Delvare <khali@linux-fr.org>2009-12-09 20:35:57 +0100
commit52df6440a29123eed912183fe785bbe174ef14b9 (patch)
tree3a3b9f4110d21c2ec4f5711444dd9cec6fb3d32c /drivers/hwmon/lm93.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/lm93.c')
-rw-r--r--drivers/hwmon/lm93.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c
index fc36cadf36f..495e7ce6f8a 100644
--- a/drivers/hwmon/lm93.c
+++ b/drivers/hwmon/lm93.c
@@ -2505,34 +2505,24 @@ static int lm93_detect(struct i2c_client *client, int kind,
struct i2c_board_info *info)
{
struct i2c_adapter *adapter = client->adapter;
+ int mfr, ver;
if (!i2c_check_functionality(adapter, LM93_SMBUS_FUNC_MIN))
return -ENODEV;
/* detection */
- if (kind < 0) {
- int mfr = lm93_read_byte(client, LM93_REG_MFR_ID);
-
- if (mfr != 0x01) {
- dev_dbg(&adapter->dev,"detect failed, "
- "bad manufacturer id 0x%02x!\n", mfr);
- return -ENODEV;
- }
+ mfr = lm93_read_byte(client, LM93_REG_MFR_ID);
+ if (mfr != 0x01) {
+ dev_dbg(&adapter->dev,
+ "detect failed, bad manufacturer id 0x%02x!\n", mfr);
+ return -ENODEV;
}
- if (kind <= 0) {
- int ver = lm93_read_byte(client, LM93_REG_VER);
-
- if ((ver == LM93_MFR_ID) || (ver == LM93_MFR_ID_PROTOTYPE)) {
- kind = lm93;
- } else {
- dev_dbg(&adapter->dev,"detect failed, "
- "bad version id 0x%02x!\n", ver);
- if (kind == 0)
- dev_dbg(&adapter->dev,
- "(ignored 'force' parameter)\n");
- return -ENODEV;
- }
+ ver = lm93_read_byte(client, LM93_REG_VER);
+ if (ver != LM93_MFR_ID && ver != LM93_MFR_ID_PROTOTYPE) {
+ dev_dbg(&adapter->dev,
+ "detect failed, bad version id 0x%02x!\n", ver);
+ return -ENODEV;
}
strlcpy(info->type, "lm93", I2C_NAME_SIZE);