freezer: introduce freezer-friendly waiting macros

Introduce freezer-friendly wrappers around wait_event_interruptible() and
wait_event_interruptible_timeout(), originally defined in <linux/wait.h>, to
be used in freezable kernel threads.  Make some of the freezable kernel
threads use them.

This is necessary for the freezer to stop sending signals to kernel threads,
which is implemented in the next patch.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Rafael J. Wysocki
2007-10-18 03:04:45 -07:00
committed by Linus Torvalds
parent 2e1318956c
commit e42837bcd3
7 changed files with 45 additions and 13 deletions

View File

@ -448,9 +448,8 @@ static int gameport_thread(void *nothing)
set_freezable();
do {
gameport_handle_event();
wait_event_interruptible(gameport_wait,
wait_event_freezable(gameport_wait,
kthread_should_stop() || !list_empty(&gameport_event_list));
try_to_freeze();
} while (!kthread_should_stop());
printk(KERN_DEBUG "gameport: kgameportd exiting\n");

View File

@ -387,9 +387,8 @@ static int serio_thread(void *nothing)
set_freezable();
do {
serio_handle_event();
wait_event_interruptible(serio_wait,
wait_event_freezable(serio_wait,
kthread_should_stop() || !list_empty(&serio_event_list));
try_to_freeze();
} while (!kthread_should_stop());
printk(KERN_DEBUG "serio: kseriod exiting\n");

View File

@ -333,10 +333,9 @@ static int ucb1400_ts_thread(void *_ucb)
timeout = msecs_to_jiffies(10);
}
wait_event_interruptible_timeout(ucb->ts_wait,
wait_event_freezable_timeout(ucb->ts_wait,
ucb->irq_pending || ucb->ts_restart || kthread_should_stop(),
timeout);
try_to_freeze();
}
/* Send the "pen off" if we are stopping with the pen still active */