diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-09 22:35:57 +0300 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-09 22:35:57 +0300 |
commit | 52df6440a29123eed912183fe785bbe174ef14b9 (patch) | |
tree | 3a3b9f4110d21c2ec4f5711444dd9cec6fb3d32c /drivers/hwmon/dme1737.c | |
parent | a1fa4cdcc4abd4c02a81ab7052c16a342d29f060 (diff) | |
download | linux-52df6440a29123eed912183fe785bbe174ef14b9.tar.xz |
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/dme1737.c')
-rw-r--r-- | drivers/hwmon/dme1737.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 27d62574284f..4377bb0cc526 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c @@ -2220,33 +2220,23 @@ static int dme1737_i2c_detect(struct i2c_client *client, int kind, return -ENODEV; } - /* A negative kind means that the driver was loaded with no force - * parameter (default), so we must identify the chip. */ - if (kind < 0) { - company = i2c_smbus_read_byte_data(client, DME1737_REG_COMPANY); - verstep = i2c_smbus_read_byte_data(client, DME1737_REG_VERSTEP); - - if (company == DME1737_COMPANY_SMSC && - (verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP) { - kind = dme1737; - } else if (company == DME1737_COMPANY_SMSC && - verstep == SCH5027_VERSTEP) { - kind = sch5027; - } else { - return -ENODEV; - } - } + company = i2c_smbus_read_byte_data(client, DME1737_REG_COMPANY); + verstep = i2c_smbus_read_byte_data(client, DME1737_REG_VERSTEP); - if (kind == sch5027) { + if (company == DME1737_COMPANY_SMSC && + verstep == SCH5027_VERSTEP) { name = "sch5027"; - } else { - kind = dme1737; + + } else if (company == DME1737_COMPANY_SMSC && + (verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP) { name = "dme1737"; + } else { + return -ENODEV; } dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n", - kind == sch5027 ? "SCH5027" : "DME1737", client->addr, - verstep); + verstep == SCH5027_VERSTEP ? "SCH5027" : "DME1737", + client->addr, verstep); strlcpy(info->type, name, I2C_NAME_SIZE); return 0; |