diff options
-rw-r--r-- | drivers/acpi/thermal.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index bc6d5866ef98..15d5fdc66a96 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -711,6 +711,7 @@ static void acpi_thermal_check(void *data) | |||
711 | int result = 0; | 711 | int result = 0; |
712 | struct acpi_thermal *tz = data; | 712 | struct acpi_thermal *tz = data; |
713 | unsigned long sleep_time = 0; | 713 | unsigned long sleep_time = 0; |
714 | unsigned long timeout_jiffies = 0; | ||
714 | int i = 0; | 715 | int i = 0; |
715 | struct acpi_thermal_state state; | 716 | struct acpi_thermal_state state; |
716 | 717 | ||
@@ -787,10 +788,13 @@ static void acpi_thermal_check(void *data) | |||
787 | * a thermal event occurs). Note that _TSP and _TZD values are | 788 | * a thermal event occurs). Note that _TSP and _TZD values are |
788 | * given in 1/10th seconds (we must covert to milliseconds). | 789 | * given in 1/10th seconds (we must covert to milliseconds). |
789 | */ | 790 | */ |
790 | if (tz->state.passive) | 791 | if (tz->state.passive) { |
791 | sleep_time = tz->trips.passive.tsp * 100; | 792 | sleep_time = tz->trips.passive.tsp * 100; |
792 | else if (tz->polling_frequency > 0) | 793 | timeout_jiffies = jiffies + (HZ * sleep_time) / 1000; |
794 | } else if (tz->polling_frequency > 0) { | ||
793 | sleep_time = tz->polling_frequency * 100; | 795 | sleep_time = tz->polling_frequency * 100; |
796 | timeout_jiffies = round_jiffies(jiffies + (HZ * sleep_time) / 1000); | ||
797 | } | ||
794 | 798 | ||
795 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", | 799 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", |
796 | tz->name, tz->temperature, sleep_time)); | 800 | tz->name, tz->temperature, sleep_time)); |
@@ -804,12 +808,11 @@ static void acpi_thermal_check(void *data) | |||
804 | del_timer(&(tz->timer)); | 808 | del_timer(&(tz->timer)); |
805 | } else { | 809 | } else { |
806 | if (timer_pending(&(tz->timer))) | 810 | if (timer_pending(&(tz->timer))) |
807 | mod_timer(&(tz->timer), | 811 | mod_timer(&(tz->timer), timeout_jiffies); |
808 | jiffies + (HZ * sleep_time) / 1000); | ||
809 | else { | 812 | else { |
810 | tz->timer.data = (unsigned long)tz; | 813 | tz->timer.data = (unsigned long)tz; |
811 | tz->timer.function = acpi_thermal_run; | 814 | tz->timer.function = acpi_thermal_run; |
812 | tz->timer.expires = jiffies + (HZ * sleep_time) / 1000; | 815 | tz->timer.expires = timeout_jiffies; |
813 | add_timer(&(tz->timer)); | 816 | add_timer(&(tz->timer)); |
814 | } | 817 | } |
815 | } | 818 | } |