Merge tag 'microblaze-v5.12' of git://git.monstr.eu/linux-2.6-microblaze
[linux-2.6-microblaze.git] / drivers / thermal / thermal_core.c
index 567bc6f..996c038 100644 (file)
@@ -289,16 +289,11 @@ static int __init thermal_register_governors(void)
  * - Critical trip point will cause a system shutdown.
  */
 static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
-                                           int delay)
+                                           unsigned long delay)
 {
-       if (delay > 1000)
+       if (delay)
                mod_delayed_work(system_freezable_power_efficient_wq,
-                                &tz->poll_queue,
-                                round_jiffies(msecs_to_jiffies(delay)));
-       else if (delay)
-               mod_delayed_work(system_freezable_power_efficient_wq,
-                                &tz->poll_queue,
-                                msecs_to_jiffies(delay));
+                                &tz->poll_queue, delay);
        else
                cancel_delayed_work(&tz->poll_queue);
 }
@@ -317,9 +312,9 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)
        mutex_lock(&tz->lock);
 
        if (!stop && tz->passive)
-               thermal_zone_device_set_polling(tz, tz->passive_delay);
-       else if (!stop && tz->polling_delay)
-               thermal_zone_device_set_polling(tz, tz->polling_delay);
+               thermal_zone_device_set_polling(tz, tz->passive_delay_jiffies);
+       else if (!stop && tz->polling_delay_jiffies)
+               thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies);
        else
                thermal_zone_device_set_polling(tz, 0);
 
@@ -483,12 +478,6 @@ static void thermal_zone_device_init(struct thermal_zone_device *tz)
                pos->initialized = false;
 }
 
-static void thermal_zone_device_reset(struct thermal_zone_device *tz)
-{
-       tz->passive = 0;
-       thermal_zone_device_init(tz);
-}
-
 static int thermal_zone_device_set_mode(struct thermal_zone_device *tz,
                                        enum thermal_device_mode mode)
 {
@@ -598,26 +587,6 @@ static void thermal_zone_device_check(struct work_struct *work)
        thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
 }
 
-void thermal_zone_device_rebind_exception(struct thermal_zone_device *tz,
-                                         const char *cdev_type, size_t size)
-{
-       struct thermal_cooling_device *cdev = NULL;
-
-       mutex_lock(&thermal_list_lock);
-       list_for_each_entry(cdev, &thermal_cdev_list, node) {
-               /* skip non matching cdevs */
-               if (strncmp(cdev_type, cdev->type, size))
-                       continue;
-
-               /* re binding the exception matching the type pattern */
-               thermal_zone_bind_cooling_device(tz, THERMAL_TRIPS_NONE, cdev,
-                                                THERMAL_NO_LIMIT,
-                                                THERMAL_NO_LIMIT,
-                                                THERMAL_WEIGHT_DEFAULT);
-       }
-       mutex_unlock(&thermal_list_lock);
-}
-
 int for_each_thermal_governor(int (*cb)(struct thermal_governor *, void *),
                              void *data)
 {
@@ -685,23 +654,6 @@ struct thermal_zone_device *thermal_zone_get_by_id(int id)
        return match;
 }
 
-void thermal_zone_device_unbind_exception(struct thermal_zone_device *tz,
-                                         const char *cdev_type, size_t size)
-{
-       struct thermal_cooling_device *cdev = NULL;
-
-       mutex_lock(&thermal_list_lock);
-       list_for_each_entry(cdev, &thermal_cdev_list, node) {
-               /* skip non matching cdevs */
-               if (strncmp(cdev_type, cdev->type, size))
-                       continue;
-               /* unbinding the exception matching the type pattern */
-               thermal_zone_unbind_cooling_device(tz, THERMAL_TRIPS_NONE,
-                                                  cdev);
-       }
-       mutex_unlock(&thermal_list_lock);
-}
-
 /*
  * Device management section: cooling devices, zones devices, and binding
  *
@@ -747,7 +699,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
        unsigned long max_state;
        int result, ret;
 
-       if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE))
+       if (trip >= tz->trips || trip < 0)
                return -EINVAL;
 
        list_for_each_entry(pos1, &thermal_tz_list, node) {
@@ -1349,8 +1301,9 @@ thermal_zone_device_register(const char *type, int trips, int mask,
        tz->device.class = &thermal_class;
        tz->devdata = devdata;
        tz->trips = trips;
-       tz->passive_delay = passive_delay;
-       tz->polling_delay = polling_delay;
+
+       thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay);
+       thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay);
 
        /* sys I/F */
        /* Add nodes that are always present via .groups */
@@ -1404,7 +1357,7 @@ thermal_zone_device_register(const char *type, int trips, int mask,
 
        INIT_DELAYED_WORK(&tz->poll_queue, thermal_zone_device_check);
 
-       thermal_zone_device_reset(tz);
+       thermal_zone_device_init(tz);
        /* Update the new thermal zone and mark it as already updated. */
        if (atomic_cmpxchg(&tz->need_update, 1, 0))
                thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);