aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/dme1737.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/dme1737.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/dme1737.c')
-rw-r--r--drivers/hwmon/dme1737.c32
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,
2220 return -ENODEV; 2220 return -ENODEV;
2221 } 2221 }
2222 2222
2223 /* A negative kind means that the driver was loaded with no force 2223 company = i2c_smbus_read_byte_data(client, DME1737_REG_COMPANY);
2224 * parameter (default), so we must identify the chip. */ 2224 verstep = i2c_smbus_read_byte_data(client, DME1737_REG_VERSTEP);
2225 if (kind < 0) {
2226 company = i2c_smbus_read_byte_data(client, DME1737_REG_COMPANY);
2227 verstep = i2c_smbus_read_byte_data(client, DME1737_REG_VERSTEP);
2228
2229 if (company == DME1737_COMPANY_SMSC &&
2230 (verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP) {
2231 kind = dme1737;
2232 } else if (company == DME1737_COMPANY_SMSC &&
2233 verstep == SCH5027_VERSTEP) {
2234 kind = sch5027;
2235 } else {
2236 return -ENODEV;
2237 }
2238 }
2239 2225
2240 if (kind == sch5027) { 2226 if (company == DME1737_COMPANY_SMSC &&
2227 verstep == SCH5027_VERSTEP) {
2241 name = "sch5027"; 2228 name = "sch5027";
2242 } else { 2229
2243 kind = dme1737; 2230 } else if (company == DME1737_COMPANY_SMSC &&
2231 (verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP) {
2244 name = "dme1737"; 2232 name = "dme1737";
2233 } else {
2234 return -ENODEV;
2245 } 2235 }
2246 2236
2247 dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n", 2237 dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n",
2248 kind == sch5027 ? "SCH5027" : "DME1737", client->addr, 2238 verstep == SCH5027_VERSTEP ? "SCH5027" : "DME1737",
2249 verstep); 2239 client->addr, verstep);
2250 strlcpy(info->type, name, I2C_NAME_SIZE); 2240 strlcpy(info->type, name, I2C_NAME_SIZE);
2251 2241
2252 return 0; 2242 return 0;