]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/i386/kernel/apm.c
mtrr atomicity fix
[linux-2.6-omap-h63xx.git] / arch / i386 / kernel / apm.c
index f9ba0af7ee1f9c56bf0d0ebd68fe37922f6f5df6..4112afe712b9af2522cdea3728dc0b3acc5de9ca 100644 (file)
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 #include <linux/dmi.h>
 #include <linux/suspend.h>
 #include <linux/kthread.h>
 #include <asm/desc.h>
 #include <asm/i8253.h>
 #include <asm/paravirt.h>
+#include <asm/reboot.h>
 
 #include "io_ports.h"
 
-extern unsigned long get_cmos_time(void);
-extern void machine_real_restart(unsigned char *, int);
-
 #if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
 extern int (*console_blank_hook)(int);
 #endif
@@ -385,13 +382,6 @@ static int                 ignore_sys_suspend;
 static int                     ignore_normal_resume;
 static int                     bounce_interval __read_mostly = DEFAULT_BOUNCE_INTERVAL;
 
-#ifdef CONFIG_APM_RTC_IS_GMT
-#      define  clock_cmos_diff 0
-#      define  got_clock_diff  1
-#else
-static long                    clock_cmos_diff;
-static int                     got_clock_diff;
-#endif
 static int                     debug __read_mostly;
 static int                     smp __read_mostly;
 static int                     apm_disabled = -1;
@@ -1176,35 +1166,13 @@ out:
        spin_unlock(&user_list_lock);
 }
 
-static void set_time(void)
-{
-       struct timespec ts;
-       if (got_clock_diff) {   /* Must know time zone in order to set clock */
-               ts.tv_sec = get_cmos_time() + clock_cmos_diff;
-               ts.tv_nsec = 0;
-               do_settimeofday(&ts);
-       } 
-}
-
-static void get_time_diff(void)
-{
-#ifndef CONFIG_APM_RTC_IS_GMT
-       /*
-        * Estimate time zone so that set_time can update the clock
-        */
-       clock_cmos_diff = -get_cmos_time();
-       clock_cmos_diff += get_seconds();
-       got_clock_diff = 1;
-#endif
-}
-
 static void reinit_timer(void)
 {
 #ifdef INIT_TIMER_AFTER_SUSPEND
        unsigned long flags;
 
        spin_lock_irqsave(&i8253_lock, flags);
-       /* set the clock to 100 Hz */
+       /* set the clock to HZ */
        outb_p(0x34, PIT_MODE);         /* binary, mode 2, LSB/MSB, ch 0 */
        udelay(10);
        outb_p(LATCH & 0xff, PIT_CH0);  /* LSB */
@@ -1237,19 +1205,6 @@ static int suspend(int vetoable)
        local_irq_disable();
        device_power_down(PMSG_SUSPEND);
 
-       /* serialize with the timer interrupt */
-       write_seqlock(&xtime_lock);
-
-       /* protect against access to timer chip registers */
-       spin_lock(&i8253_lock);
-
-       get_time_diff();
-       /*
-        * Irq spinlock must be dropped around set_system_power_state.
-        * We'll undo any timer changes due to interrupts below.
-        */
-       spin_unlock(&i8253_lock);
-       write_sequnlock(&xtime_lock);
        local_irq_enable();
 
        save_processor_state();
@@ -1258,7 +1213,6 @@ static int suspend(int vetoable)
        restore_processor_state();
 
        local_irq_disable();
-       set_time();
        reinit_timer();
 
        if (err == APM_NO_ERROR)
@@ -1288,11 +1242,6 @@ static void standby(void)
 
        local_irq_disable();
        device_power_down(PMSG_SUSPEND);
-       /* serialize with the timer interrupt */
-       write_seqlock(&xtime_lock);
-       /* If needed, notify drivers here */
-       get_time_diff();
-       write_sequnlock(&xtime_lock);
        local_irq_enable();
 
        err = set_system_power_state(APM_STATE_STANDBY);
@@ -1386,7 +1335,6 @@ static void check_events(void)
                        ignore_bounce = 1;
                        if ((event != APM_NORMAL_RESUME)
                            || (ignore_normal_resume == 0)) {
-                               set_time();
                                device_resume();
                                pm_send_all(PM_RESUME, (void *)0);
                                queue_event(event, NULL);
@@ -1402,7 +1350,6 @@ static void check_events(void)
                        break;
 
                case APM_UPDATE_TIME:
-                       set_time();
                        break;
 
                case APM_CRITICAL_SUSPEND: