Skip to contentSkip to conversation

hwmon: (i5500_temp) Don't bind to disabled sensors

PATCH In review Jean Delvare 2 participants 3 messages Oct 23, 2014 – Oct 24, 2014 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hwmon: (i5500_temp) Don't bind to disabled sensors

On many motherboards, for an unknown reason, the thermal sensor seems to be disabled and will return a constant temperature value of 36.5 degrees Celsius. Don't bind to the device in that case, so that we don't report this bogus value to userspace.

---
Changes since v1:
* Also check the value of register TSTIMER, to improve the reliability of the heuristic.

 drivers/hwmon/i5500_temp.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/hwmon/i5500_temp.c +9 -0
@@ -121,6 +121,8 @@ static int i5500_temp_probe(struct pci_d
 {
 	int err;
 	struct device *hwmon_dev;
+	u32 tstimer;
+	s8 tsfsc;
 
 	err = pci_enable_device(pdev);
 	if (err) {
@@ -128,6 +130,13 @@ static int i5500_temp_probe(struct pci_d
 		return err;
 	}
 
+	pci_read_config_byte(pdev, REG_TSFSC, &tsfsc);
+	pci_read_config_dword(pdev, REG_TSTIMER, &tstimer);
+	if (tsfsc = 0x7F && tstimer = 0x07D30D40) {
+		dev_warn(&pdev->dev, "Sensor seems to be disabled\n");
+		return -ENODEV;
+	}
+
 	hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev,
 							   "intel5500", NULL,
 							   i5500_temp_groups);
Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 4 lines · Jean Delvare

On many motherboards, for an unknown reason, the thermal sensor seems to be disabled and will return a constant temperature value of 36.5 degrees Celsius. Don't bind to the device in that case, so that we don't report this bogus value to userspace.

...

drivers/hwmon/i5500_temp.c static int i5500_temp_probe(struct pci_d · line 137

Quoted 3 lines
drivers/hwmon/i5500_temp.c +3 -0
+	if (tsfsc = 0x7F && tstimer = 0x07D30D40) {
+		dev_warn(&pdev->dev, "Sensor seems to be disabled\n");
+		return -ENODEV;

If this is an autoloadable module, and this sensor is very often disabled, shouldn't this be dev_info() or dev_notice()?

Signature · 9 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Jean Delvare

Hi Henrique,

Quoted 6 lines · Henrique de Moraes Holschuh
Quoted 4 lines · Jean Delvare

On many motherboards, for an unknown reason, the thermal sensor seems to be disabled and will return a constant temperature value of 36.5 degrees Celsius. Don't bind to the device in that case, so that we don't report this bogus value to userspace.

Quoted 8 lines

...

drivers/hwmon/i5500_temp.c static int i5500_temp_probe(struct pci_d · line 137

Quoted 3 lines
drivers/hwmon/i5500_temp.c +3 -0
+	if (tsfsc = 0x7F && tstimer = 0x07D30D40) {
+		dev_warn(&pdev->dev, "Sensor seems to be disabled\n");
+		return -ENODEV;

If this is an autoloadable module, and this sensor is very often disabled, shouldn't this be dev_info() or dev_notice()?

This is a good point, I've degraded the message to dev_notice(). Thanks for the suggestion!

Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors