Commit cecdb36f authored by Domen Puncer's avatar Domen Puncer Committed by Linus Torvalds

[PATCH] char/istallion: replace interruptible_sleep_on() with wait_event_interruptible()

Use wait_event_interruptible() instead of the deprecated
interruptible_sleep_on().  The replacements were all straight-forward as every
sleep was conditionally-looped.  Patch is compile-tested (still warns about
{save,restore}_flags(),cli()).
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarDomen Puncer <domen@coderock.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dfdcfd63
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/wait.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -1068,11 +1069,10 @@ static int stli_open(struct tty_struct *tty, struct file *filp) ...@@ -1068,11 +1069,10 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
tty->driver_data = portp; tty->driver_data = portp;
portp->refcount++; portp->refcount++;
while (test_bit(ST_INITIALIZING, &portp->state)) { wait_event_interruptible(portp->raw_wait,
if (signal_pending(current)) !test_bit(ST_INITIALIZING, &portp->state));
return(-ERESTARTSYS); if (signal_pending(current))
interruptible_sleep_on(&portp->raw_wait); return(-ERESTARTSYS);
}
if ((portp->flags & ASYNC_INITIALIZED) == 0) { if ((portp->flags & ASYNC_INITIALIZED) == 0) {
set_bit(ST_INITIALIZING, &portp->state); set_bit(ST_INITIALIZING, &portp->state);
...@@ -1275,12 +1275,11 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i ...@@ -1275,12 +1275,11 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
* order of opens and closes may not be preserved across shared * order of opens and closes may not be preserved across shared
* memory, so we must wait until it is complete. * memory, so we must wait until it is complete.
*/ */
while (test_bit(ST_CLOSING, &portp->state)) { wait_event_interruptible(portp->raw_wait,
if (signal_pending(current)) { !test_bit(ST_CLOSING, &portp->state));
restore_flags(flags); if (signal_pending(current)) {
return(-ERESTARTSYS); restore_flags(flags);
} return -ERESTARTSYS;
interruptible_sleep_on(&portp->raw_wait);
} }
/* /*
...@@ -1309,13 +1308,10 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i ...@@ -1309,13 +1308,10 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
*/ */
rc = 0; rc = 0;
set_bit(ST_OPENING, &portp->state); set_bit(ST_OPENING, &portp->state);
while (test_bit(ST_OPENING, &portp->state)) { wait_event_interruptible(portp->raw_wait,
if (signal_pending(current)) { !test_bit(ST_OPENING, &portp->state));
rc = -ERESTARTSYS; if (signal_pending(current))
break; rc = -ERESTARTSYS;
}
interruptible_sleep_on(&portp->raw_wait);
}
restore_flags(flags); restore_flags(flags);
if ((rc == 0) && (portp->rc != 0)) if ((rc == 0) && (portp->rc != 0))
...@@ -1352,12 +1348,11 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, ...@@ -1352,12 +1348,11 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
* occurs on this port. * occurs on this port.
*/ */
if (wait) { if (wait) {
while (test_bit(ST_CLOSING, &portp->state)) { wait_event_interruptible(portp->raw_wait,
if (signal_pending(current)) { !test_bit(ST_CLOSING, &portp->state));
restore_flags(flags); if (signal_pending(current)) {
return(-ERESTARTSYS); restore_flags(flags);
} return -ERESTARTSYS;
interruptible_sleep_on(&portp->raw_wait);
} }
} }
...@@ -1385,13 +1380,10 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, ...@@ -1385,13 +1380,10 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
* to come back. * to come back.
*/ */
rc = 0; rc = 0;
while (test_bit(ST_CLOSING, &portp->state)) { wait_event_interruptible(portp->raw_wait,
if (signal_pending(current)) { !test_bit(ST_CLOSING, &portp->state));
rc = -ERESTARTSYS; if (signal_pending(current))
break; rc = -ERESTARTSYS;
}
interruptible_sleep_on(&portp->raw_wait);
}
restore_flags(flags); restore_flags(flags);
if ((rc == 0) && (portp->rc != 0)) if ((rc == 0) && (portp->rc != 0))
...@@ -1420,22 +1412,20 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v ...@@ -1420,22 +1412,20 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v
save_flags(flags); save_flags(flags);
cli(); cli();
while (test_bit(ST_CMDING, &portp->state)) { wait_event_interruptible(portp->raw_wait,
if (signal_pending(current)) { !test_bit(ST_CMDING, &portp->state));
restore_flags(flags); if (signal_pending(current)) {
return(-ERESTARTSYS); restore_flags(flags);
} return -ERESTARTSYS;
interruptible_sleep_on(&portp->raw_wait);
} }
stli_sendcmd(brdp, portp, cmd, arg, size, copyback); stli_sendcmd(brdp, portp, cmd, arg, size, copyback);
while (test_bit(ST_CMDING, &portp->state)) { wait_event_interruptible(portp->raw_wait,
if (signal_pending(current)) { !test_bit(ST_CMDING, &portp->state));
restore_flags(flags); if (signal_pending(current)) {
return(-ERESTARTSYS); restore_flags(flags);
} return -ERESTARTSYS;
interruptible_sleep_on(&portp->raw_wait);
} }
restore_flags(flags); restore_flags(flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment