Re: Concerns re: sensor count in adt7470_read_temperatures()

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

 



On 11/23/2016 12:44 AM, Martin Etnestad wrote:
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().

If there is no means to enable / disable sensors, you are correct. However,
the number is calculated only to limit the wait time when reading the sensors
(see commit 2f22d5dff6f95). All we would accomplish by changing that would be
to re-introduce a default wait time of 2 seconds for the chip to read the
temperature sensors, just to address the very unlikely case that a temperature
sensor reads 0 (which, in practice, _is_ really unlikely). So better leave it
alone.

Guenter

--
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