Concerns re: sensor count in adt7470_read_temperatures()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I believe I have found an issue with adt7470_read_temperatures() and am looking for input from anyone familiar with the driver.

The sensor counting in said function treats a temperature reading of 0x00 as meaning there is no sensor.
It happens on this line:
https://github.com/groeck/linux/blob/master/drivers/hwmon/adt7470.c#L253

The device manual states that 0x00 is the default value for the temperature registers, so I would indeed expect that value if there is no corresponding sensor. But it also seems clear to me that 0x00 is in fact a valid temperature reading, and one that we must allow for. For reference, see " TEMPERATURE DATA FORMAT" on page 14 of the device manual here:
http://www.analog.com/media/en/technical-documentation/data-sheets/ADT7470.pdf

Hence, I think the safest approach is to _not_ attempt to count/detect the number of sensors, but simply initialize the count to the maximum (ADT7470_TEMP_COUNT) in adt7470_probe().
The number of sensors can be explicitly set after probe.

Am I missing something?
Would this be an acceptable change?

    -Martin

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux