thermal: Only set passive_delay for forced_passive cooling
authorFrans Pop <elendil@planet.nl>
Mon, 26 Oct 2009 07:39:03 +0000 (08:39 +0100)
committerLen Brown <len.brown@intel.com>
Thu, 5 Nov 2009 23:18:36 +0000 (18:18 -0500)
Setting polling_delay is useless as passive_delay has priority,
so the value shown in proc isn't the actual polling delay. It
also gives the impression to the user that he can change the
polling interval through proc, while in fact he can't.

Also, unset passive_delay when the forced passive trip point is
unbound to allow polling to be disabled.

Signed-off-by: Frans Pop <elendil@planet.nl>
Acked-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/thermal/thermal_sys.c

index 310e40ab00b6ff25d578f6486b4ed34e6b7fa7d5..663c2fdba775dc3ed6add2d6e162e4d55fdcd169 100644 (file)
@@ -241,6 +241,8 @@ passive_store(struct device *dev, struct device_attribute *attr,
                                                                 cdev);
                }
                mutex_unlock(&thermal_list_lock);
+               if (!tz->passive_delay)
+                       tz->passive_delay = 1000;
        } else if (!state && tz->forced_passive) {
                mutex_lock(&thermal_list_lock);
                list_for_each_entry(cdev, &thermal_cdev_list, node) {
@@ -251,17 +253,12 @@ passive_store(struct device *dev, struct device_attribute *attr,
                                                                   cdev);
                }
                mutex_unlock(&thermal_list_lock);
+               tz->passive_delay = 0;
        }
 
        tz->tc1 = 1;
        tz->tc2 = 1;
 
-       if (!tz->passive_delay)
-               tz->passive_delay = 1000;
-
-       if (!tz->polling_delay)
-               tz->polling_delay = 10000;
-
        tz->forced_passive = state;
 
        thermal_zone_device_update(tz);