diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-11-25 15:58:21 -0500 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-07 20:39:41 -0500 |
commit | e0ae87a49cf3e721313bf8942299f3f140c6963c (patch) | |
tree | 3c0bb9dbfed442835da5a8432fb179170432c9f9 /drivers/hwmon/lm90.c | |
parent | 72240307e988627df46553846936aa89a0f6a283 (diff) |
hwmon: (lm90) Use generic i2c reads during detection
As indirectly reported by Olof Johansson, the lm90 driver uses a
custom i2c read function even during detection, at which point we
don't know yet what device we're talking with. It would make more
sense to only use the generic i2c read function at this point, so
that we don't log irrelevant errors on misdetection.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/lm90.c')
-rw-r--r-- | drivers/hwmon/lm90.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 960df9fa75af..116093d0eb3e 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -531,24 +531,24 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) | |||
531 | kind = lm90; | 531 | kind = lm90; |
532 | 532 | ||
533 | if (kind < 0) { /* detection and identification */ | 533 | if (kind < 0) { /* detection and identification */ |
534 | u8 man_id, chip_id, reg_config1, reg_convrate; | 534 | int man_id, chip_id, reg_config1, reg_convrate; |
535 | 535 | ||
536 | if (lm90_read_reg(new_client, LM90_REG_R_MAN_ID, | 536 | if ((man_id = i2c_smbus_read_byte_data(new_client, |
537 | &man_id) < 0 | 537 | LM90_REG_R_MAN_ID)) < 0 |
538 | || lm90_read_reg(new_client, LM90_REG_R_CHIP_ID, | 538 | || (chip_id = i2c_smbus_read_byte_data(new_client, |
539 | &chip_id) < 0 | 539 | LM90_REG_R_CHIP_ID)) < 0 |
540 | || lm90_read_reg(new_client, LM90_REG_R_CONFIG1, | 540 | || (reg_config1 = i2c_smbus_read_byte_data(new_client, |
541 | ®_config1) < 0 | 541 | LM90_REG_R_CONFIG1)) < 0 |
542 | || lm90_read_reg(new_client, LM90_REG_R_CONVRATE, | 542 | || (reg_convrate = i2c_smbus_read_byte_data(new_client, |
543 | ®_convrate) < 0) | 543 | LM90_REG_R_CONVRATE)) < 0) |
544 | goto exit_free; | 544 | goto exit_free; |
545 | 545 | ||
546 | if ((address == 0x4C || address == 0x4D) | 546 | if ((address == 0x4C || address == 0x4D) |
547 | && man_id == 0x01) { /* National Semiconductor */ | 547 | && man_id == 0x01) { /* National Semiconductor */ |
548 | u8 reg_config2; | 548 | int reg_config2; |
549 | 549 | ||
550 | if (lm90_read_reg(new_client, LM90_REG_R_CONFIG2, | 550 | if ((reg_config2 = i2c_smbus_read_byte_data(new_client, |
551 | ®_config2) < 0) | 551 | LM90_REG_R_CONFIG2)) < 0) |
552 | goto exit_free; | 552 | goto exit_free; |
553 | 553 | ||
554 | if ((reg_config1 & 0x2A) == 0x00 | 554 | if ((reg_config1 & 0x2A) == 0x00 |