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

[Xen-changelog] [xen-unstable] xen: Clean up code style.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1184848750 -3600
# Node ID c41dd7e841b1a8726d4b1db0cc327821f46a147c
# Parent  858b9bc8d0e6245ba361cff097547ed8a1729e29
xen: Clean up code style.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/acpi/power.c   |   26 ++++++++++++++------------
 xen/arch/x86/acpi/suspend.c |   30 ++++++++++--------------------
 2 files changed, 24 insertions(+), 32 deletions(-)

diff -r 858b9bc8d0e6 -r c41dd7e841b1 xen/arch/x86/acpi/power.c
--- a/xen/arch/x86/acpi/power.c Thu Jul 19 13:23:33 2007 +0100
+++ b/xen/arch/x86/acpi/power.c Thu Jul 19 13:39:10 2007 +0100
@@ -77,8 +77,8 @@ static void freeze_domains(void)
 {
     struct domain *d;
 
-    for_each_domain(d)
-        if (d->domain_id != 0)
+    for_each_domain ( d )
+        if ( d->domain_id != 0 )
             domain_pause(d);
 }
 
@@ -86,8 +86,8 @@ static void thaw_domains(void)
 {
     struct domain *d;
 
-    for_each_domain(d)
-        if (d->domain_id != 0)
+    for_each_domain ( d )
+        if ( d->domain_id != 0 )
             domain_unpause(d);
 }
 
@@ -100,7 +100,7 @@ static void acpi_sleep_prepare(u32 state
 
     wakeup_vector_va = __acpi_map_table(
         acpi_sinfo.wakeup_vector, sizeof(uint64_t));
-    if (acpi_sinfo.vector_width == 32)
+    if ( acpi_sinfo.vector_width == 32 )
         *(uint32_t *)wakeup_vector_va =
             (uint32_t)bootsym_phys(wakeup_start);
     else
@@ -116,13 +116,13 @@ static int enter_state(u32 state)
     unsigned long flags;
     int error;
 
-    if (state <= ACPI_STATE_S0 || state > ACPI_S_STATES_MAX)
+    if ( (state <= ACPI_STATE_S0) || (state > ACPI_S_STATES_MAX) )
         return -EINVAL;
 
     __sync_lazy_execstate();
     pmprintk(XENLOG_INFO, "Flush lazy state\n");
 
-    if (!spin_trylock(&pm_lock))
+    if ( !spin_trylock(&pm_lock) )
         return -EBUSY;
     
     pmprintk(XENLOG_INFO, "PM: Preparing system for %s sleep\n",
@@ -131,7 +131,7 @@ static int enter_state(u32 state)
     freeze_domains();
 
     disable_nonboot_cpus();
-    if (num_online_cpus() != 1)
+    if ( num_online_cpus() != 1 )
     {
         error = -EBUSY;
         goto Enable_cpu;
@@ -143,7 +143,7 @@ static int enter_state(u32 state)
 
     local_irq_save(flags);
 
-    if ((error = device_power_down()))
+    if ( (error = device_power_down()) )
     {
         printk(XENLOG_ERR "Some devices failed to power down\n");
         goto Done;
@@ -151,7 +151,7 @@ static int enter_state(u32 state)
 
     ACPI_FLUSH_CPU_CACHE();
 
-    switch (state)
+    switch ( state )
     {
         case ACPI_STATE_S3:
             do_suspend_lowlevel();
@@ -264,11 +264,13 @@ acpi_status asmlinkage acpi_enter_sleep_
     ACPI_FLUSH_CPU_CACHE();
 
     outw((u16)acpi_sinfo.pm1a_cnt_val, acpi_sinfo.pm1a_cnt);
-    if (acpi_sinfo.pm1b_cnt)
+    if ( acpi_sinfo.pm1b_cnt )
         outw((u16)acpi_sinfo.pm1b_cnt_val, acpi_sinfo.pm1b_cnt);
 
     /* Wait until we enter sleep state, and spin until we wake */
-    while (!acpi_get_wake_status());
+    while ( !acpi_get_wake_status() )
+        continue;
+
     return_ACPI_STATUS(AE_OK);
 }
 
diff -r 858b9bc8d0e6 -r c41dd7e841b1 xen/arch/x86/acpi/suspend.c
--- a/xen/arch/x86/acpi/suspend.c       Thu Jul 19 13:23:33 2007 +0100
+++ b/xen/arch/x86/acpi/suspend.c       Thu Jul 19 13:39:10 2007 +0100
@@ -1,11 +1,9 @@
 /*
- * Suspend support specific for i386.
- *
- * Distribute under GPLv2
- *
- * Copyright (c) 2002 Pavel Machek <pavel@xxxxxxx>
- * Copyright (c) 2001 Patrick Mochel <mochel@xxxxxxxx>
+ * Portions are:
+ *  Copyright (c) 2002 Pavel Machek <pavel@xxxxxxx>
+ *  Copyright (c) 2001 Patrick Mochel <mochel@xxxxxxxx>
  */
+
 #include <xen/config.h>
 #include <xen/acpi.h>
 #include <xen/smp.h>
@@ -16,19 +14,13 @@
 #include <asm/hvm/support.h>
 #include <asm/i387.h>
 
-/* Following context save/restore happens on the real context
- * of current vcpu, with a lazy state sync forced earlier. 
- */
 #if defined(CONFIG_X86_64)
-unsigned long saved_lstar, saved_cstar;
+static unsigned long saved_lstar, saved_cstar;
 #endif
+
 void save_rest_processor_state(void)
 {
-    /*
-     * Net effect of unlazy_fpu is to set cr0.ts and thus there's no
-     * need to restore fpu after resume.
-     */
-    if (!is_idle_vcpu(current))
+    if ( !is_idle_vcpu(current) )
         unlazy_fpu(current);
 
 #if defined(CONFIG_X86_64)
@@ -46,9 +38,7 @@ void restore_rest_processor_state(void)
     struct tss_struct *t = &init_tss[cpu];
     struct vcpu *v = current;
 
-    /* Really scared by suffixed comment from Linux, and keep it for safe */
-    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. */
-
+    set_tss_desc(cpu, t);
     load_TR(cpu);
 
 #if defined(CONFIG_X86_64)
@@ -58,7 +48,7 @@ void restore_rest_processor_state(void)
     wrmsr(MSR_STAR, 0, (FLAT_RING3_CS32<<16) | __HYPERVISOR_CS);
     wrmsr(MSR_SYSCALL_MASK, EF_VM|EF_RF|EF_NT|EF_DF|EF_IE|EF_TF, 0U);    
 #else /* !defined(CONFIG_X86_64) */
-    if (supervisor_mode_kernel && cpu_has_sep)
+    if ( supervisor_mode_kernel && cpu_has_sep )
         wrmsr(MSR_IA32_SYSENTER_ESP, &t->esp1, 0);
 #endif
 
@@ -74,7 +64,7 @@ void restore_rest_processor_state(void)
         loaddebug(&v->arch.guest_context, 7);
     }
 
-    /* Do we start fpu really? Just set cr0.ts to monitor it */
+    /* Reload FPU state on next FPU use. */
     stts();
 
     mtrr_ap_init();

_______________________________________________
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®.