ia64/xen-unstable

changeset 15624:c41dd7e841b1

xen: Clean up code style.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Jul 19 13:39:10 2007 +0100 (2007-07-19)
parents 858b9bc8d0e6
children f1aed243f3f0
files xen/arch/x86/acpi/power.c xen/arch/x86/acpi/suspend.c
line diff
     1.1 --- a/xen/arch/x86/acpi/power.c	Thu Jul 19 13:23:33 2007 +0100
     1.2 +++ b/xen/arch/x86/acpi/power.c	Thu Jul 19 13:39:10 2007 +0100
     1.3 @@ -77,8 +77,8 @@ static void freeze_domains(void)
     1.4  {
     1.5      struct domain *d;
     1.6  
     1.7 -    for_each_domain(d)
     1.8 -        if (d->domain_id != 0)
     1.9 +    for_each_domain ( d )
    1.10 +        if ( d->domain_id != 0 )
    1.11              domain_pause(d);
    1.12  }
    1.13  
    1.14 @@ -86,8 +86,8 @@ static void thaw_domains(void)
    1.15  {
    1.16      struct domain *d;
    1.17  
    1.18 -    for_each_domain(d)
    1.19 -        if (d->domain_id != 0)
    1.20 +    for_each_domain ( d )
    1.21 +        if ( d->domain_id != 0 )
    1.22              domain_unpause(d);
    1.23  }
    1.24  
    1.25 @@ -100,7 +100,7 @@ static void acpi_sleep_prepare(u32 state
    1.26  
    1.27      wakeup_vector_va = __acpi_map_table(
    1.28          acpi_sinfo.wakeup_vector, sizeof(uint64_t));
    1.29 -    if (acpi_sinfo.vector_width == 32)
    1.30 +    if ( acpi_sinfo.vector_width == 32 )
    1.31          *(uint32_t *)wakeup_vector_va =
    1.32              (uint32_t)bootsym_phys(wakeup_start);
    1.33      else
    1.34 @@ -116,13 +116,13 @@ static int enter_state(u32 state)
    1.35      unsigned long flags;
    1.36      int error;
    1.37  
    1.38 -    if (state <= ACPI_STATE_S0 || state > ACPI_S_STATES_MAX)
    1.39 +    if ( (state <= ACPI_STATE_S0) || (state > ACPI_S_STATES_MAX) )
    1.40          return -EINVAL;
    1.41  
    1.42      __sync_lazy_execstate();
    1.43      pmprintk(XENLOG_INFO, "Flush lazy state\n");
    1.44  
    1.45 -    if (!spin_trylock(&pm_lock))
    1.46 +    if ( !spin_trylock(&pm_lock) )
    1.47          return -EBUSY;
    1.48      
    1.49      pmprintk(XENLOG_INFO, "PM: Preparing system for %s sleep\n",
    1.50 @@ -131,7 +131,7 @@ static int enter_state(u32 state)
    1.51      freeze_domains();
    1.52  
    1.53      disable_nonboot_cpus();
    1.54 -    if (num_online_cpus() != 1)
    1.55 +    if ( num_online_cpus() != 1 )
    1.56      {
    1.57          error = -EBUSY;
    1.58          goto Enable_cpu;
    1.59 @@ -143,7 +143,7 @@ static int enter_state(u32 state)
    1.60  
    1.61      local_irq_save(flags);
    1.62  
    1.63 -    if ((error = device_power_down()))
    1.64 +    if ( (error = device_power_down()) )
    1.65      {
    1.66          printk(XENLOG_ERR "Some devices failed to power down\n");
    1.67          goto Done;
    1.68 @@ -151,7 +151,7 @@ static int enter_state(u32 state)
    1.69  
    1.70      ACPI_FLUSH_CPU_CACHE();
    1.71  
    1.72 -    switch (state)
    1.73 +    switch ( state )
    1.74      {
    1.75          case ACPI_STATE_S3:
    1.76              do_suspend_lowlevel();
    1.77 @@ -264,11 +264,13 @@ acpi_status asmlinkage acpi_enter_sleep_
    1.78      ACPI_FLUSH_CPU_CACHE();
    1.79  
    1.80      outw((u16)acpi_sinfo.pm1a_cnt_val, acpi_sinfo.pm1a_cnt);
    1.81 -    if (acpi_sinfo.pm1b_cnt)
    1.82 +    if ( acpi_sinfo.pm1b_cnt )
    1.83          outw((u16)acpi_sinfo.pm1b_cnt_val, acpi_sinfo.pm1b_cnt);
    1.84  
    1.85      /* Wait until we enter sleep state, and spin until we wake */
    1.86 -    while (!acpi_get_wake_status());
    1.87 +    while ( !acpi_get_wake_status() )
    1.88 +        continue;
    1.89 +
    1.90      return_ACPI_STATUS(AE_OK);
    1.91  }
    1.92  
     2.1 --- a/xen/arch/x86/acpi/suspend.c	Thu Jul 19 13:23:33 2007 +0100
     2.2 +++ b/xen/arch/x86/acpi/suspend.c	Thu Jul 19 13:39:10 2007 +0100
     2.3 @@ -1,11 +1,9 @@
     2.4  /*
     2.5 - * Suspend support specific for i386.
     2.6 - *
     2.7 - * Distribute under GPLv2
     2.8 - *
     2.9 - * Copyright (c) 2002 Pavel Machek <pavel@suse.cz>
    2.10 - * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
    2.11 + * Portions are:
    2.12 + *  Copyright (c) 2002 Pavel Machek <pavel@suse.cz>
    2.13 + *  Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
    2.14   */
    2.15 +
    2.16  #include <xen/config.h>
    2.17  #include <xen/acpi.h>
    2.18  #include <xen/smp.h>
    2.19 @@ -16,19 +14,13 @@
    2.20  #include <asm/hvm/support.h>
    2.21  #include <asm/i387.h>
    2.22  
    2.23 -/* Following context save/restore happens on the real context
    2.24 - * of current vcpu, with a lazy state sync forced earlier. 
    2.25 - */
    2.26  #if defined(CONFIG_X86_64)
    2.27 -unsigned long saved_lstar, saved_cstar;
    2.28 +static unsigned long saved_lstar, saved_cstar;
    2.29  #endif
    2.30 +
    2.31  void save_rest_processor_state(void)
    2.32  {
    2.33 -    /*
    2.34 -     * Net effect of unlazy_fpu is to set cr0.ts and thus there's no
    2.35 -     * need to restore fpu after resume.
    2.36 -     */
    2.37 -    if (!is_idle_vcpu(current))
    2.38 +    if ( !is_idle_vcpu(current) )
    2.39          unlazy_fpu(current);
    2.40  
    2.41  #if defined(CONFIG_X86_64)
    2.42 @@ -46,9 +38,7 @@ void restore_rest_processor_state(void)
    2.43      struct tss_struct *t = &init_tss[cpu];
    2.44      struct vcpu *v = current;
    2.45  
    2.46 -    /* Really scared by suffixed comment from Linux, and keep it for safe */
    2.47 -    set_tss_desc(cpu, t);    /* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
    2.48 -
    2.49 +    set_tss_desc(cpu, t);
    2.50      load_TR(cpu);
    2.51  
    2.52  #if defined(CONFIG_X86_64)
    2.53 @@ -58,7 +48,7 @@ void restore_rest_processor_state(void)
    2.54      wrmsr(MSR_STAR, 0, (FLAT_RING3_CS32<<16) | __HYPERVISOR_CS);
    2.55      wrmsr(MSR_SYSCALL_MASK, EF_VM|EF_RF|EF_NT|EF_DF|EF_IE|EF_TF, 0U);    
    2.56  #else /* !defined(CONFIG_X86_64) */
    2.57 -    if (supervisor_mode_kernel && cpu_has_sep)
    2.58 +    if ( supervisor_mode_kernel && cpu_has_sep )
    2.59          wrmsr(MSR_IA32_SYSENTER_ESP, &t->esp1, 0);
    2.60  #endif
    2.61  
    2.62 @@ -74,7 +64,7 @@ void restore_rest_processor_state(void)
    2.63          loaddebug(&v->arch.guest_context, 7);
    2.64      }
    2.65  
    2.66 -    /* Do we start fpu really? Just set cr0.ts to monitor it */
    2.67 +    /* Reload FPU state on next FPU use. */
    2.68      stts();
    2.69  
    2.70      mtrr_ap_init();