aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm95241.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/lm95241.c')
-rw-r--r--drivers/hwmon/lm95241.c48
1 files changed, 10 insertions, 38 deletions
diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c
index e34f9e402a2c..906b896cf1d0 100644
--- a/drivers/hwmon/lm95241.c
+++ b/drivers/hwmon/lm95241.c
@@ -315,51 +315,23 @@ static int lm95241_detect(struct i2c_client *new_client, int kind,
315{ 315{
316 struct i2c_adapter *adapter = new_client->adapter; 316 struct i2c_adapter *adapter = new_client->adapter;
317 int address = new_client->addr; 317 int address = new_client->addr;
318 const char *name = ""; 318 const char *name;
319 319
320 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 320 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
321 return -ENODEV; 321 return -ENODEV;
322 322
323 /* 323 if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID)
324 * Now we do the remaining detection. A negative kind means that 324 == MANUFACTURER_ID)
325 * the driver was loaded with no force parameter (default), so we 325 && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID)
326 * must both detect and identify the chip. A zero kind means that 326 >= DEFAULT_REVISION)) {
327 * the driver was loaded with the force parameter, the detection 327 name = "lm95241";
328 * step shall be skipped. A positive kind means that the driver 328 } else {
329 * was loaded with the force parameter and a given kind of chip is 329 dev_dbg(&adapter->dev, "LM95241 detection failed at 0x%02x\n",
330 * requested, so both the detection and the identification steps 330 address);
331 * are skipped. 331 return -ENODEV;
332 */
333 if (kind < 0) { /* detection */
334 if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID)
335 != MANUFACTURER_ID)
336 || (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID)
337 < DEFAULT_REVISION)) {
338 dev_dbg(&adapter->dev,
339 "LM95241 detection failed at 0x%02x.\n",
340 address);
341 return -ENODEV;
342 }
343 }
344
345 if (kind <= 0) { /* identification */
346 if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID)
347 == MANUFACTURER_ID)
348 && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID)
349 >= DEFAULT_REVISION)) {
350
351 kind = lm95241;
352
353 if (kind <= 0) { /* identification failed */
354 dev_info(&adapter->dev, "Unsupported chip\n");
355 return -ENODEV;
356 }
357 }
358 } 332 }
359 333
360 /* Fill the i2c board info */ 334 /* Fill the i2c board info */
361 if (kind == lm95241)
362 name = "lm95241";
363 strlcpy(info->type, name, I2C_NAME_SIZE); 335 strlcpy(info->type, name, I2C_NAME_SIZE);
364 return 0; 336 return 0;
365} 337}