aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorVenkatesh Pallipadi <venki@google.com>2010-04-22 19:48:33 -0400
committerLen Brown <len.brown@intel.com>2010-05-28 15:00:55 -0400
commit2da513f582a96c053aacc2c92873978d2ea7abff (patch)
tree57e9d73800950668523cb0b9117d7dbc168e1580 /drivers/acpi
parent34a18d6fe5430184e4ca96eeb074ee671d89fe7b (diff)
ACPI: Minor cleanup eliminating redundant PMTIMER_TICKS to NS conversion
acpi_enter_[simple,bm] does idle timing in ns, convert it to timeval, then to us, then to pmtimer_ticks and then back to ns. This patch changes things to idle timing in ns, convert it to us, and then to pmtimer_ticks. Just saves an imul along this path, but makes the code cleaner. Signed-off-by: Venkatesh Pallipadi <venki@google.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/processor_idle.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 63a3d4b8c238..43fe52f9834b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -859,6 +859,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
859 struct acpi_processor *pr; 859 struct acpi_processor *pr;
860 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 860 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
861 ktime_t kt1, kt2; 861 ktime_t kt1, kt2;
862 s64 idle_time_ns;
862 s64 idle_time; 863 s64 idle_time;
863 s64 sleep_ticks = 0; 864 s64 sleep_ticks = 0;
864 865
@@ -900,12 +901,14 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
900 sched_clock_idle_sleep_event(); 901 sched_clock_idle_sleep_event();
901 acpi_idle_do_entry(cx); 902 acpi_idle_do_entry(cx);
902 kt2 = ktime_get_real(); 903 kt2 = ktime_get_real();
903 idle_time = ktime_to_us(ktime_sub(kt2, kt1)); 904 idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
905 idle_time = idle_time_ns;
906 do_div(idle_time, NSEC_PER_USEC);
904 907
905 sleep_ticks = us_to_pm_timer_ticks(idle_time); 908 sleep_ticks = us_to_pm_timer_ticks(idle_time);
906 909
907 /* Tell the scheduler how much we idled: */ 910 /* Tell the scheduler how much we idled: */
908 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); 911 sched_clock_idle_wakeup_event(idle_time_ns);
909 912
910 local_irq_enable(); 913 local_irq_enable();
911 current_thread_info()->status |= TS_POLLING; 914 current_thread_info()->status |= TS_POLLING;
@@ -933,6 +936,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
933 struct acpi_processor *pr; 936 struct acpi_processor *pr;
934 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 937 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
935 ktime_t kt1, kt2; 938 ktime_t kt1, kt2;
939 s64 idle_time_ns;
936 s64 idle_time; 940 s64 idle_time;
937 s64 sleep_ticks = 0; 941 s64 sleep_ticks = 0;
938 942
@@ -1015,11 +1019,13 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1015 spin_unlock(&c3_lock); 1019 spin_unlock(&c3_lock);
1016 } 1020 }
1017 kt2 = ktime_get_real(); 1021 kt2 = ktime_get_real();
1018 idle_time = ktime_to_us(ktime_sub(kt2, kt1)); 1022 idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1));
1023 idle_time = idle_time_ns;
1024 do_div(idle_time, NSEC_PER_USEC);
1019 1025
1020 sleep_ticks = us_to_pm_timer_ticks(idle_time); 1026 sleep_ticks = us_to_pm_timer_ticks(idle_time);
1021 /* Tell the scheduler how much we idled: */ 1027 /* Tell the scheduler how much we idled: */
1022 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); 1028 sched_clock_idle_wakeup_event(idle_time_ns);
1023 1029
1024 local_irq_enable(); 1030 local_irq_enable();
1025 current_thread_info()->status |= TS_POLLING; 1031 current_thread_info()->status |= TS_POLLING;