[PATCH] i386/apm: use wait_event_interruptible_timeout()

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

 



Use wait_event_interruptible_timeout() instead of custom wait-queue.


Signed-off-by: Nishanth Aravamudan <nacc@xxxxxxxxxx>

--- 2.6.12-rc3/arch/i386/kernel/apm.c	2005-04-29 11:03:03.000000000 -0700
+++ 2.6.12-rc3-dev/arch/i386/kernel/apm.c	2005-05-01 19:02:48.000000000 -0700
@@ -224,6 +224,7 @@
 #include <linux/smp_lock.h>
 #include <linux/dmi.h>
 #include <linux/suspend.h>
+#include <linux/wait.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -1418,22 +1419,15 @@ static void apm_event_handler(void)
 
 static void apm_mainloop(void)
 {
-	DECLARE_WAITQUEUE(wait, current);
-
-	add_wait_queue(&apm_waitqueue, &wait);
-	set_current_state(TASK_INTERRUPTIBLE);
-	for (;;) {
-		schedule_timeout(APM_CHECK_TIMEOUT);
-		if (exit_kapmd)
-			break;
+	do {
+		wait_event_interruptible_timeout(apm_waitqueue,
+				exit_kapmd, APM_CHECK_TIMEOUT);
 		/*
 		 * Ok, check all events, check for idle (and mark us sleeping
 		 * so as not to count towards the load average)..
 		 */
-		set_current_state(TASK_INTERRUPTIBLE);
 		apm_event_handler();
-	}
-	remove_wait_queue(&apm_waitqueue, &wait);
+	} while (!exit_kapmd);
 }
 
 static int check_apm_user(struct apm_user *as, const char *func)
-
To unsubscribe from this list: send the line "unsubscribe linux-laptop" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux ACPI]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]
  Powered by Linux