hwmon: (asus_atk0110) Fix upper limit readings
authorLuca Tettamanti <kronos.it@gmail.com>
Tue, 28 Jul 2009 14:31:39 +0000 (16:31 +0200)
committerJean Delvare <khali@linux-fr.org>
Tue, 28 Jul 2009 14:31:39 +0000 (16:31 +0200)
On newer Asus boards the "upper" limit of a sensor is encoded as
delta from the "lower" limit. Fix the driver to correctly handle
this case.

Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
Tested-by: Alex Macfarlane Smith <nospam@archifishal.co.uk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/hwmon/asus_atk0110.c

index bff0103610c17ada5bf070cb49a5f95871967678..fe4fa29c9219b9884e2e55065728920240a55e14 100644 (file)
@@ -593,7 +593,11 @@ static int atk_add_sensor(struct atk_data *data, union acpi_object *obj)
        sensor->data = data;
        sensor->id = flags->integer.value;
        sensor->limit1 = limit1->integer.value;
-       sensor->limit2 = limit2->integer.value;
+       if (data->old_interface)
+               sensor->limit2 = limit2->integer.value;
+       else
+               /* The upper limit is expressed as delta from lower limit */
+               sensor->limit2 = sensor->limit1 + limit2->integer.value;
 
        snprintf(sensor->input_attr_name, ATTR_NAME_SIZE,
                        "%s%d_input", base_name, start + *num);