[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86 acpi: remove redundant function call.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1232023199 0
# Node ID e98032a016d62c4ee09bb59ab9e0987c2563804a
# Parent  ecf603780f560095c4316169c9473d040f216dfc
x86 acpi: remove redundant function call.

PM_TIMER_TICKS_TO_US() and acpi_pm_tick_to_ns() does the almost the
same stuff.  Thus remove the old one.

Signed-off-by: Lu Guanqun <guanqun.lu@xxxxxxxxx>
Signed-off-by: Wei Gang <wei.gang@xxxxxxxxx>
---
 xen/arch/x86/acpi/cpu_idle.c |    9 ++-------
 xen/arch/x86/time.c          |    7 +++++++
 xen/include/asm-x86/time.h   |    1 +
 3 files changed, 10 insertions(+), 7 deletions(-)

diff -r ecf603780f56 -r e98032a016d6 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c      Thu Jan 15 12:37:42 2009 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c      Thu Jan 15 12:39:59 2009 +0000
@@ -50,11 +50,6 @@
 
 #define DEBUG_PM_CX
 
-#define US_TO_PM_TIMER_TICKS(t)     ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
-#define PM_TIMER_TICKS_TO_US(t)     ((t * 1000) / (PM_TIMER_FREQUENCY / 1000))
-#define C2_OVERHEAD         4   /* 1us (3.579 ticks per us) */
-#define C3_OVERHEAD         4   /* 1us (3.579 ticks per us) */
-
 static void (*lapic_timer_off)(void);
 static void (*lapic_timer_on)(void);
 
@@ -366,7 +361,7 @@ static void acpi_processor_idle(void)
     cx->usage++;
     if ( sleep_ticks > 0 )
     {
-        power->last_residency = PM_TIMER_TICKS_TO_US(sleep_ticks);
+        power->last_residency = acpi_pm_tick_to_ns(sleep_ticks) / 1000UL;
         cx->time += sleep_ticks;
     }
 
@@ -611,7 +606,7 @@ static void set_cx(
     cx->latency  = xen_cx->latency;
     cx->power    = xen_cx->power;
     
-    cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
+    cx->latency_ticks = ns_to_acpi_pm_tick(cx->latency * 1000UL);
     cx->target_residency = cx->latency * latency_factor;
     if ( cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 )
         acpi_power->safe_state = cx;
diff -r ecf603780f56 -r e98032a016d6 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Thu Jan 15 12:37:42 2009 +0000
+++ b/xen/arch/x86/time.c       Thu Jan 15 12:39:59 2009 +0000
@@ -532,9 +532,11 @@ static struct platform_timesource plt_pm
 };
 
 static struct time_scale pmt_scale;
+static struct time_scale pmt_scale_r;
 static __init int init_pmtmr_scale(void)
 {
     set_time_scale(&pmt_scale, ACPI_PM_FREQUENCY);
+    pmt_scale_r = scale_reciprocal(pmt_scale);
     return 0;
 }
 __initcall(init_pmtmr_scale);
@@ -542,6 +544,11 @@ uint64_t acpi_pm_tick_to_ns(uint64_t tic
 uint64_t acpi_pm_tick_to_ns(uint64_t ticks)
 {
     return scale_delta(ticks, &pmt_scale);
+}
+
+uint64_t ns_to_acpi_pm_tick(uint64_t ns)
+{
+    return scale_delta(ns, &pmt_scale_r);
 }
 
 /************************************************************
diff -r ecf603780f56 -r e98032a016d6 xen/include/asm-x86/time.h
--- a/xen/include/asm-x86/time.h        Thu Jan 15 12:37:42 2009 +0000
+++ b/xen/include/asm-x86/time.h        Thu Jan 15 12:39:59 2009 +0000
@@ -39,5 +39,6 @@ int pit_broadcast_is_available(void);
 int pit_broadcast_is_available(void);
 
 uint64_t acpi_pm_tick_to_ns(uint64_t ticks);
+uint64_t ns_to_acpi_pm_tick(uint64_t ns);
 
 #endif /* __X86_TIME_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.