X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Farm%2Fkernel%2Fapm.c;h=33c55689f999ea3f7bcd6f4955d339b4d08fd343;hb=66e8bb97055ff22a0e5ea89c0a75a35f8738cc96;hp=a2843be0555733feaa8fc5cc29574817ce5c6c4d;hpb=7b0a65f9923ffe7885a5473648baaa3a1a701726;p=linux-2.6-omap-h63xx.git diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c index a2843be0555..33c55689f99 100644 --- a/arch/arm/kernel/apm.c +++ b/arch/arm/kernel/apm.c @@ -10,7 +10,6 @@ * [This document is available from Microsoft at: * http://www.microsoft.com/hwdev/busbios/amp_12.htm] */ -#include #include #include #include @@ -18,9 +17,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -81,6 +80,7 @@ struct apm_user { */ static int suspends_pending; static int apm_disabled; +static int arm_apm_active; static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); @@ -356,10 +356,8 @@ static int apm_open(struct inode * inode, struct file * filp) { struct apm_user *as; - as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL); + as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL); if (as) { - memset(as, 0, sizeof(*as)); - /* * XXX - this is a tiny bit broken, when we consider BSD * process accounting. If the device is opened by root, we @@ -477,9 +475,9 @@ static int kapmd(void *arg) apm_event_t event; wait_event_interruptible(kapmd_wait, - !queue_empty(&kapmd_queue) || !pm_active); + !queue_empty(&kapmd_queue) || !arm_apm_active); - if (!pm_active) + if (!arm_apm_active) break; spin_lock_irq(&kapmd_queue_lock); @@ -522,16 +520,11 @@ static int __init apm_init(void) return -ENODEV; } - if (PM_IS_ACTIVE()) { - printk(KERN_NOTICE "apm: overridden by ACPI.\n"); - return -EINVAL; - } - - pm_active = 1; + arm_apm_active = 1; ret = kernel_thread(kapmd, NULL, CLONE_KERNEL); if (ret < 0) { - pm_active = 0; + arm_apm_active = 0; return ret; } @@ -543,7 +536,7 @@ static int __init apm_init(void) if (ret != 0) { remove_proc_entry("apm", NULL); - pm_active = 0; + arm_apm_active = 0; wake_up(&kapmd_wait); wait_for_completion(&kapmd_exit); } @@ -556,7 +549,7 @@ static void __exit apm_exit(void) misc_deregister(&apm_device); remove_proc_entry("apm", NULL); - pm_active = 0; + arm_apm_active = 0; wake_up(&kapmd_wait); wait_for_completion(&kapmd_exit); }