From: Ray Copeland <ray.copeland@xxxxxxxxxx>
Date: Wed, 16 Dec 2009
Subject: [PATCH 1/2] Wrong ADT7462_VOLT_COUNT for linux-2.6.30 adt7462 hwmon driver
Description:
The #define ADT7462_VOLT_COUNT is wrong, it should be 13 not 12. All the
for loops that use this as a limit count are of the typical form, "for
(n = 0; n < ADT7462_VOLT_COUNT; n++)", so to loop through all voltages
w/o missing the last one it is necessary for the count to be one greater
than it is. (Specifically, you will miss the +1.5V 3GPIO input with count
= 12 vs. 13.)
Signed-off-by: Ray Copeland <ray.copeland@xxxxxxxxxx>
Diff with changes vs. original adt7462.c 2.6.30 version:
--- adt7462.c 2009-12-15 15:57:47.000000000 -0800
+++ adt7462.c.orig 2009-12-15 15:51:05.000000000 -0800
@@ -97,7 +97,6 @@
#define ADT7462_PIN24_SHIFT 6
#define ADT7462_PIN26_VOLT_INPUT 0x08
#define ADT7462_PIN25_VOLT_INPUT 0x20
-#define ADT7462_PIN29_SHIFT 4 /* cfg3 */
#define ADT7462_PIN28_SHIFT 6 /* cfg3 */
#define ADT7462_PIN28_VOLT 0x5
@@ -183,7 +182,7 @@
*
* Some, but not all, of these voltages have low/high limits.
*/
-#define ADT7462_VOLT_COUNT 13
+#define ADT7462_VOLT_COUNT 12
#define ADT7462_VENDOR 0x41
#define ADT7462_DEVICE 0x62
@@ -325,13 +324,13 @@
case 10:
return 0x6A;
case 11:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return 0x50;
break;
case 12:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return 0x4C;
@@ -384,13 +383,13 @@
case 10:
return 0x73;
case 11:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return 0x76;
break;
case 12:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return 0x77;
@@ -443,13 +442,13 @@
case 10:
return 0x91;
case 11:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return 0x94;
break;
case 12:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return 0x95;
@@ -535,13 +534,13 @@
return "+1.5";
}
case 11:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return "+1.5V ICH";
break;
case 12:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return "+1.5V 3GPIO";
@@ -630,7 +629,7 @@
}
case 11:
case 12:
- if (data->pin_cfg[3] >> ADT7462_PIN29_SHIFT ==
+ if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
ADT7462_PIN28_VOLT &&
!(data->pin_cfg[0] & ADT7462_VID_INPUT))
return 7800;
_______________________________________________ lm-sensors mailing list lm-sensors@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors