aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-08-18 04:06:53 -0400
committerJiri Kosina <jkosina@suse.cz>2011-08-23 03:16:29 -0400
commit1d927c3b5a4005a2ebc5356e7e1eec436e15fa22 (patch)
tree86a97fc15d4ea1d4fcd5bf5d92c31bb130ba6d75 /drivers/char
parent51414d41084496aaefd06d7f19eb8206e8bfac2d (diff)
apm-emulation: use wait_event_freezable() instead of freezer_[do_not_]count()
vfork is moving away from freezer_[do_not_]count() one way or the other leaving apm_ioctl() as the only user. apm_ioctl() just wants to wait for suspend/resume cycle to complete without hindering the freezer. Use wait_event_freezable() instead. The only annoyance is that wait_event_freezable() wakes up with -ERESTART if there are pending signals while apm_ioctl() wants to ignore all signals until suspend is complete. We can play with @current->[real_]blocked but this is hardly a performance or latency critical path - simply chill a bit on each iteration until SUSPEND_DONE for unlikely cases where there are pending signals. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/apm-emulation.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c
index 548708c4b2b8..7e2709c35fcf 100644
--- a/drivers/char/apm-emulation.c
+++ b/drivers/char/apm-emulation.c
@@ -300,17 +300,13 @@ apm_ioctl(struct file *filp, u_int cmd, u_long arg)
300 /* 300 /*
301 * Wait for the suspend/resume to complete. If there 301 * Wait for the suspend/resume to complete. If there
302 * are pending acknowledges, we wait here for them. 302 * are pending acknowledges, we wait here for them.
303 * wait_event_freezable() is interruptible and pending
304 * signal can cause busy looping. We aren't doing
305 * anything critical, chill a bit on each iteration.
303 */ 306 */
304 freezer_do_not_count(); 307 while (wait_event_freezable(apm_suspend_waitqueue,
305 308 as->suspend_state == SUSPEND_DONE))
306 wait_event(apm_suspend_waitqueue, 309 msleep(10);
307 as->suspend_state == SUSPEND_DONE);
308
309 /*
310 * Since we are waiting until the suspend is done, the
311 * try_to_freeze() in freezer_count() will not trigger
312 */
313 freezer_count();
314 break; 310 break;
315 case SUSPEND_ACKTO: 311 case SUSPEND_ACKTO:
316 as->suspend_result = -ETIMEDOUT; 312 as->suspend_result = -ETIMEDOUT;