#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/device.h>
+#include <linux/wait.h>
#include <asm/io.h>
#include <asm/uaccess.h>
tty->driver_data = portp;
portp->refcount++;
- while (test_bit(ST_INITIALIZING, &portp->state)) {
- if (signal_pending(current))
- return(-ERESTARTSYS);
- interruptible_sleep_on(&portp->raw_wait);
- }
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_INITIALIZING, &portp->state));
+ if (signal_pending(current))
+ return(-ERESTARTSYS);
if ((portp->flags & ASYNC_INITIALIZED) == 0) {
set_bit(ST_INITIALIZING, &portp->state);
* order of opens and closes may not be preserved across shared
* memory, so we must wait until it is complete.
*/
- while (test_bit(ST_CLOSING, &portp->state)) {
- if (signal_pending(current)) {
- restore_flags(flags);
- return(-ERESTARTSYS);
- }
- interruptible_sleep_on(&portp->raw_wait);
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CLOSING, &portp->state));
+ if (signal_pending(current)) {
+ restore_flags(flags);
+ return -ERESTARTSYS;
}
/*
*/
rc = 0;
set_bit(ST_OPENING, &portp->state);
- while (test_bit(ST_OPENING, &portp->state)) {
- if (signal_pending(current)) {
- rc = -ERESTARTSYS;
- break;
- }
- interruptible_sleep_on(&portp->raw_wait);
- }
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_OPENING, &portp->state));
+ if (signal_pending(current))
+ rc = -ERESTARTSYS;
restore_flags(flags);
if ((rc == 0) && (portp->rc != 0))
* occurs on this port.
*/
if (wait) {
- while (test_bit(ST_CLOSING, &portp->state)) {
- if (signal_pending(current)) {
- restore_flags(flags);
- return(-ERESTARTSYS);
- }
- interruptible_sleep_on(&portp->raw_wait);
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CLOSING, &portp->state));
+ if (signal_pending(current)) {
+ restore_flags(flags);
+ return -ERESTARTSYS;
}
}
* to come back.
*/
rc = 0;
- while (test_bit(ST_CLOSING, &portp->state)) {
- if (signal_pending(current)) {
- rc = -ERESTARTSYS;
- break;
- }
- interruptible_sleep_on(&portp->raw_wait);
- }
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CLOSING, &portp->state));
+ if (signal_pending(current))
+ rc = -ERESTARTSYS;
restore_flags(flags);
if ((rc == 0) && (portp->rc != 0))
save_flags(flags);
cli();
- while (test_bit(ST_CMDING, &portp->state)) {
- if (signal_pending(current)) {
- restore_flags(flags);
- return(-ERESTARTSYS);
- }
- interruptible_sleep_on(&portp->raw_wait);
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CMDING, &portp->state));
+ if (signal_pending(current)) {
+ restore_flags(flags);
+ return -ERESTARTSYS;
}
stli_sendcmd(brdp, portp, cmd, arg, size, copyback);
- while (test_bit(ST_CMDING, &portp->state)) {
- if (signal_pending(current)) {
- restore_flags(flags);
- return(-ERESTARTSYS);
- }
- interruptible_sleep_on(&portp->raw_wait);
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CMDING, &portp->state));
+ if (signal_pending(current)) {
+ restore_flags(flags);
+ return -ERESTARTSYS;
}
restore_flags(flags);