ia64/xen-unstable

changeset 19048:e98032a016d6

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@intel.com>
Signed-off-by: Wei Gang <wei.gang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 15 12:39:59 2009 +0000 (2009-01-15)
parents ecf603780f56
children 04f913ab2049
files xen/arch/x86/acpi/cpu_idle.c xen/arch/x86/time.c xen/include/asm-x86/time.h
line diff
     1.1 --- a/xen/arch/x86/acpi/cpu_idle.c	Thu Jan 15 12:37:42 2009 +0000
     1.2 +++ b/xen/arch/x86/acpi/cpu_idle.c	Thu Jan 15 12:39:59 2009 +0000
     1.3 @@ -50,11 +50,6 @@
     1.4  
     1.5  #define DEBUG_PM_CX
     1.6  
     1.7 -#define US_TO_PM_TIMER_TICKS(t)     ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
     1.8 -#define PM_TIMER_TICKS_TO_US(t)     ((t * 1000) / (PM_TIMER_FREQUENCY / 1000))
     1.9 -#define C2_OVERHEAD         4   /* 1us (3.579 ticks per us) */
    1.10 -#define C3_OVERHEAD         4   /* 1us (3.579 ticks per us) */
    1.11 -
    1.12  static void (*lapic_timer_off)(void);
    1.13  static void (*lapic_timer_on)(void);
    1.14  
    1.15 @@ -366,7 +361,7 @@ static void acpi_processor_idle(void)
    1.16      cx->usage++;
    1.17      if ( sleep_ticks > 0 )
    1.18      {
    1.19 -        power->last_residency = PM_TIMER_TICKS_TO_US(sleep_ticks);
    1.20 +        power->last_residency = acpi_pm_tick_to_ns(sleep_ticks) / 1000UL;
    1.21          cx->time += sleep_ticks;
    1.22      }
    1.23  
    1.24 @@ -611,7 +606,7 @@ static void set_cx(
    1.25      cx->latency  = xen_cx->latency;
    1.26      cx->power    = xen_cx->power;
    1.27      
    1.28 -    cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
    1.29 +    cx->latency_ticks = ns_to_acpi_pm_tick(cx->latency * 1000UL);
    1.30      cx->target_residency = cx->latency * latency_factor;
    1.31      if ( cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 )
    1.32          acpi_power->safe_state = cx;
     2.1 --- a/xen/arch/x86/time.c	Thu Jan 15 12:37:42 2009 +0000
     2.2 +++ b/xen/arch/x86/time.c	Thu Jan 15 12:39:59 2009 +0000
     2.3 @@ -532,9 +532,11 @@ static struct platform_timesource plt_pm
     2.4  };
     2.5  
     2.6  static struct time_scale pmt_scale;
     2.7 +static struct time_scale pmt_scale_r;
     2.8  static __init int init_pmtmr_scale(void)
     2.9  {
    2.10      set_time_scale(&pmt_scale, ACPI_PM_FREQUENCY);
    2.11 +    pmt_scale_r = scale_reciprocal(pmt_scale);
    2.12      return 0;
    2.13  }
    2.14  __initcall(init_pmtmr_scale);
    2.15 @@ -544,6 +546,11 @@ uint64_t acpi_pm_tick_to_ns(uint64_t tic
    2.16      return scale_delta(ticks, &pmt_scale);
    2.17  }
    2.18  
    2.19 +uint64_t ns_to_acpi_pm_tick(uint64_t ns)
    2.20 +{
    2.21 +    return scale_delta(ns, &pmt_scale_r);
    2.22 +}
    2.23 +
    2.24  /************************************************************
    2.25   * GENERIC PLATFORM TIMER INFRASTRUCTURE
    2.26   */
     3.1 --- a/xen/include/asm-x86/time.h	Thu Jan 15 12:37:42 2009 +0000
     3.2 +++ b/xen/include/asm-x86/time.h	Thu Jan 15 12:39:59 2009 +0000
     3.3 @@ -39,5 +39,6 @@ void pit_broadcast_exit(void);
     3.4  int pit_broadcast_is_available(void);
     3.5  
     3.6  uint64_t acpi_pm_tick_to_ns(uint64_t ticks);
     3.7 +uint64_t ns_to_acpi_pm_tick(uint64_t ns);
     3.8  
     3.9  #endif /* __X86_TIME_H__ */