All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] hwmon/adm1029 Use mask for fan_div value
@ 2008-10-13 19:45 corentin.labbe
  2008-10-13 20:50 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: corentin.labbe @ 2008-10-13 19:45 UTC (permalink / raw)
  To: lm-sensors

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

Hello

This is my patch for testing correct values of fan div in adm1029 and
prevent a division by 0 for some (unlikely) register values.


Signed off by LABBE Corentin <corentin.labbe@geomatys.fr>

[-- Attachment #2: adm1029.patch --]
[-- Type: text/plain, Size: 877 bytes --]

--- linux/drivers/hwmon/adm1029.orig	2008-05-17 13:25:59.000000000 +0200
+++ linux/drivers/hwmon/adm1029.c	2008-05-18 13:04:42.000000000 +0200
@@ -170,7 +170,8 @@
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
 	struct adm1029_data *data = adm1029_update_device(dev);
 	u16 val;
-	if (data->fan[attr->index] == 0 || data->fan_div[attr->index] == 0
+	if (data->fan[attr->index] == 0
+	    || (data->fan_div[attr->index] & 0xC0) == 0
 	    || data->fan[attr->index] == 255) {
 		return sprintf(buf, "0\n");
 	}
@@ -185,7 +186,7 @@
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
 	struct adm1029_data *data = adm1029_update_device(dev);
-	if (data->fan_div[attr->index] == 0)
+	if ((data->fan_div[attr->index] & 0xC0) == 0)
 		return sprintf(buf, "0\n");
 	return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index]));
 }

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [lm-sensors] [PATCH] hwmon/adm1029 Use mask for fan_div value
  2008-10-13 19:45 [lm-sensors] [PATCH] hwmon/adm1029 Use mask for fan_div value corentin.labbe
@ 2008-10-13 20:50 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2008-10-13 20:50 UTC (permalink / raw)
  To: lm-sensors

On Mon, 13 Oct 2008 21:45:21 +0200, corentin.labbe wrote:
> Hello
> 
> This is my patch for testing correct values of fan div in adm1029 and
> prevent a division by 0 for some (unlikely) register values.
> 
> 
> Signed off by LABBE Corentin <corentin.labbe@geomatys.fr>

Patch applied, thanks!

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-13 20:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-13 19:45 [lm-sensors] [PATCH] hwmon/adm1029 Use mask for fan_div value corentin.labbe
2008-10-13 20:50 ` Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.