* [lm-sensors] PATCH: hwmon-abituguru-volt-test.patch
@ 2007-06-17 19:56 Hans de Goede
2007-06-18 12:05 ` Jean Delvare
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Hans de Goede @ 2007-06-17 19:56 UTC (permalink / raw)
To: lm-sensors
[-- Attachment #1: Type: text/plain, Size: 163 bytes --]
Hi All,
This patch fixes the detection of volt inputs with a reading of more then 240
units.
Mark, please apply to your tree and send upstream.
Regards,
Hans
[-- Attachment #2: hwmon-abituguru-volt-test.patch --]
[-- Type: text/x-patch, Size: 2504 bytes --]
This patch fixes the detection of volt inputs with a reading of more then 240
units.
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
diff -urN linux-2.6.22-rc4.orig/drivers/hwmon/abituguru.c linux-2.6.22-rc4/drivers/hwmon/abituguru.c
--- linux-2.6.22-rc4.orig/drivers/hwmon/abituguru.c 2007-06-17 09:10:17.000000000 +0200
+++ linux-2.6.22-rc4/drivers/hwmon/abituguru.c 2007-06-17 09:09:48.000000000 +0200
@@ -418,7 +418,7 @@
abituguru_detect_bank1_sensor_type(struct abituguru_data *data,
u8 sensor_addr)
{
- u8 val, buf[3];
+ u8 val, test_flag, buf[3];
int i, ret = -ENODEV; /* error is the most common used retval :| */
/* If overriden by the user return the user selected type */
@@ -436,7 +436,7 @@
return -ENODEV;
/* Test val is sane / usable for sensor type detection. */
- if ((val < 10u) || (val > 240u)) {
+ if ((val < 10u) || (val > 250u)) {
printk(KERN_WARNING ABIT_UGURU_NAME
": bank1-sensor: %d reading (%d) too close to limits, "
"unable to determine sensor type, skipping sensor\n",
@@ -449,10 +449,23 @@
ABIT_UGURU_DEBUG(2, "testing bank1 sensor %d\n", (int)sensor_addr);
/* Volt sensor test, enable volt low alarm, set min value ridicously
- high. If its a volt sensor this should always give us an alarm. */
- buf[0] = ABIT_UGURU_VOLT_LOW_ALARM_ENABLE;
- buf[1] = 245;
- buf[2] = 250;
+ high, or vica versa if the reading is very high. If its a volt
+ sensor this should always give us an alarm. */
+ if (val <= 240u)
+ {
+ buf[0] = ABIT_UGURU_VOLT_LOW_ALARM_ENABLE;
+ buf[1] = 245;
+ buf[2] = 250;
+ test_flag = ABIT_UGURU_VOLT_LOW_ALARM_FLAG;
+ }
+ else
+ {
+ buf[0] = ABIT_UGURU_VOLT_HIGH_ALARM_ENABLE;
+ buf[1] = 5;
+ buf[2] = 10;
+ test_flag = ABIT_UGURU_VOLT_HIGH_ALARM_FLAG;
+ }
+
if (abituguru_write(data, ABIT_UGURU_SENSOR_BANK1 + 2, sensor_addr,
buf, 3) != 3)
goto abituguru_detect_bank1_sensor_type_exit;
@@ -469,13 +482,13 @@
sensor_addr, buf, 3,
ABIT_UGURU_MAX_RETRIES) != 3)
goto abituguru_detect_bank1_sensor_type_exit;
- if (buf[0] & ABIT_UGURU_VOLT_LOW_ALARM_FLAG) {
+ if (buf[0] & test_flag) {
ABIT_UGURU_DEBUG(2, " found volt sensor\n");
ret = ABIT_UGURU_IN_SENSOR;
goto abituguru_detect_bank1_sensor_type_exit;
} else
ABIT_UGURU_DEBUG(2, " alarm raised during volt "
- "sensor test, but volt low flag not set\n");
+ "sensor test, but volt range flag not set\n");
} else
ABIT_UGURU_DEBUG(2, " alarm not raised during volt sensor "
"test\n");
[-- 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] 4+ messages in thread
* Re: [lm-sensors] PATCH: hwmon-abituguru-volt-test.patch
2007-06-17 19:56 [lm-sensors] PATCH: hwmon-abituguru-volt-test.patch Hans de Goede
@ 2007-06-18 12:05 ` Jean Delvare
2007-06-18 20:59 ` Hans de Goede
2007-06-24 13:54 ` Mark M. Hoffman
2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2007-06-18 12:05 UTC (permalink / raw)
To: lm-sensors
Hi Hans,
On Sun, 17 Jun 2007 22:06:46 +0200, Hans de Goede wrote:
> This patch fixes the detection of volt inputs with a reading of more then 240
> units.
> Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
> diff -urN linux-2.6.22-rc4.orig/drivers/hwmon/abituguru.c linux-2.6.22-rc4/drivers/hwmon/abituguru.c
> --- linux-2.6.22-rc4.orig/drivers/hwmon/abituguru.c 2007-06-17 09:10:17.000000000 +0200
> +++ linux-2.6.22-rc4/drivers/hwmon/abituguru.c 2007-06-17 09:09:48.000000000 +0200
> (...)
> @@ -449,10 +449,23 @@
>
> ABIT_UGURU_DEBUG(2, "testing bank1 sensor %d\n", (int)sensor_addr);
> /* Volt sensor test, enable volt low alarm, set min value ridicously
> - high. If its a volt sensor this should always give us an alarm. */
> - buf[0] = ABIT_UGURU_VOLT_LOW_ALARM_ENABLE;
> - buf[1] = 245;
> - buf[2] = 250;
> + high, or vica versa if the reading is very high. If its a volt
> + sensor this should always give us an alarm. */
> + if (val <= 240u)
> + {
> + buf[0] = ABIT_UGURU_VOLT_LOW_ALARM_ENABLE;
> + buf[1] = 245;
> + buf[2] = 250;
> + test_flag = ABIT_UGURU_VOLT_LOW_ALARM_FLAG;
> + }
> + else
> + {
> + buf[0] = ABIT_UGURU_VOLT_HIGH_ALARM_ENABLE;
> + buf[1] = 5;
> + buf[2] = 10;
> + test_flag = ABIT_UGURU_VOLT_HIGH_ALARM_FLAG;
> + }
> +
> if (abituguru_write(data, ABIT_UGURU_SENSOR_BANK1 + 2, sensor_addr,
> buf, 3) != 3)
> goto abituguru_detect_bank1_sensor_type_exit;
Curly braces placement infringes Documentation/CodingSyle.
Other than that, patch looks good.
--
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] 4+ messages in thread
* Re: [lm-sensors] PATCH: hwmon-abituguru-volt-test.patch
2007-06-17 19:56 [lm-sensors] PATCH: hwmon-abituguru-volt-test.patch Hans de Goede
2007-06-18 12:05 ` Jean Delvare
@ 2007-06-18 20:59 ` Hans de Goede
2007-06-24 13:54 ` Mark M. Hoffman
2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2007-06-18 20:59 UTC (permalink / raw)
To: lm-sensors
[-- Attachment #1: Type: text/plain, Size: 161 bytes --]
Jean Delvare wrote:
> Hi Hans,
>
> Curly braces placement infringes Documentation/CodingSyle.
>
Oops my bad, the attached version fixes this.
Regards,
Hans
[-- Attachment #2: hwmon-abituguru-volt-test.patch --]
[-- Type: text/x-patch, Size: 2498 bytes --]
This patch fixes the detection of volt inputs with a reading of more then 240
units.
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
diff -urN linux-2.6.22-rc4.orig/drivers/hwmon/abituguru.c linux-2.6.22-rc4/drivers/hwmon/abituguru.c
--- linux-2.6.22-rc4.orig/drivers/hwmon/abituguru.c 2007-06-17 09:10:17.000000000 +0200
+++ linux-2.6.22-rc4/drivers/hwmon/abituguru.c 2007-06-18 22:47:52.000000000 +0200
@@ -418,7 +418,7 @@
abituguru_detect_bank1_sensor_type(struct abituguru_data *data,
u8 sensor_addr)
{
- u8 val, buf[3];
+ u8 val, test_flag, buf[3];
int i, ret = -ENODEV; /* error is the most common used retval :| */
/* If overriden by the user return the user selected type */
@@ -436,7 +436,7 @@
return -ENODEV;
/* Test val is sane / usable for sensor type detection. */
- if ((val < 10u) || (val > 240u)) {
+ if ((val < 10u) || (val > 250u)) {
printk(KERN_WARNING ABIT_UGURU_NAME
": bank1-sensor: %d reading (%d) too close to limits, "
"unable to determine sensor type, skipping sensor\n",
@@ -449,10 +449,20 @@
ABIT_UGURU_DEBUG(2, "testing bank1 sensor %d\n", (int)sensor_addr);
/* Volt sensor test, enable volt low alarm, set min value ridicously
- high. If its a volt sensor this should always give us an alarm. */
- buf[0] = ABIT_UGURU_VOLT_LOW_ALARM_ENABLE;
- buf[1] = 245;
- buf[2] = 250;
+ high, or vica versa if the reading is very high. If its a volt
+ sensor this should always give us an alarm. */
+ if (val <= 240u) {
+ buf[0] = ABIT_UGURU_VOLT_LOW_ALARM_ENABLE;
+ buf[1] = 245;
+ buf[2] = 250;
+ test_flag = ABIT_UGURU_VOLT_LOW_ALARM_FLAG;
+ } else {
+ buf[0] = ABIT_UGURU_VOLT_HIGH_ALARM_ENABLE;
+ buf[1] = 5;
+ buf[2] = 10;
+ test_flag = ABIT_UGURU_VOLT_HIGH_ALARM_FLAG;
+ }
+
if (abituguru_write(data, ABIT_UGURU_SENSOR_BANK1 + 2, sensor_addr,
buf, 3) != 3)
goto abituguru_detect_bank1_sensor_type_exit;
@@ -469,13 +479,13 @@
sensor_addr, buf, 3,
ABIT_UGURU_MAX_RETRIES) != 3)
goto abituguru_detect_bank1_sensor_type_exit;
- if (buf[0] & ABIT_UGURU_VOLT_LOW_ALARM_FLAG) {
+ if (buf[0] & test_flag) {
ABIT_UGURU_DEBUG(2, " found volt sensor\n");
ret = ABIT_UGURU_IN_SENSOR;
goto abituguru_detect_bank1_sensor_type_exit;
} else
ABIT_UGURU_DEBUG(2, " alarm raised during volt "
- "sensor test, but volt low flag not set\n");
+ "sensor test, but volt range flag not set\n");
} else
ABIT_UGURU_DEBUG(2, " alarm not raised during volt sensor "
"test\n");
[-- 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] 4+ messages in thread
* Re: [lm-sensors] PATCH: hwmon-abituguru-volt-test.patch
2007-06-17 19:56 [lm-sensors] PATCH: hwmon-abituguru-volt-test.patch Hans de Goede
2007-06-18 12:05 ` Jean Delvare
2007-06-18 20:59 ` Hans de Goede
@ 2007-06-24 13:54 ` Mark M. Hoffman
2 siblings, 0 replies; 4+ messages in thread
From: Mark M. Hoffman @ 2007-06-24 13:54 UTC (permalink / raw)
To: lm-sensors
Hi:
* Hans de Goede <j.w.r.degoede@hhs.nl> [2007-06-18 22:59:34 +0200]:
> Oops my bad, the attached version fixes this.
>
> Regards,
>
> Hans
> This patch fixes the detection of volt inputs with a reading of more then 240
> units.
>
> Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Patch applied to testing (with one whitespace fix), thanks.
Regards,
--
Mark M. Hoffman
mhoffman@lightlink.com
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-24 13:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-17 19:56 [lm-sensors] PATCH: hwmon-abituguru-volt-test.patch Hans de Goede
2007-06-18 12:05 ` Jean Delvare
2007-06-18 20:59 ` Hans de Goede
2007-06-24 13:54 ` Mark M. Hoffman
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.