# HG changeset patch # User Guanqun Lu # Date 1231984365 -28800 # Node ID 4a26ae4d1cb0189f70193856adec9d570bf42bb4 # Parent d7c7bec269d49bd442ac773b9ab986422b18cb64 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 Signed-off-by: Wei Gang diff -r d7c7bec269d4 -r 4a26ae4d1cb0 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Thu Jan 15 09:30:57 2009 +0800 +++ b/xen/arch/x86/acpi/cpu_idle.c Thu Jan 15 09:52:45 2009 +0800 @@ -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 @@ 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 @@ 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 d7c7bec269d4 -r 4a26ae4d1cb0 xen/arch/x86/time.c --- a/xen/arch/x86/time.c Thu Jan 15 09:30:57 2009 +0800 +++ b/xen/arch/x86/time.c Thu Jan 15 09:52:45 2009 +0800 @@ -532,9 +532,11 @@ }; 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); @@ -544,6 +546,11 @@ return scale_delta(ticks, &pmt_scale); } +uint64_t ns_to_acpi_pm_tick(uint64_t ns) +{ + return scale_delta(ns, &pmt_scale_r); +} + /************************************************************ * GENERIC PLATFORM TIMER INFRASTRUCTURE */ diff -r d7c7bec269d4 -r 4a26ae4d1cb0 xen/include/asm-x86/time.h --- a/xen/include/asm-x86/time.h Thu Jan 15 09:30:57 2009 +0800 +++ b/xen/include/asm-x86/time.h Thu Jan 15 09:52:45 2009 +0800 @@ -39,5 +39,6 @@ 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__ */