hwmon: (lm90) Use generic i2c reads during
Subsystems (2)
PATCH 1/1 hwmon: (lm90) Use generic i2c reads during
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.
--- drivers/hwmon/lm90.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/hwmon/lm90.c +12 -12
@@ -531,24 +531,24 @@ static int lm90_detect(struct i2c_adapte kind = lm90;if (kind <0 ) {/* detection and identification */ -u8 man_id, chip_id, reg_config1, reg_convrate; +int man_id, chip_id, reg_config1, reg_convrate; -if (lm90_read_reg (new_client,LM90_REG_R_MAN_ID , - &man_id) <0 - ||lm90_read_reg (new_client,LM90_REG_R_CHIP_ID , - &chip_id) <0 - ||lm90_read_reg (new_client,LM90_REG_R_CONFIG1 , - ®_config1) <0 - ||lm90_read_reg (new_client,LM90_REG_R_CONVRATE , - ®_convrate) <0 ) +if ((man_id =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_MAN_ID ) <0 ) + || (chip_id =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_CHIP_ID ) <0 ) + || (reg_config1 =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_CONFIG1 ) <0 ) + || (reg_convrate =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_CONVRATE ) <0 )) goto exit_free;if ((address =0x4C || address =0x4D ) && man_id =0x01 ) {/* National Semiconductor */ -u8 reg_config2; +int reg_config2; -if (lm90_read_reg (new_client,LM90_REG_R_CONFIG2 , - ®_config2) <0 ) +if ((reg_config2 =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_CONFIG2 )) <0 ) goto exit_free; if ((reg_config1 & 0x2A) = 0x00
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Jean:
Quoted 10 lines · Jean Delvare
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 <[email protected]>--- drivers/hwmon/lm90.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Applied to hwmon-2.6.git/testing, thanks.
Signature · 8 lines
Mark M. Hoffman [email protected] _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Oops, my patch was actually broken (misplaced parentheses). Here's an update, sorry.
* * * * *
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.
--- drivers/hwmon/lm90.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/hwmon/lm90.c +12 -12
@@ -531,24 +531,24 @@ static int lm90_detect(struct i2c_adapte kind = lm90;if (kind <0 ) {/* detection and identification */ -u8 man_id, chip_id, reg_config1, reg_convrate; +int man_id, chip_id, reg_config1, reg_convrate; -if (lm90_read_reg (new_client,LM90_REG_R_MAN_ID , - &man_id) <0 - ||lm90_read_reg (new_client,LM90_REG_R_CHIP_ID , - &chip_id) <0 - ||lm90_read_reg (new_client,LM90_REG_R_CONFIG1 , - ®_config1) <0 - ||lm90_read_reg (new_client,LM90_REG_R_CONVRATE , - ®_convrate) <0 ) +if ((man_id =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_MAN_ID )) <0 + || (chip_id =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_CHIP_ID )) <0 + || (reg_config1 =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_CONFIG1 )) <0 + || (reg_convrate =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_CONVRATE )) <0 ) goto exit_free;if ((address =0x4C || address =0x4D ) && man_id =0x01 ) {/* National Semiconductor */ -u8 reg_config2; +int reg_config2; -if (lm90_read_reg (new_client,LM90_REG_R_CONFIG2 , - ®_config2) <0 ) +if ((reg_config2 =i2c_smbus_read_byte_data (new_client, +LM90_REG_R_CONFIG2 )) <0 ) goto exit_free; if ((reg_config1 & 0x2A) = 0x00
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Jean:
Quoted 11 lines · Jean Delvare
Oops, my patch was actually broken (misplaced parentheses). Here's an update, sorry.
* * * * *
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.
Quoted 4 lines
Signed-off-by Jean Delvare <[email protected]>--- drivers/hwmon/lm90.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Yep, I missed that too. I've inserted this patch into hwmon-2.6.git/testing in place of the previous one, thanks.
Signature · 8 lines
Mark M. Hoffman [email protected] _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors