]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/apm_32.c
Introduce new top level suspend and hibernation callbacks
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / apm_32.c
index d4438ef296d8a607f7a703a845040715a8335fd9..c1735f61a2c00e08a1cb865db361bc24023ec458 100644 (file)
@@ -904,6 +904,7 @@ recalc:
                        original_pm_idle();
                else
                        default_idle();
+               local_irq_disable();
                jiffies_since_last_check = jiffies - last_jiffies;
                if (jiffies_since_last_check > idle_period)
                        goto recalc;
@@ -911,6 +912,8 @@ recalc:
 
        if (apm_idle_done)
                apm_do_busy();
+
+       local_irq_enable();
 }
 
 /**
@@ -1189,19 +1192,6 @@ static int suspend(int vetoable)
        int err;
        struct apm_user *as;
 
-       if (pm_send_all(PM_SUSPEND, (void *)3)) {
-               /* Vetoed */
-               if (vetoable) {
-                       if (apm_info.connection_version > 0x100)
-                               set_system_power_state(APM_STATE_REJECT);
-                       err = -EBUSY;
-                       ignore_sys_suspend = 0;
-                       printk(KERN_WARNING "apm: suspend was vetoed.\n");
-                       goto out;
-               }
-               printk(KERN_CRIT "apm: suspend was vetoed, but suspending anyway.\n");
-       }
-
        device_suspend(PMSG_SUSPEND);
        local_irq_disable();
        device_power_down(PMSG_SUSPEND);
@@ -1221,12 +1211,10 @@ static int suspend(int vetoable)
        if (err != APM_SUCCESS)
                apm_error("suspend", err);
        err = (err == APM_SUCCESS) ? 0 : -EIO;
-       device_power_up();
+       device_power_up(PMSG_RESUME);
        local_irq_enable();
-       device_resume();
-       pm_send_all(PM_RESUME, (void *)0);
+       device_resume(PMSG_RESUME);
        queue_event(APM_NORMAL_RESUME, NULL);
- out:
        spin_lock(&user_list_lock);
        for (as = user_list; as != NULL; as = as->next) {
                as->suspend_wait = 0;
@@ -1250,7 +1238,7 @@ static void standby(void)
                apm_error("standby", err);
 
        local_irq_disable();
-       device_power_up();
+       device_power_up(PMSG_RESUME);
        local_irq_enable();
 }
 
@@ -1336,8 +1324,7 @@ static void check_events(void)
                        ignore_bounce = 1;
                        if ((event != APM_NORMAL_RESUME)
                            || (ignore_normal_resume == 0)) {
-                               device_resume();
-                               pm_send_all(PM_RESUME, (void *)0);
+                               device_resume(PMSG_RESUME);
                                queue_event(event, NULL);
                        }
                        ignore_normal_resume = 0;
@@ -2217,7 +2204,6 @@ static struct dmi_system_id __initdata apm_dmi_table[] = {
  */
 static int __init apm_init(void)
 {
-       struct proc_dir_entry *apm_proc;
        struct desc_struct *gdt;
        int err;
 
@@ -2322,9 +2308,7 @@ static int __init apm_init(void)
        set_base(gdt[APM_DS >> 3],
                 __va((unsigned long)apm_info.bios.dseg << 4));
 
-       apm_proc = create_proc_entry("apm", 0, NULL);
-       if (apm_proc)
-               apm_proc->proc_fops = &apm_file_ops;
+       proc_create("apm", 0, NULL, &apm_file_ops);
 
        kapmd_task = kthread_create(apm, NULL, "kapmd");
        if (IS_ERR(kapmd_task)) {